diff options
| author | mo khan <mo@mokhan.ca> | 2016-05-05 20:15:55 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-05-05 20:15:55 -0600 |
| commit | b49a475c89848061cef7c705138e33a139a65fb4 (patch) | |
| tree | 7910175b7dcbae48a9226bf5136e7f4b27984ada /features | |
| parent | 852688dd3a3d346ef03e96e53104724e7b0485d0 (diff) | |
hound happy.
Diffstat (limited to 'features')
| -rw-r--r-- | features/step_definitions/authentication_steps.rb | 6 | ||||
| -rw-r--r-- | features/step_definitions/gym_steps.rb | 8 | ||||
| -rw-r--r-- | features/step_definitions/registration_steps.rb | 14 | ||||
| -rw-r--r-- | features/support/env.rb | 48 |
4 files changed, 15 insertions, 61 deletions
diff --git a/features/step_definitions/authentication_steps.rb b/features/step_definitions/authentication_steps.rb index f3d493b..8cf806d 100644 --- a/features/step_definitions/authentication_steps.rb +++ b/features/step_definitions/authentication_steps.rb @@ -1,6 +1,6 @@ -Given /^the user is logged in$/ do - user = FactoryGirl.create(:user, password: 'password') +Given(/^the user is logged in$/) do + user = FactoryGirl.create(:user, password: "password") login_page = LoginPage.new login_page.visit_page - login_page.login_with(user.username, 'password') + login_page.login_with(user.username, "password") end diff --git a/features/step_definitions/gym_steps.rb b/features/step_definitions/gym_steps.rb index 4246df7..3be4316 100644 --- a/features/step_definitions/gym_steps.rb +++ b/features/step_definitions/gym_steps.rb @@ -1,21 +1,21 @@ -When /^the user is on the gyms page$/ do +When(/^the user is on the gyms page$/) do @subject = GymsPage.new @subject.visit_page end -And /^There are (.*) gyms$/ do |n| +And(/^There are (.*) gyms$/) do |n| @gyms = n.to_i.times.map do FactoryGirl.create(:gym) end end -Then /^it lists all gyms$/ do +Then(/^it lists all gyms$/) do @gyms.each do |gym| expect(@subject).to have_content(gym.name) end end -When /^they search for a city/ do +When(/^they search for a city/) do gym = @gyms.sample @subject.search(gym.location.city) @gyms = [gym] diff --git a/features/step_definitions/registration_steps.rb b/features/step_definitions/registration_steps.rb index d5e4ae4..c3ecbdd 100644 --- a/features/step_definitions/registration_steps.rb +++ b/features/step_definitions/registration_steps.rb @@ -1,9 +1,9 @@ -Given /^the user is on the registration page$/ do +Given(/^the user is on the registration page$/) do @subject = NewRegistrationPage.new @subject.visit_page end -When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password| +When(/^they enter a (.*), (.*) and (.*)$/) do |username, email, password| @subject.register_with( username: username, email: email, @@ -11,18 +11,18 @@ When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password| ) end -When /^the username (.*) is already registered$/ do |username| +When(/^the username (.*) is already registered$/) do |username| FactoryGirl.create(:user, username: username) end -When /^the email (.*) is already registered$/ do |email| +When(/^the email (.*) is already registered$/) do |email| FactoryGirl.create(:user, email: email) end -Then /^it redirects them to the dashboard$/ do +Then(/^it redirects them to the dashboard$/) do expect(@subject.current_path).to eql(dashboard_path) end -Then /^it displays the following (.*)$/ do |text| - expect(@subject).to have_content(text.gsub(/["'<>]/, '')) +Then(/^it displays the following (.*)$/) do |text| + expect(@subject).to have_content(text.gsub(/["'<>]/, "")) end diff --git a/features/support/env.rb b/features/support/env.rb index caacf93..91b310e 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,55 +1,9 @@ -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. -# It is recommended to regenerate this file in the future when you upgrade to a -# newer version of cucumber-rails. Consider adding your own code to a new file -# instead of editing this one. Cucumber will automatically load all features/**/*.rb -# files. - -require 'cucumber/rails' +require "cucumber/rails" require "capybara/poltergeist" $flipper.enable(:gym) -# Capybara defaults to CSS3 selectors rather than XPath. -# If you'd prefer to use XPath, just uncomment this line and adjust any -# selectors in your step definitions to use the XPath syntax. -# Capybara.default_selector = :xpath - -# By default, any exception happening in your Rails application will bubble up -# to Cucumber so that your scenario will fail. This is a different from how -# your application behaves in the production environment, where an error page will -# be rendered instead. -# -# Sometimes we want to override this default behaviour and allow Rails to rescue -# exceptions and display an error page (just like when the app is running in production). -# Typical scenarios where you want to do this is when you test your error pages. -# There are two ways to allow Rails to rescue exceptions: -# -# 1) Tag your scenario (or feature) with @allow-rescue -# -# 2) Set the value below to true. Beware that doing this globally is not -# recommended as it will mask a lot of errors for you! -# ActionController::Base.allow_rescue = false - DatabaseCleaner.strategy = :transaction - -# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. -# See the DatabaseCleaner documentation for details. Example: -# -# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do -# # { :except => [:widgets] } may not do what you expect here -# # as Cucumber::Rails::Database.javascript_strategy overrides -# # this setting. -# DatabaseCleaner.strategy = :truncation -# end -# -# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do -# DatabaseCleaner.strategy = :transaction -# end -# - Capybara.javascript_driver = :poltergeist -# Possible values are :truncation and :transaction -# The :transaction strategy is faster, but might give you threading problems. -# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature Cucumber::Rails::Database.javascript_strategy = :truncation Dir[Rails.root.join("spec/support/pages/*.rb")].each { |x| require x } |
