rack-screen-door 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,10 +13,16 @@ semi-private, e.g., during the development stages.
13
13
 
14
14
  ## Usage
15
15
 
16
- require 'rack/screen_door'
16
+ For a Rack-based environment like Sinatra:
17
17
 
18
+ require 'rack/screen_door'
18
19
  use Rack::ScreenDoor 'secret answer'
19
20
 
21
+ For Rails 3.x:
22
+
23
+ require 'rack/screen_door'
24
+ config.middleware.use Rack::ScreenDoor 'secret answer'
25
+
20
26
  Additional options can be supplied:
21
27
 
22
28
  use Rack::ScreenDoor 'secret answer',
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class ScreenDoor
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ module Rack
9
9
  class ScreenDoor
10
10
 
11
11
  DEFAULT_COOKIE_KEY = '_rack_screen_door'
12
- DEFAULT_COOKIE_HASH = { :httponly => true }
12
+ DEFAULT_COOKIE_HASH = { :path => '/', :httponly => true }
13
13
  DEFAULT_EXPIRES = 60 * 60 * 24 * 30 # 1 month
14
14
  DEFAULT_TEMPLATE_PATH = ::File.expand_path('../../../default_template.html.erb', __FILE__)
15
15
  DEFAULT_SALT = 'SaltySalt'
@@ -25,7 +25,7 @@ describe Rack::ScreenDoor do
25
25
 
26
26
  its(:salt) { should == default_salt }
27
27
  its(:cookie_key) { should == default_cookie_key }
28
- its(:cookie_hash) { should == { :httponly => true } }
28
+ its(:cookie_hash) { should == { :path => '/', :httponly => true } }
29
29
  its(:expires) { should == 60 * 60 * 24 * 30 }
30
30
  its(:answer) { should == penguin_answer }
31
31
  its(:hashed_answer) { should == penguin_hash }
@@ -73,17 +73,19 @@ describe Rack::ScreenDoor do
73
73
 
74
74
  end
75
75
 
76
- context 'POST / with correct answer' do
76
+ context 'POST /blah with correct answer' do
77
77
 
78
78
  before do
79
79
  Time.stub(:now) { Time.at(946684800).utc } # 2000-1-1
80
- post '/', :answer => 'penguin', :redirect => 'http://example.org/stuff'
80
+ post '/blah', :answer => 'penguin', :redirect => 'http://example.org/stuff'
81
81
  end
82
82
 
83
83
  it { should be_redirect }
84
84
  specify { headers['Location'].should == 'http://example.org/stuff' }
85
85
  specify { headers['Set-Cookie'].should include("#{default_cookie_key}=#{penguin_hash}") }
86
86
  specify { headers['Set-Cookie'].should include('expires=Mon, 31-Jan-2000 00:00:00 GMT') }
87
+ specify { headers['Set-Cookie'].should include('path=/;') }
88
+ specify { headers['Set-Cookie'].should_not include('path=/blah;') }
87
89
 
88
90
  context 'after following the redirect' do
89
91
  before { follow_redirect! }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-screen-door
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Nishinaga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-11 00:00:00 Z
18
+ date: 2012-01-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement