Skip to content

Commit

Permalink
[BUG] Skip course recommendations properly on profile complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Reis committed Feb 20, 2017
1 parent 4cb0e15 commit cbeeb7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion config/deploy/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
24 changes: 23 additions & 1 deletion spec/features/user_logs_in_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,36 @@
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)
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

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
Expand Down

0 comments on commit cbeeb7e

Please sign in to comment.