From 550c5ad6f6b0c0d8b911713cd9e0e34928282c4a Mon Sep 17 00:00:00 2001 From: mlorb Date: Fri, 20 Oct 2017 14:48:47 +0200 Subject: [PATCH 1/2] add integration test for signup.feature --- app/views/users/registrations/new.html.erb | 4 ++-- features/sign_in_sign_up/sign_up.feature | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index f981a6ee5..e52665a78 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -23,12 +23,12 @@ <%= f.password_field :password, autocomplete: 'off', class: 'form-control' %> -
+
<%= f.label :password_confirmation %> <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %>
-
+
<%= label :team, :name, t('users.registrations.new.team_name_label') %> <% if @team %> <%= text_field :team, :name, class: 'form-control', value: @team.name %> diff --git a/features/sign_in_sign_up/sign_up.feature b/features/sign_in_sign_up/sign_up.feature index 3ad939d6b..bfdc45a11 100644 --- a/features/sign_in_sign_up/sign_up.feature +++ b/features/sign_in_sign_up/sign_up.feature @@ -27,3 +27,21 @@ Feature: Sign up And I click "Sign up" button Then I should see "SpliceGirls" And I should be on homepage + + @javascript + Scenario: Unsuccessful sign up, password confirmation does not match + Given I visit the sign up page + Then I fill the sign up form with + | Full name | Email | Password | Password confirmation | Team name | + | Magnus | magnus@gmail.com | asdf1234 | asdf1234567 | SpliceGirls | + And I click "Sign up" button + Then I should see "doesn't match Password" error message under "password_confirmation_form" field + + @javascript + Scenario: Unsuccessful sign up, team name is missing + Given I visit the sign up page + Then I fill the sign up form with + | Full name | Email | Password | Password confirmation | + | Magnus | magnus@gmail.com | asdf1234 | asdf1234 | + And I click "Sign up" button + Then I should see "is too short (minimum is 2 characters)" error message under "team_name_form" field From 9c3c32a36642b1f32e16531b3836f62d124f3082 Mon Sep 17 00:00:00 2001 From: mlorb Date: Mon, 23 Oct 2017 11:25:49 +0200 Subject: [PATCH 2/2] fix problem with unconfirmed users --- features/sign_up.feature | 55 ------------------------ features/step_definitions/users_steps.rb | 1 + 2 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 features/sign_up.feature diff --git a/features/sign_up.feature b/features/sign_up.feature deleted file mode 100644 index b2116b8da..000000000 --- a/features/sign_up.feature +++ /dev/null @@ -1,55 +0,0 @@ -# feature/sign up.feature -Feature: Sign up - As a new User - I want to Sign up as a new User - I want to create a new account - -Background: - Given the following users is registered: - | email | password | team - | nonadmin@myorg.com | mypassword1234 | BioSistemika Process - -Scenario: Successful Sign up - Given I am on Sign up page - Then I fill the Sign up form with - | Full name | Email | Password | Password confirmation | Team name | - | Karli | nonuser@myorg.com | mypassword1234 | mypassword1234 | BioSistemika Process | - And I click on reCAPTCHA. - And I click on "Sign up" button - Then I should see "BioSistemika Process" - Then I should see "Hi, Karli" nex to the avatar - And I should get a Gamification pop up message "Welcome to sciNote." - - Scenario: Unsuccessful Sign up, Password confirmation does not match - Given I am on Sign up page - Then I fill the Sign up form with - | Full name | Email | Password | Password confirmation | Team name | - | Karli | nonuser@myorg.com | mypassword1234 | mypassword123344 | BioSistemika Process | - And I click on reCAPTCHA. - And I click on "Sign up" button - Then I should see "doesn't match Password" error message under "Password confirmation" field - -Scenario: Unsuccessful Sign up, Team name is missing - Given I am on Sign up page - Then I fill the Sign up form with - | Full name | Email | Password | Password confirmation | - | Karli | nonuser@myorg.com | mypassword1234 | mypassword123344 | - And I click on reCAPTCHA. - And I click on "Sign up" button - Then I should see "is too short (minimum is 2 characters)" error message under "Team name" field - -Scenario: Unsuccessful Sign up, reCAPTCHA is missing - Given I am on Sign up page - Then I fill the Sign up form with - | Full name | Email | Password | Password confirmation | Team name | - | Karli | nonuser@myorg.com | mypassword1234 | mypassword1234 | BioSistemika Process | - And I click on "Sign up" button - Then I should see "reCAPTCHA verification failed, please try again." error message under "recaptcha" field - -Scenario: Unsuccessful Sign up, Email has already been taken - Given I am on Sign up page - Then I fill the Sign up form with - | Full name | Email | Password | Password confirmation | Team name | - | Karli | nonadmin@myorg.com | mypassword1234 | mypassword1234 | BioSistemika Process | - And I click on "Sign up" button - Then I should see "has already been taken" error message under Email field diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index b825b4004..50b44a973 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -1,6 +1,7 @@ Given(/^the following users are registered$/) do |table| table.hashes.each do |hash| FactoryGirl.create(:user, hash) + User.find_by_email(hash.fetch('email')).confirm end end