- Why does a
ActionController::RoutingErrorpop up even though all of the scenario steps are passing? This has been a recurring issue.
- This was breaking because of ‘visit admin_partner_path(@user)’ that was in the final step of
- How explicit must I be when testing a feature? What’s the balance between being too explicit in my feature testing, and not covering everything that should be tested?
Tips regarding Cucumber:
- Backgrounds should only be used when you have shared context, but should be used sparingly
- Want to frame our scenarios with user-driven language, not task-specific language
- Given is used to identify your starting point; if you’re testing a password feature, then you should be on the ‘Edit’ page for the User
- When is used to specify an Action of some kind; never use an assertion in a When clause
- Then is where you make assertions for the test
- Warden test helpers for Cucumber will automatically log you in for a test without actually walking through the login steps
1 2 3
- Only time, from this point forward, that you should visit and fill-in a login form is if you’re explicitly testing the login feature
- If you need to be logged in as a Partner, use the
Given I am logged in as a Partnerstep. Same for other AdminUser roles as well.
- FactoryGirl helpers in cucumber will enable you to implicitly imply FactoryGirl object