Commit 5ac92cb

mo khan <mo@mokhan.ca>
2016-04-21 16:00:36
add a cucumber spec for registration.
1 parent cff1d71
Changed files (4)
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
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 }
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
Rakefile
@@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__)
 
 Rails.application.load_tasks
 
-task default: [:spec, :teaspoon]
+task default: [:spec, :teaspoon, :cucumber]