diff --git a/app/views/devise/registrations/_form.html.erb b/app/views/devise/registrations/_form.html.erb index 6160c57..8611333 100644 --- a/app/views/devise/registrations/_form.html.erb +++ b/app/views/devise/registrations/_form.html.erb @@ -7,8 +7,9 @@
<% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
+ (<%= @minimum_password_length %> characters minimum) + <% end %> +
<%= f.password_field :password, autocomplete: "off" %>
@@ -16,7 +17,26 @@ <%= f.password_field :password_confirmation, autocomplete: "off" %> + <% unless Rails.env.test? %> +
+
+
+ <% end %> +
<%= f.submit "Join us", :class => "button button-3d button button-rounded button-green" %>
<% end %> + +<% unless Rails.env.test? %> + +<% end %> \ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 10550e6..150c416 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -21,8 +21,9 @@
-
+

Register with your personal email

+
If you are an existing member of MENAdevs Slack group,
you can skip registration and login using your Slack credentials
<%= render "form" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index b913ca5..4c33a6b 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -3,7 +3,7 @@
-

Use ONE of the below login options

+

Use ONE of the login options below to login

@@ -17,12 +17,12 @@
-
-

Slack credentials

+
+

MENAdevs Slack credentials

- Use ONLY if you are a member of MENA devs Slack group + ONLY use if you are a member of MENAdevs Slack group
@@ -35,7 +35,7 @@
-
+

Personal email and password

diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 397a56e..d38ea27 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -25,6 +25,8 @@ <%= display_meta_tags site: AppSettings.application_name %> + + diff --git a/config/settings/development.yml.sample b/config/settings/development.yml.sample index a2646d9..f02828e 100644 --- a/config/settings/development.yml.sample +++ b/config/settings/development.yml.sample @@ -9,6 +9,8 @@ slack_team_name: '' slack_team_id: '' buffer_access_token: '' +recaptcha_client_key: '' + mailgun_api_key: '' mailchimp_api_key: '' mail_host: '' diff --git a/config/settings/production.yml.sample b/config/settings/production.yml.sample index a2646d9..f02828e 100644 --- a/config/settings/production.yml.sample +++ b/config/settings/production.yml.sample @@ -9,6 +9,8 @@ slack_team_name: '' slack_team_id: '' buffer_access_token: '' +recaptcha_client_key: '' + mailgun_api_key: '' mailchimp_api_key: '' mail_host: '' diff --git a/config/settings/test.yml.sample b/config/settings/test.yml.sample index bff7aec..ad86509 100644 --- a/config/settings/test.yml.sample +++ b/config/settings/test.yml.sample @@ -10,6 +10,8 @@ slack_team_name: 'mena developers' slack_team_id: '' buffer_access_token: '' +recaptcha_client_key: '' + mailgun_api_key: '' mailchimp_api_key: '' mail_host: 'smtp.sparkpostmail.com' diff --git a/spec/requests/registrations_spec.rb b/spec/requests/registrations_spec.rb new file mode 100644 index 0000000..c4a8868 --- /dev/null +++ b/spec/requests/registrations_spec.rb @@ -0,0 +1,66 @@ +require 'rails_helper' + +RSpec.describe "Registrations", type: :request do + include Devise::Test::IntegrationHelpers + + let(:existing_user) { create(:user, password: 'password') } + + describe "GET /users/sign_up" do + before do + visit new_user_registration_path + + expect(page).to have_content('Register with your personal email') + expect(page).to have_content('Email') + expect(page).to have_content('Password') + expect(page).to have_content('Password confirmation') + end + + describe "Successful" do + it "should register user successfully after filling the form" do + fill_in 'user_email', with: 'email@example.com' + fill_in 'user_password', with: 'password' + fill_in 'Password confirmation', with: 'password' + + click_on('Join us') + + expect(page).to have_content("We are MENA Devs") + end + end + + describe "Fails" do + it "should fail registration because email already exists" do + fill_in 'Email', with: existing_user.email + fill_in 'Password', with: 'password' + fill_in 'Password confirmation', with: 'password' + + click_on('Join us') + + expect(page).to have_content("1 error prohibited this user from being saved") + expect(page).to have_content("Email has already been taken") + end + + it "should fail registration because passwords do not match" do + fill_in 'Email', with: 'mars@example.com' + fill_in 'Password', with: 'password' + fill_in 'Password confirmation', with: 'passwordz' + + click_on('Join us') + + expect(page).to have_content("1 error prohibited this user from being saved") + expect(page).to have_content("Password confirmation doesn't match Password") + end + + + it "should fail registration because email address is incorrect" do + fill_in 'Email', with: 'mars-example.com' + fill_in 'Password', with: 'password' + fill_in 'Password confirmation', with: 'password' + + click_on('Join us') + + expect(page).to have_content("1 error prohibited this user from being saved") + expect(page).to have_content("Email is invalid") + end + end + end +end \ No newline at end of file