Information Technology Reference
In-Depth Information
Figure 16-10. Command resource
NOTE
The
its
method is a way to access attributes of a resource in
should
form. To access re-
source attributes in
expect
form, use a chained method with the attribute name, using
statements like:
expect(command(...).attribute)
Add a new example to
default_spec.rb
as shown in
Example 16-7
.
By running the
curl
localhost
command, you can inspect the HTML output of the website to ensure that it is
working correctly.
Using the
stdout
attribute of the
command
resource, we can take a look at the output of the
curl
command returned on
standard output
. It is a convention that programs generate their
output to two different standard file handles:
stdout
and
stderr
, for regular program output
and errors, respectively. This way, other computer programs can open these file handles and
inspect the contents in an automated fashion. Our example does not care about any errors
happening on
stderr
because getting notified that an error happened through Ruby excep-