spec/spec/rails/example/cookies_proxy_spec.rb in dchelimsky-rspec-rails-1.1.12 vs spec/spec/rails/example/cookies_proxy_spec.rb in dchelimsky-rspec-rails-1.1.99.1

- old
+ new

@@ -14,75 +14,71 @@ controller_name :cookies_proxy_examples describe "with a String key" do it "should accept a String value" do - cookies = CookiesProxy.new(self) - cookies['key'] = 'value' + proxy = CookiesProxy.new(self) + proxy['key'] = 'value' get :index if ::Rails::VERSION::STRING >= "2.3" - cookies['key'].should == 'value' + proxy['key'].should == 'value' else - cookies['key'].should == ['value'] + proxy['key'].should == ['value'] end end - if ::Rails::VERSION::STRING >= "2.0.0" - it "should accept a Hash value" do - cookies = CookiesProxy.new(self) - cookies['key'] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' } - get :index - if ::Rails::VERSION::STRING >= "2.3" - cookies['key'].should == 'value' - else - cookies['key'].should == ['value'] - cookies['key'].value.should == ['value'] - cookies['key'].expires.should == expiration - cookies['key'].path.should == path - end + it "should accept a Hash value" do + proxy = CookiesProxy.new(self) + proxy['key'] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' } + get :index + if ::Rails::VERSION::STRING >= "2.3" + proxy['key'].should == 'value' + else + proxy['key'].should == ['value'] + proxy['key'].value.should == ['value'] + proxy['key'].expires.should == expiration + proxy['key'].path.should == path end end end describe "with a Symbol key" do it "should accept a String value" do - example_cookies = CookiesProxy.new(self) - example_cookies[:key] = 'value' + proxy = CookiesProxy.new(self) + proxy[:key] = 'value' get :index if ::Rails::VERSION::STRING >= "2.3" - example_cookies[:key].should == 'value' + proxy[:key].should == 'value' else - example_cookies[:key].should == ['value'] + proxy[:key].should == ['value'] end end - if ::Rails::VERSION::STRING >= "2.0.0" - it "should accept a Hash value" do - example_cookies = CookiesProxy.new(self) - example_cookies[:key] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' } - get :index - if ::Rails::VERSION::STRING >= "2.3" - example_cookies[:key].should == 'value' - else - example_cookies[:key].should == ['value'] - example_cookies[:key].value.should == ['value'] - example_cookies[:key].expires.should == expiration - example_cookies[:key].path.should == path - end + it "should accept a Hash value" do + proxy = CookiesProxy.new(self) + proxy[:key] = { :value => 'value', :expires => expiration = 1.hour.from_now, :path => path = '/path' } + get :index + if ::Rails::VERSION::STRING >= "2.3" + proxy[:key].should == 'value' + else + proxy[:key].should == ['value'] + proxy[:key].value.should == ['value'] + proxy[:key].expires.should == expiration + proxy[:key].path.should == path end end end describe "#delete" do it "should delete from the response cookies" do - example_cookies = CookiesProxy.new(self) + proxy = CookiesProxy.new(self) response_cookies = mock('cookies') response.should_receive(:cookies).and_return(response_cookies) response_cookies.should_receive(:delete).with('key') - example_cookies.delete :key + proxy.delete :key end end end end