Information Technology Reference
In-Depth Information
Figure 16-8. Serverspec port resource be_listening matcher documentation
As you can see from this documentation, you'll also encounter a legacy RSpec form that was
used prior to RSpec 3.0: the should form . The should form was deprecated with RSpec 3.0,
because it can produce unexpected results for some testing code edge cases. However, some
sites, such as the Serverspec documentation site, haven't been updated.
Figure 16-9 shows how you can map old documentation in should form to expect form . With
should form , the resource is in a describe block around the it clause. With expect form , this
is a parameter passed to expect . You can also see how the matcher form differs. With should ,
expectations are expressed as should or should not , for positive and negative expectations,
respectively. With expect , expectations are expressed as the chained methods .to or
.not_to . Finally, in should form , matcher parameters are expessed using a chained .with()
syntax, whereas in expect form, it is just a parameter to the matcher.
Search WWH ::




Custom Search