[LRUG] Writing readable feature tests with RSpec
Andrew France
andrew at avito.co.uk
Fri Jul 25 03:43:54 PDT 2014
I dislike Cucumber for the burden it imposes and also use RSpec/Capybara
feature style tests. I'm not sure it's useful to split out every line to
a method with given/when/then, you may as well just use Turnip. I
extract out common steps to a library of methods, `visit_home_page`,
`click_on_nav "Home"`, but will often leave in the actual code for the
test I'm interested in.
You might find it worthwhile to create RSpec matchers, so you can write:
`expect(page).to have_flash_message("Thanks for joining.")` or
`expect(page).to show_course(@course)`.
Cheers,
Andrew
> Joel Chippindale <mailto:joel.chippindale at futurelearn.com>
> 25 July 2014 10:26
> We recently blogged about how, at FutureLearn, we write readable
> feature tests with RSpec*, see
> https://about.futurelearn.com/blog/how-we-write-readable-feature-tests-with-rspec/,
> and it made me wonder how common this approach was.
>
> Are any of you using this approach already? If so, how are you finding it?
>
> J.
>
>
> * Hat tip to the developers at Econsultancy who introduced me to this
> way of using RSpec.
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140725/89798c99/attachment-0003.html>
More information about the Chat
mailing list