1 # frozen_string_literal: true
6 class HeatmapsControllerTest < ActionDispatch::IntegrationTest
8 # test all routes which lead to this controller
11 { :path => "/profile/heatmap", :method => :put },
12 { :controller => "profiles/heatmaps", :action => "update" }
17 user = create(:user, :public_heatmap => true)
20 heatmap_selector = ".heatmap_frame"
22 assert_predicate user.reload, :public_heatmap?
24 assert_select heatmap_selector
26 put profile_heatmap_path, :params => { :user => { :public_heatmap => "0" } }
28 assert_redirected_to user_path(user)
30 assert_response :success
32 assert_dom ".alert-success", :text => "Heatmap updated."
34 assert_not_predicate user.reload, :public_heatmap?
35 refute_select heatmap_selector
37 put profile_heatmap_path, :params => { :user => { :public_heatmap => "1" } }
39 assert_redirected_to user_path(user)
41 assert_response :success
43 assert_dom ".alert-success", :text => "Heatmap updated."
45 assert_predicate user.reload, :public_heatmap?
46 assert_select heatmap_selector