From 73819829ebb439d7c0e0406c85b36e230a1a8255 Mon Sep 17 00:00:00 2001 From: Lennart Hildebrandt Date: Mon, 8 Aug 2016 13:33:43 +0200 Subject: [PATCH] Fix after signup page. --- app/controllers/users_controller.rb | 1 - app/views/users/after_signup_edit.html.haml | 8 ++-- config/locales/de/rails.yml | 2 - config/locales/en/rails.yml | 2 - spec/features/user_after_signup_spec.rb | 43 ++------------------- 5 files changed, 8 insertions(+), 48 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index afd676fff..768ba9c42 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -71,7 +71,6 @@ def after_signup_update end redirect_to after_sign_in_path_for(:user) else - flash.now[:alert] = @user.errors.full_messages.to_sentence render :template => 'users/after_signup_edit' end end diff --git a/app/views/users/after_signup_edit.html.haml b/app/views/users/after_signup_edit.html.haml index 94b79de22..8b6efbcf3 100644 --- a/app/views/users/after_signup_edit.html.haml +++ b/app/views/users/after_signup_edit.html.haml @@ -1,5 +1,5 @@ .content.user-after-signup - = semantic_form_for @user, :url => after_signup_update_profile_path, :method => :put, :html => {:novalidate => '' } do |form| + = semantic_form_for @user, :url => after_signup_update_profile_path, :method => :put, :html => { :novalidate => '' } do |form| .row-fluid.mt10 .span10.offset1 %h3=t('.welcome.headline') @@ -9,12 +9,12 @@ .row-fluid.mt30 .span6.offset1 = form.inputs do - = form.input :email, hint: true, required: true - = form.input :first_time, :as => :hidden, :input_html => { :value => @user.encrypted_password.blank? ? '1' : '0' } + = form.input :email + = form.input :first_time, as: :hidden, input_html: { value: @user.encrypted_password.blank? ? '1' : '0' } = form.actions class:'form-actions' do = link_to t('common.skip'), after_sign_in_path_for(:user), class: 'pull-left btn' - %input.small.update.btn#user_submit{:name => 'commit', :type => 'submit', :value => t('formtastic.labels.finish'), :style => 'display:inline', class: 'pull-right btn-primary', :'data-confirm' => t('devise.confirmations.send_instructions')} + %input.small.update.btn#user_submit{:name => 'commit', :type => 'submit', :value => t('formtastic.labels.finish'), :style => 'display:inline', class: 'pull-right btn-primary'} - content_for :javascript do = javascript_include_tag :search \ No newline at end of file diff --git a/config/locales/de/rails.yml b/config/locales/de/rails.yml index 86066bc3c..cbafa8de5 100644 --- a/config/locales/de/rails.yml +++ b/config/locales/de/rails.yml @@ -35,8 +35,6 @@ de: models: user: attributes: - email: - blank: "muss ausgefüllt werden, wenn ein Passwort gesetzt wird" privacy_policy: accepted: "müssen akzeptiert werden" terms: diff --git a/config/locales/en/rails.yml b/config/locales/en/rails.yml index c498cd98a..946520a3b 100644 --- a/config/locales/en/rails.yml +++ b/config/locales/en/rails.yml @@ -35,8 +35,6 @@ en: models: user: attributes: - email: - blank: "can't be blank if password is given" privacy_policy: accepted: "must be accepted" terms: diff --git a/spec/features/user_after_signup_spec.rb b/spec/features/user_after_signup_spec.rb index 0f00a86f1..41d0e5d76 100644 --- a/spec/features/user_after_signup_spec.rb +++ b/spec/features/user_after_signup_spec.rb @@ -15,28 +15,6 @@ visit after_signup_edit_profile_path end - context "when first_name, email & password are given " do - given!(:user) { FactoryGirl.create(:user, - first_name: 'horst', - email: 'horst@wheelmap.org', - password: 'password', - password_confirmation: 'password', - confirmed_at: '10.10.1999', - osm_id: 174 - )} - - # additional test - scenario "I want to finalize my signup and click on button without changing the email" do - within("#user_email_input") do - fill_in "user_email", with: "" - end - click_button 'Fertigstellen' - pending("Bug: 'Du bekommst in wenigen Minuten eine E-Mail mit einem Link' instead of 'Email muss ausgefüllt werden'") - fail - expect { raise StandardError, 'Email muss ausgefüllt werden' }.to raise_error('Email muss ausgefüllt werden') - end - end - context "when first_name & email are given" do given!(:user) { FactoryGirl.create(:user, first_name: 'horst2', @@ -47,14 +25,13 @@ osm_id: 174 )} - # Scenario: I set my password after signup - scenario "I set my password" do + # additional test + scenario "I want to finalize my signup and click on button without changing the email" do within("#user_email_input") do - fill_in "user_email", with: "" + fill_in "user_email", with: "" end click_button 'Fertigstellen' - skip("Bug: No password setting possible on after signup edit page. Needs correction!") - fail + expect(page.current_path).to eq(root_path) end # Scenario: I set my email after signup with existing password @@ -90,16 +67,4 @@ end end end - - describe "is not logged in" do - scenario "I set my email after signup without any prior password" do - pending("BUG: This test case needs a revision since '/users/password/new' is not used anymore") - expect(current_path).to eq(new_user_password_path) - # When I am on the new user password page - # When I fill in "E-Mail" with "horst@wheelmap.org" - # And I press "Passwort neu setzen" - # And PENDING: make cached flash testable - # And I should see "Du bekommst in wenigen Minuten eine E-Mail mit Informationen wie du dein Passwort neu setzen kannst." - end - end end