summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-04-23 10:53:41 -0600
committermo khan <mo@mokhan.ca>2016-04-23 10:53:41 -0600
commitb836bf322854930ba04f75a9cc76e9fe3a8924c9 (patch)
tree1fa727b089d1aef9610055d14d73e553171733a4 /features
parent974c05fff40d0b6bab4c6c57fd0370461401dc1c (diff)
add spec for registered email address.
Diffstat (limited to 'features')
-rw-r--r--features/registration.feature13
-rw-r--r--features/step_definitions/registration_steps.rb6
2 files changed, 17 insertions, 2 deletions
diff --git a/features/registration.feature b/features/registration.feature
index 3b51df9..0039bc0 100644
--- a/features/registration.feature
+++ b/features/registration.feature
@@ -15,7 +15,7 @@ Feature: Registration
Scenario Outline:: The username is taken
Given the user is on the registration page
- When the <username> is already registered
+ When the username <username> is already registered
And they enter a <username>, <email> and <password>
Then it displays the following "Username has already been taken"
@@ -23,3 +23,14 @@ Feature: Registration
| username | email | password |
| mo | mo@example.org | password |
| joe | joe@example.org | the secret |
+
+ Scenario Outline:: The email address is already registered
+ Given the user is on the registration page
+ When the email <email> is already registered
+ And they enter a <username>, <email> and <password>
+ Then it displays the following "Email has already been taken"
+
+ Examples:
+ | username | email | password |
+ | mo | mo@example.org | password |
+ | joe | joe@example.org | the secret |
diff --git a/features/step_definitions/registration_steps.rb b/features/step_definitions/registration_steps.rb
index b32421b..d5e4ae4 100644
--- a/features/step_definitions/registration_steps.rb
+++ b/features/step_definitions/registration_steps.rb
@@ -11,10 +11,14 @@ When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
)
end
-When /^the (.*) 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|
+ FactoryGirl.create(:user, email: email)
+end
+
Then /^it redirects them to the dashboard$/ do
expect(@subject.current_path).to eql(dashboard_path)
end