@@ -30,28 +30,28 @@ def checksum(url)
3030 context "first visit" do
3131 before { get :index , test : true }
3232
33- it { session [ :first_click ] . should include checksum ( current_url ) }
33+ it { expect ( FirstClickFreeSession . new ( session ) . clicks ) . to include checksum ( current_url ) }
3434 it { request . env [ "first_click_free_count" ] . should eq 1 }
3535 it { response . should be_success }
3636 end
3737
3838 context "subsequent visit to same page" do
39- before { session [ :first_click ] = [ checksum ( current_url ) ] }
39+ before { FirstClickFreeSession . new ( session ) . clicks = [ checksum ( current_url ) ] }
4040
4141 it { get :index ; request . env [ "first_click_free_count" ] . should eq 1 }
4242 it { expect { get :index } . not_to raise_error }
4343 end
4444
4545 context "subsequent visit to different page" do
46- before { session [ :first_click ] = [ checksum ( "http://test.host/another-page" ) ] }
46+ before { FirstClickFreeSession . new ( session ) . clicks = [ checksum ( "http://test.host/another-page" ) ] }
4747
4848 it { expect { get :index } . to raise_error FirstClickFree ::Exceptions ::SubsequentAccessException }
4949 end
5050
5151 context "subsequent visit to different page with unused multiple clicks" do
5252 before do
53- session [ :first_click ] = [ checksum ( "http://test.host/some-page" ) ,
54- checksum ( "http://test.host/some-other-page" ) ]
53+ FirstClickFreeSession . new ( session ) . clicks = [ checksum ( "http://test.host/some-page" ) ,
54+ checksum ( "http://test.host/some-other-page" ) ]
5555 FirstClickFree . free_clicks = 3
5656 end
5757
@@ -61,9 +61,9 @@ def checksum(url)
6161
6262 context "subsequent visit to different page with multiple clicks used up" do
6363 before do
64- session [ :first_click ] = [ checksum ( "http://test.host/some-page" ) ,
65- checksum ( "http://test.host/some-other-page" ) ,
66- checksum ( "http://test.host/yet-another-page" ) ]
64+ FirstClickFreeSession . new ( session ) . clicks = [ checksum ( "http://test.host/some-page" ) ,
65+ checksum ( "http://test.host/some-other-page" ) ,
66+ checksum ( "http://test.host/yet-another-page" ) ]
6767 FirstClickFree . free_clicks = 3
6868 end
6969
@@ -73,14 +73,14 @@ def checksum(url)
7373 context "googlebot visit" do
7474 before { controller . stub ( :googlebot? => true ) ; get :index }
7575
76- it { session [ :first_click ] . should be_nil }
76+ it { expect ( FirstClickFreeSession . new ( session ) . clicks ) . to be_empty }
7777 it { response . should be_success }
7878 end
7979
8080 context "registered user vist" do
8181 before { controller . stub ( :user_for_first_click_free => true ) ; get :index }
8282
83- it { session [ :first_click ] . should be_nil }
83+ it { expect ( FirstClickFreeSession . new ( session ) . clicks ) . to be_empty }
8484 it { response . should be_success }
8585 end
8686
@@ -102,7 +102,7 @@ def index
102102
103103 before { get :index }
104104
105- it { session [ :first_click ] . should be_nil }
105+ it { expect ( FirstClickFreeSession . new ( session ) . clicks ) . to be_empty }
106106 it { response . should be_success }
107107 end
108108
@@ -122,7 +122,7 @@ def index
122122
123123 before { get :index }
124124
125- it { session [ :first_click ] . should be_nil }
125+ it { expect ( FirstClickFreeSession . new ( session ) . clicks ) . to be_empty }
126126 it { response . should be_success }
127127 end
128128end
0 commit comments