Commit d206f2bd8c588eae35ba27fb08b97763bb867809
1 parent
378f2fe3
Exists in
colab
and in
4 other branches
Homepage acceptance tests
Showing
5 changed files
with
37 additions
and
3 deletions
Show diff stats
Gemfile.lock
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +Feature: Homepage | |
| 2 | + In Order to have a good interaction with the website | |
| 3 | + As a regular user | |
| 4 | + I want to have in one page useful links to manage my account and session | |
| 5 | + | |
| 6 | + Scenario: Before signing in | |
| 7 | + Given I am at the homepage | |
| 8 | + Then I should see Login | |
| 9 | + And I should see Sign Up | |
| 10 | + | |
| 11 | + Scenario: Signed in | |
| 12 | + Given I am a regular user | |
| 13 | + And I am signed in | |
| 14 | + And I am at the homepage | |
| 15 | + Then I should see Edit | |
| 16 | + And I should see Logout | |
| 0 | 17 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +Given(/^I am at the homepage$/) do | |
| 2 | + visit root_path | |
| 3 | +end | |
| 4 | + | |
| 5 | +Given(/^I am signed in$/) do | |
| 6 | + login_as(@user, :scope => :user) | |
| 7 | +end | |
| 8 | + | |
| 9 | +Given(/^I am a regular user$/) do | |
| 10 | + @user = FactoryGirl.create(:user) | |
| 11 | +end | |
| 12 | + | |
| 13 | +Then(/^I should see (.+)$/) do |text| | |
| 14 | + page.should have_content(text) | |
| 15 | +end | |
| 0 | 16 | \ No newline at end of file | ... | ... |
features/support/env.rb
| ... | ... | @@ -12,8 +12,8 @@ require 'cucumber/rails' |
| 12 | 12 | # Capybara.default_selector = :xpath |
| 13 | 13 | |
| 14 | 14 | # By default, any exception happening in your Rails application will bubble up |
| 15 | -# to Cucumber so that your scenario will fail. This is a different from how | |
| 16 | -# your application behaves in the production environment, where an error page will | |
| 15 | +# to Cucumber so that your scenario will fail. This is a different from how | |
| 16 | +# your application behaves in the production environment, where an error page will | |
| 17 | 17 | # be rendered instead. |
| 18 | 18 | # |
| 19 | 19 | # Sometimes we want to override this default behaviour and allow Rails to rescue |
| ... | ... | @@ -56,3 +56,5 @@ end |
| 56 | 56 | # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature |
| 57 | 57 | Cucumber::Rails::Database.javascript_strategy = :truncation |
| 58 | 58 | |
| 59 | +# Warden test helpers so the user authentication can be as fast as possible | |
| 60 | +include Warden::Test::Helpers | |
| 59 | 61 | \ No newline at end of file | ... | ... |