Commit 974c05f
Changed files (2)
features
step_definitions
features/step_definitions/registration_steps.rb
@@ -4,7 +4,6 @@ Given /^the user is on the registration page$/ do
end
When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
- puts [username, email, password].inspect
@subject.register_with(
username: username,
email: email,
@@ -12,6 +11,14 @@ When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
)
end
-Then /^it should take them to the dashboard$/ do
+When /^the (.*) is already registered$/ do |username|
+ FactoryGirl.create(:user, username: username)
+end
+
+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(/["'<>]/, ''))
+end
features/registration.feature
@@ -6,7 +6,18 @@ Feature: Registration
Scenario Outline: 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
+ Then it redirects them to the dashboard
+
+ Examples:
+ | username | email | password |
+ | mo | mo@example.org | password |
+ | joe | joe@example.org | the secret |
+
+ Scenario Outline:: The username is taken
+ Given the user is on the registration page
+ When the <username> is already registered
+ And they enter a <username>, <email> and <password>
+ Then it displays the following "Username has already been taken"
Examples:
| username | email | password |