Coulda Web Steps provides some reusable steps for Coulda acceptance testing of Rack/Rails applications.
-
Factories are used to create objects
-
Factoried objects are stored in instance variables on the test object
-
Factoried objects are accessible at class scope by name using Symbols.
Coulda web steps uses Symbols as a convention to reference instance variables at class scope.
For instance:
when_i_visit :job, :job_instance
Calls [github.com/jnicklas/capybara Capybara]‘s #visit method with “job_path(@job_instance)” where job_path is mapped from :job (adding “_path” is a convention to support Rails) and @job_instance is mapped directly from :job_instance.
Write the following in your test_helper:
Coulda.default_test_case_class = Test::Unit::TestCase class Test::Unit::TestCase extend Coulda::WebSteps end
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally. (No there aren’t tests for this code yet; however, almost all of it is running in a project somewhere already and working.)
-
Please try not to mess with the Rakefile or VERSION. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Thanks to the following for letting me OSS this:
-
WiseView
-
Amit Lubling and Zack Cleary
-
djbrowning for the seed of what became “#given_a”
Copyright © 2010, 2011 Evan Light. See LICENSE.txt for further details.