File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def track_variables(variables={})
2727 #
2828 # `current_user.id` for logged in users.
2929 def distinct_id
30- session [ 'distinct_id' ] ||=
30+ cookies . signed [ 'distinct_id' ] ||=
3131 ( 0 ..4 ) . map { |i | i . even? ? ( 'A' ..'Z' ) . to_a [ rand ( 26 ) ] : rand ( 10 ) } . join
3232 end
3333
@@ -48,10 +48,10 @@ def ab_panel_options
4848 # in the user's session.
4949 def initialize_ab_panel! ( options = { } )
5050 AbPanel . reset!
51- AbPanel . conditions = session [ 'ab_panel_conditions' ]
52- session [ 'ab_panel_conditions' ] = AbPanel . conditions
53- AbPanel . funnels = session [ 'ab_panel_funnels' ]
54- session [ 'ab_panel_funnels' ] = AbPanel . funnels
51+ AbPanel . conditions = cookies . signed [ 'ab_panel_conditions' ]
52+ cookies . signed [ 'ab_panel_conditions' ] = AbPanel . conditions
53+ AbPanel . funnels = cookies . signed [ 'ab_panel_funnels' ]
54+ cookies . signed [ 'ab_panel_funnels' ] = AbPanel . funnels
5555
5656 {
5757 'distinct_id' => distinct_id ,
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ def session
1212 let ( :controller ) { Controller . new }
1313
1414 describe "#distinct_id" do
15+ let ( :cookies ) { { } }
16+ before { controller . stub_chain ( :cookies , :signed ) . and_return ( cookies ) }
1517 subject { controller . distinct_id }
1618
1719 it { should match /^([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])$/ }
You can’t perform that action at this time.
0 commit comments