From cbeeb7e2a10f977848b5a487e9d9bb98ee602cae Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 20 Feb 2017 09:55:23 -0700 Subject: [PATCH] [BUG] Skip course recommendations properly on profile complete --- app/controllers/profiles_controller.rb | 5 ++++- config/deploy/staging.rb | 2 +- spec/features/user_logs_in_spec.rb | 24 +++++++++++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 213fc44a..c229fb82 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -80,7 +80,10 @@ def organization_programs end def show_quiz? - current_user.present? && current_user.quiz_modal_complete == false && !current_user.profile.opt_out_of_recommendations && !current_user.has_role?(:admin, current_organization) + current_user.present? && + current_user.quiz_modal_complete == false && + !(params[:profile][:opt_out_of_recommendations] == "true") && + !current_user.has_role?(:admin, current_organization) end end diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index ec81459f..d3f39821 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -3,7 +3,7 @@ set :bundle_without, %w{integration production test}.join(" ") -set :branch, "release-2.1.4" +set :branch, "release-2.1.4.1" server "dl-stageapp-01.do.lark-it.com", user: fetch(:application), diff --git a/spec/features/user_logs_in_spec.rb b/spec/features/user_logs_in_spec.rb index b3004729..bbb94631 100644 --- a/spec/features/user_logs_in_spec.rb +++ b/spec/features/user_logs_in_spec.rb @@ -60,7 +60,7 @@ expect(current_path).to eq(profile_path) end - scenario "first time login with program org" do + scenario "first time login with program org, with course recommendations" do @npl = create(:organization, :accepts_programs, subdomain: "npl") @npl_profile = create(:profile, :with_last_name) @npl_user = create(:first_time_user, organization: @npl, profile: @npl_profile) @@ -68,6 +68,28 @@ log_in_with(@npl_user.email, @npl_user.password) expect(current_path).to eq(profile_path) + + fill_in "Last Name", with: Faker::Name.last_name + + click_on "Save" + + expect(current_path).to eq(courses_quiz_path) + end + + scenario "first time login with program org, no course recommendations" do + @npl = create(:organization, :accepts_programs, subdomain: "npl") + @npl_profile = create(:profile, :with_last_name) + @npl_user = create(:first_time_user, organization: @npl, profile: @npl_profile) + switch_to_subdomain("npl") + log_in_with(@npl_user.email, @npl_user.password) + + expect(current_path).to eq(profile_path) + + fill_in "Last Name", with: Faker::Name.last_name + choose "profile_opt_out_of_recommendations_true" + click_on "Save" + + expect(current_path).to eq(root_path) end scenario "with an invalid profile for a program org" do