My acceptance tests (RSpec/Capybara) have some long sequences of steps all under a single it...do block, and I’d like to manually add some additional documentation of each step into the RSpec documentation output.
So where the RSpec output (in documentation format) currently looks like:
FooController
New user creates account and creates profile
it passes
Within the long sequence of steps I’d like to push some additional info to the output:
FooController
New user creates account and creates profile
... new user saw signup page!
... new user got email confirmation!
... confirmation link worked!
... new user saw empty profile!
... new user filled in profile
it passes
In terms of documenting the app, those extra statements would be better than a large black box with a single ‘it passed’ result message.
Since there is apparently no way to use multiple it...do blocks to build the long sequence of steps for a acceptance test, I’m hoping there is a simple way to push additional messages to the RSpec output stream, ideally with them being indented and displayed (red/green) as if they were pat or separate it...do examples.
Here’s what I did… added a nextstep(“message”) method to my specs that outputs “message” to the console using awesome_print gem so I can color it, and also to the logger.
A little hackish, but it does give us very nice descriptive output when running rspec, for example if we have
we get the more descriptive spec output as shown in the question (and if there’s a failure we see the step we were on):