Commit b836bf3
Changed files (2)
features
step_definitions
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
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 |