summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-04-21 10:00:36 -0600
committermo khan <mo@mokhan.ca>2016-04-21 10:00:36 -0600
commit5ac92cbb48edca69db0a0f8e39b1b829d1b5ddb6 (patch)
tree83c178189a09c2d43599c5a173328f744a68ef1b
parentcff1d71f284adadd5deff3ea223229afbb2ead12 (diff)
add a cucumber spec for registration.
-rw-r--r--Rakefile2
-rw-r--r--features/registration.feature9
-rw-r--r--features/step_definitions/registration_steps.rb12
-rw-r--r--features/support/env.rb2
4 files changed, 23 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 17e198b..8d09fbb 100644
--- a/Rakefile
+++ b/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]
diff --git a/features/registration.feature b/features/registration.feature
new file mode 100644
index 0000000..6229d5e
--- /dev/null
+++ b/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
diff --git a/features/step_definitions/registration_steps.rb b/features/step_definitions/registration_steps.rb
new file mode 100644
index 0000000..5d10535
--- /dev/null
+++ b/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
diff --git a/features/support/env.rb b/features/support/env.rb
index 64ddf61..a230c3a 100644
--- a/features/support/env.rb
+++ b/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 }