From 557d07d2f1093009806e3eec323517911288b941 Mon Sep 17 00:00:00 2001 From: Wendy Smoak Date: Wed, 1 Oct 2014 20:24:15 -0400 Subject: [PATCH] Rename Sign in tests and add Sign up tests. --- spec/features/{signin.rb => signin_spec.rb} | 0 spec/features/signup_spec.rb | 52 +++++++++++++++++++++ 2 files changed, 52 insertions(+) rename spec/features/{signin.rb => signin_spec.rb} (100%) create mode 100644 spec/features/signup_spec.rb diff --git a/spec/features/signin.rb b/spec/features/signin_spec.rb similarity index 100% rename from spec/features/signin.rb rename to spec/features/signin_spec.rb diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb new file mode 100644 index 000000000..9962df359 --- /dev/null +++ b/spec/features/signup_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper' + +feature "signup" do + + scenario "sign up for new account from top menubar" do + visit crops_path # something other than front page, which has multiple signup links + click_link 'Sign up' + fill_in 'Login name', with: 'person123' + fill_in 'Email', with: 'gardener@example.com' + fill_in 'Password', with: 'abc123' + fill_in 'Password confirmation', with: 'abc123' + check 'member_tos_agreement' + click_button 'Sign up' + page.has_content? 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + current_path.should eq root_path + end + + scenario "sign up for new account with existing username" do + visit crops_path # something other than front page, which has multiple signup links + click_link 'Sign up' + fill_in 'Login name', with: 'person123' + fill_in 'Email', with: 'gardener@example.com' + fill_in 'Password', with: 'abc123' + fill_in 'Password confirmation', with: 'abc123' + check 'member_tos_agreement' + click_button 'Sign up' + page.has_content? 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + current_path.should eq root_path + first('.signup a').click # click the 'Sign up' button in the middle of the page + fill_in 'Login name', with: 'person123' + fill_in 'Email', with: 'gardener@example.com' + fill_in 'Password', with: 'abc123' + fill_in 'Password confirmation', with: 'abc123' + check 'member_tos_agreement' + click_button 'Sign up' + page.has_content? 'Login name has already been taken' + end + + scenario "sign up for new account without accepting TOS" do + visit root_path + first('.signup a').click # click the 'Sign up' button in the middle of the page + fill_in 'Login name', with: 'person123' + fill_in 'Email', with: 'gardener@example.com' + fill_in 'Password', with: 'abc123' + fill_in 'Password confirmation', with: 'abc123' + # do not check 'member_tos_agreement' + click_button 'Sign up' + page.has_content? 'Tos agreement must be accepted' + current_path.should eq members_path + end + +end