diff options
| author | mo khan <mo@mokhan.ca> | 2016-04-21 10:00:36 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-04-21 10:00:36 -0600 |
| commit | 5ac92cbb48edca69db0a0f8e39b1b829d1b5ddb6 (patch) | |
| tree | 83c178189a09c2d43599c5a173328f744a68ef1b /features | |
| parent | cff1d71f284adadd5deff3ea223229afbb2ead12 (diff) | |
add a cucumber spec for registration.
Diffstat (limited to 'features')
| -rw-r--r-- | features/registration.feature | 9 | ||||
| -rw-r--r-- | features/step_definitions/registration_steps.rb | 12 | ||||
| -rw-r--r-- | features/support/env.rb | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/features/registration.feature b/features/registration.feature new file mode 100644 index 0000000..6229d5e --- /dev/null +++ b/features/registration.feature @@ -0,0 +1,9 @@ +Feature: Registration + Allow new users to register on the website. + As a new visitor + I want to register for an account to gain access to the website. + + Scenario: Register a new user + Given the user is on the registration page + When they enter a username, email and password + Then it should take them to the dashboard diff --git a/features/step_definitions/registration_steps.rb b/features/step_definitions/registration_steps.rb new file mode 100644 index 0000000..5d10535 --- /dev/null +++ b/features/step_definitions/registration_steps.rb @@ -0,0 +1,12 @@ +Given /the user is on the registration page/ do + @subject = NewRegistrationPage.new + @subject.visit_page +end + +When /they enter a username, email and password/ do + @subject.register_with(username: "mo", email: "mo@example.com", password: "password") +end + +Then /it should take them to the dashboard/ do + expect(@subject.current_path).to eql(dashboard_path) +end diff --git a/features/support/env.rb b/features/support/env.rb index 64ddf61..a230c3a 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -55,4 +55,4 @@ end # 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 } |
