warden 1.2.3 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/{History.rdoc → CHANGELOG.md} +16 -3
- data/Gemfile +3 -2
- data/Gemfile.lock +40 -0
- data/LICENSE +1 -1
- data/README.md +18 -0
- data/Rakefile +4 -8
- data/lib/warden/config.rb +3 -3
- data/lib/warden/errors.rb +2 -1
- data/lib/warden/hooks.rb +10 -9
- data/lib/warden/manager.rb +23 -10
- data/lib/warden/mixins/common.rb +2 -1
- data/lib/warden/proxy.rb +27 -11
- data/lib/warden/session_serializer.rb +1 -0
- data/lib/warden/strategies/base.rb +14 -8
- data/lib/warden/strategies.rb +1 -0
- data/lib/warden/test/helpers.rb +3 -2
- data/lib/warden/test/mock.rb +69 -0
- data/lib/warden/test/warden_helpers.rb +2 -1
- data/lib/warden/version.rb +2 -1
- data/lib/warden.rb +2 -0
- data/warden.gemspec +21 -18
- metadata +33 -50
- data/README.textile +0 -9
- data/spec/helpers/request_helper.rb +0 -51
- data/spec/helpers/strategies/failz.rb +0 -8
- data/spec/helpers/strategies/invalid.rb +0 -8
- data/spec/helpers/strategies/pass.rb +0 -8
- data/spec/helpers/strategies/pass_with_message.rb +0 -8
- data/spec/helpers/strategies/password.rb +0 -13
- data/spec/helpers/strategies/single.rb +0 -12
- data/spec/spec_helper.rb +0 -24
- data/spec/warden/authenticated_data_store_spec.rb +0 -114
- data/spec/warden/config_spec.rb +0 -48
- data/spec/warden/errors_spec.rb +0 -47
- data/spec/warden/hooks_spec.rb +0 -373
- data/spec/warden/manager_spec.rb +0 -316
- data/spec/warden/proxy_spec.rb +0 -1041
- data/spec/warden/scoped_session_serializer.rb +0 -123
- data/spec/warden/session_serializer_spec.rb +0 -53
- data/spec/warden/strategies/base_spec.rb +0 -313
- data/spec/warden/strategies_spec.rb +0 -93
- data/spec/warden/test/helpers_spec.rb +0 -93
- data/spec/warden/test/test_mode_spec.rb +0 -76
@@ -1,76 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Warden::Test::WardenHelpers do
|
5
|
-
before :all do
|
6
|
-
Warden.test_mode!
|
7
|
-
end
|
8
|
-
|
9
|
-
before do
|
10
|
-
$captures = []
|
11
|
-
@app = lambda{|e| valid_response }
|
12
|
-
end
|
13
|
-
|
14
|
-
after do
|
15
|
-
Warden.test_reset!
|
16
|
-
end
|
17
|
-
|
18
|
-
it{ Warden.should respond_to(:test_mode!) }
|
19
|
-
it{ Warden.should respond_to(:on_next_request) }
|
20
|
-
it{ Warden.should respond_to(:test_reset!) }
|
21
|
-
|
22
|
-
it "should execute the on_next_request block on the next request" do
|
23
|
-
Warden.on_next_request do |warden|
|
24
|
-
$captures << warden
|
25
|
-
end
|
26
|
-
|
27
|
-
setup_rack(@app).call(env_with_params)
|
28
|
-
$captures.should have(1).item
|
29
|
-
$captures.first.should be_an_instance_of(Warden::Proxy)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should execute many on_next_request blocks on the next request" do
|
33
|
-
Warden.on_next_request{|w| $captures << :first }
|
34
|
-
Warden.on_next_request{|w| $captures << :second }
|
35
|
-
setup_rack(@app).call(env_with_params)
|
36
|
-
$captures.should have(2).items
|
37
|
-
$captures.should == [:first, :second]
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should not execute on_next_request blocks on subsequent requests" do
|
41
|
-
app = setup_rack(@app)
|
42
|
-
Warden.on_next_request{|w| $captures << :first }
|
43
|
-
app.call(env_with_params)
|
44
|
-
$captures.should == [:first]
|
45
|
-
$captures.clear
|
46
|
-
app.call(env_with_params)
|
47
|
-
$captures.should be_empty
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should allow me to set new_on_next_request items to execute in the same test" do
|
51
|
-
app = setup_rack(@app)
|
52
|
-
Warden.on_next_request{|w| $captures << :first }
|
53
|
-
app.call(env_with_params)
|
54
|
-
$captures.should == [:first]
|
55
|
-
Warden.on_next_request{|w| $captures << :second }
|
56
|
-
app.call(env_with_params)
|
57
|
-
$captures.should == [:first, :second]
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should remove the on_next_request items when test is reset" do
|
61
|
-
app = setup_rack(@app)
|
62
|
-
Warden.on_next_request{|w| $captures << :first }
|
63
|
-
Warden.test_reset!
|
64
|
-
app.call(env_with_params)
|
65
|
-
$captures.should == []
|
66
|
-
end
|
67
|
-
|
68
|
-
context "asset requests" do
|
69
|
-
it "should not execute on_next_request blocks if this is an asset request" do
|
70
|
-
app = setup_rack(@app)
|
71
|
-
Warden.on_next_request{|w| $captures << :first }
|
72
|
-
app.call(env_with_params("/assets/fun.gif"))
|
73
|
-
$captures.should == []
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|