Commit 0ba8da4

mo khan <mo@mokhan.ca>
2016-04-23 16:27:53
use table of examples.
1 parent f33a1a9
Changed files (2)
features/step_definitions/registration_steps.rb
@@ -1,12 +1,17 @@
-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 username, email and password/ do
-  @subject.register_with(username: "mo", email: "mo@example.com", password: "password")
+When /^they enter a (.*), (.*) and (.*)$/ do |username, email, password|
+  puts [username, email, password].inspect
+  @subject.register_with(
+    username: username,
+    email: email,
+    password: password
+  )
 end
 
-Then /it should take them to the dashboard/ do
+Then /^it should take them to the dashboard$/ do
   expect(@subject.current_path).to eql(dashboard_path)
 end
features/registration.feature
@@ -3,7 +3,12 @@ Feature: Registration
   As a new visitor
   I want to register for an account to gain access to the website.
 
-  Scenario: Register a new user
+  Scenario Outline: Register a new user
     Given the user is on the registration page
-    When they enter a username, email and password
+    When they enter a <username>, <email> and <password>
     Then it should take them to the dashboard
+
+    Examples:
+      | username | email          | password |
+      | mo       | mo@example.org | password |
+      | joe      | joe@example.org | the secret |