warden 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/lib/warden/config.rb +2 -3
- data/lib/warden/hooks.rb +9 -9
- data/lib/warden/manager.rb +21 -9
- data/lib/warden/mixins/common.rb +1 -1
- data/lib/warden/proxy.rb +12 -8
- data/lib/warden/strategies/base.rb +12 -7
- data/lib/warden/test/helpers.rb +1 -1
- data/lib/warden/test/warden_helpers.rb +1 -1
- data/lib/warden/version.rb +1 -1
- data/spec/helpers/strategies/fail_with_user.rb +10 -0
- data/spec/helpers/strategies/invalid.rb +1 -1
- data/spec/warden/authenticated_data_store_spec.rb +20 -20
- data/spec/warden/config_spec.rb +10 -10
- data/spec/warden/errors_spec.rb +7 -7
- data/spec/warden/hooks_spec.rb +40 -40
- data/spec/warden/manager_spec.rb +81 -57
- data/spec/warden/proxy_spec.rb +177 -168
- data/spec/warden/scoped_session_serializer.rb +9 -9
- data/spec/warden/session_serializer_spec.rb +13 -13
- data/spec/warden/strategies/base_spec.rb +37 -37
- data/spec/warden/strategies_spec.rb +14 -13
- data/spec/warden/test/helpers_spec.rb +23 -23
- data/spec/warden/test/test_mode_spec.rb +12 -13
- metadata +19 -23
@@ -10,12 +10,12 @@ describe Warden::Test::Helpers do
|
|
10
10
|
login_as user
|
11
11
|
app = lambda{|e|
|
12
12
|
$captures << :run
|
13
|
-
e['warden'].
|
14
|
-
e['warden'].user.
|
13
|
+
expect(e['warden']).to be_authenticated
|
14
|
+
expect(e['warden'].user).to eq("A User")
|
15
15
|
valid_response
|
16
16
|
}
|
17
17
|
setup_rack(app).call(env_with_params)
|
18
|
-
$captures.
|
18
|
+
expect($captures).to eq([:run])
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should log me in as a user of a given scope" do
|
@@ -24,11 +24,11 @@ describe Warden::Test::Helpers do
|
|
24
24
|
app = lambda{|e|
|
25
25
|
$captures << :run
|
26
26
|
w = e['warden']
|
27
|
-
w.
|
28
|
-
w.user(:foo_scope).
|
27
|
+
expect(w).to be_authenticated(:foo_scope)
|
28
|
+
expect(w.user(:foo_scope)).to eq(some: "user")
|
29
29
|
}
|
30
30
|
setup_rack(app).call(env_with_params)
|
31
|
-
$captures.
|
31
|
+
expect($captures).to eq([:run])
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should login multiple users with different scopes" do
|
@@ -39,13 +39,13 @@ describe Warden::Test::Helpers do
|
|
39
39
|
app = lambda{|e|
|
40
40
|
$captures << :run
|
41
41
|
w = e['warden']
|
42
|
-
w.user.
|
43
|
-
w.user(:foo).
|
44
|
-
w.
|
45
|
-
w.
|
42
|
+
expect(w.user).to eq("A user")
|
43
|
+
expect(w.user(:foo)).to eq("A foo user")
|
44
|
+
expect(w).to be_authenticated
|
45
|
+
expect(w).to be_authenticated(:foo)
|
46
46
|
}
|
47
47
|
setup_rack(app).call(env_with_params)
|
48
|
-
$captures.
|
48
|
+
expect($captures).to eq([:run])
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should log out all users" do
|
@@ -56,16 +56,16 @@ describe Warden::Test::Helpers do
|
|
56
56
|
app = lambda{|e|
|
57
57
|
$captures << :run
|
58
58
|
w = e['warden']
|
59
|
-
w.user.
|
60
|
-
w.user(:foo).
|
59
|
+
expect(w.user).to eq("A user")
|
60
|
+
expect(w.user(:foo)).to eq("Foo")
|
61
61
|
w.logout
|
62
|
-
w.user.
|
63
|
-
w.user(:foo).
|
64
|
-
w.
|
65
|
-
w.
|
62
|
+
expect(w.user).to be_nil
|
63
|
+
expect(w.user(:foo)).to be_nil
|
64
|
+
expect(w).not_to be_authenticated
|
65
|
+
expect(w).not_to be_authenticated(:foo)
|
66
66
|
}
|
67
67
|
setup_rack(app).call(env_with_params)
|
68
|
-
$captures.
|
68
|
+
expect($captures).to eq([:run])
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should logout a specific user" do
|
@@ -77,17 +77,17 @@ describe Warden::Test::Helpers do
|
|
77
77
|
$captures << :run
|
78
78
|
w = e['warden']
|
79
79
|
w.logout :foo
|
80
|
-
w.user.
|
81
|
-
w.user(:foo).
|
82
|
-
w.
|
80
|
+
expect(w.user).to eq("A User")
|
81
|
+
expect(w.user(:foo)).to be_nil
|
82
|
+
expect(w).not_to be_authenticated(:foo)
|
83
83
|
}
|
84
84
|
setup_rack(app).call(env_with_params)
|
85
|
-
$captures.
|
85
|
+
expect($captures).to eq([:run])
|
86
86
|
end
|
87
87
|
|
88
88
|
describe "#asset_paths" do
|
89
89
|
it "should default asset_paths to anything asset path regex" do
|
90
|
-
Warden.asset_paths.
|
90
|
+
expect(Warden.asset_paths).to eq([/^\/assets\//] )
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -15,9 +15,9 @@ describe Warden::Test::WardenHelpers do
|
|
15
15
|
Warden.test_reset!
|
16
16
|
end
|
17
17
|
|
18
|
-
it{ Warden.
|
19
|
-
it{ Warden.
|
20
|
-
it{ Warden.
|
18
|
+
it{ expect(Warden).to respond_to(:test_mode!) }
|
19
|
+
it{ expect(Warden).to respond_to(:on_next_request) }
|
20
|
+
it{ expect(Warden).to respond_to(:test_reset!) }
|
21
21
|
|
22
22
|
it "should execute the on_next_request block on the next request" do
|
23
23
|
Warden.on_next_request do |warden|
|
@@ -25,36 +25,35 @@ describe Warden::Test::WardenHelpers do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
setup_rack(@app).call(env_with_params)
|
28
|
-
$captures.
|
29
|
-
$captures.first.
|
28
|
+
expect($captures.length).to eq(1)
|
29
|
+
expect($captures.first).to be_an_instance_of(Warden::Proxy)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should execute many on_next_request blocks on the next request" do
|
33
33
|
Warden.on_next_request{|w| $captures << :first }
|
34
34
|
Warden.on_next_request{|w| $captures << :second }
|
35
35
|
setup_rack(@app).call(env_with_params)
|
36
|
-
$captures.
|
37
|
-
$captures.should == [:first, :second]
|
36
|
+
expect($captures).to eq([:first, :second])
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should not execute on_next_request blocks on subsequent requests" do
|
41
40
|
app = setup_rack(@app)
|
42
41
|
Warden.on_next_request{|w| $captures << :first }
|
43
42
|
app.call(env_with_params)
|
44
|
-
$captures.
|
43
|
+
expect($captures).to eq([:first])
|
45
44
|
$captures.clear
|
46
45
|
app.call(env_with_params)
|
47
|
-
$captures.
|
46
|
+
expect($captures).to be_empty
|
48
47
|
end
|
49
48
|
|
50
49
|
it "should allow me to set new_on_next_request items to execute in the same test" do
|
51
50
|
app = setup_rack(@app)
|
52
51
|
Warden.on_next_request{|w| $captures << :first }
|
53
52
|
app.call(env_with_params)
|
54
|
-
$captures.
|
53
|
+
expect($captures).to eq([:first])
|
55
54
|
Warden.on_next_request{|w| $captures << :second }
|
56
55
|
app.call(env_with_params)
|
57
|
-
$captures.
|
56
|
+
expect($captures).to eq([:first, :second])
|
58
57
|
end
|
59
58
|
|
60
59
|
it "should remove the on_next_request items when test is reset" do
|
@@ -62,7 +61,7 @@ describe Warden::Test::WardenHelpers do
|
|
62
61
|
Warden.on_next_request{|w| $captures << :first }
|
63
62
|
Warden.test_reset!
|
64
63
|
app.call(env_with_params)
|
65
|
-
$captures.
|
64
|
+
expect($captures).to eq([])
|
66
65
|
end
|
67
66
|
|
68
67
|
context "asset requests" do
|
@@ -70,7 +69,7 @@ describe Warden::Test::WardenHelpers do
|
|
70
69
|
app = setup_rack(@app)
|
71
70
|
Warden.on_next_request{|w| $captures << :first }
|
72
71
|
app.call(env_with_params("/assets/fun.gif"))
|
73
|
-
$captures.
|
72
|
+
expect($captures).to eq([])
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
metadata
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.2.3
|
4
|
+
version: 1.2.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel Neighman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
|
-
none: false
|
21
|
-
name: rack
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
|
-
- -
|
24
|
+
- - ">="
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '1.0'
|
29
|
-
none: false
|
30
27
|
description:
|
31
28
|
email: has.sox@gmail.com
|
32
29
|
executables: []
|
@@ -37,6 +34,10 @@ extra_rdoc_files:
|
|
37
34
|
files:
|
38
35
|
- Gemfile
|
39
36
|
- History.rdoc
|
37
|
+
- LICENSE
|
38
|
+
- README.textile
|
39
|
+
- Rakefile
|
40
|
+
- lib/warden.rb
|
40
41
|
- lib/warden/config.rb
|
41
42
|
- lib/warden/errors.rb
|
42
43
|
- lib/warden/hooks.rb
|
@@ -44,16 +45,13 @@ files:
|
|
44
45
|
- lib/warden/mixins/common.rb
|
45
46
|
- lib/warden/proxy.rb
|
46
47
|
- lib/warden/session_serializer.rb
|
47
|
-
- lib/warden/strategies/base.rb
|
48
48
|
- lib/warden/strategies.rb
|
49
|
+
- lib/warden/strategies/base.rb
|
49
50
|
- lib/warden/test/helpers.rb
|
50
51
|
- lib/warden/test/warden_helpers.rb
|
51
52
|
- lib/warden/version.rb
|
52
|
-
- lib/warden.rb
|
53
|
-
- LICENSE
|
54
|
-
- Rakefile
|
55
|
-
- README.textile
|
56
53
|
- spec/helpers/request_helper.rb
|
54
|
+
- spec/helpers/strategies/fail_with_user.rb
|
57
55
|
- spec/helpers/strategies/failz.rb
|
58
56
|
- spec/helpers/strategies/invalid.rb
|
59
57
|
- spec/helpers/strategies/pass.rb
|
@@ -77,28 +75,26 @@ files:
|
|
77
75
|
homepage: http://github.com/hassox/warden
|
78
76
|
licenses:
|
79
77
|
- MIT
|
78
|
+
metadata: {}
|
80
79
|
post_install_message:
|
81
80
|
rdoc_options:
|
82
|
-
- --charset=UTF-8
|
81
|
+
- "--charset=UTF-8"
|
83
82
|
require_paths:
|
84
83
|
- lib
|
85
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
85
|
requirements:
|
87
|
-
- -
|
86
|
+
- - ">="
|
88
87
|
- !ruby/object:Gem::Version
|
89
88
|
version: '0'
|
90
|
-
none: false
|
91
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
90
|
requirements:
|
93
|
-
- -
|
91
|
+
- - ">="
|
94
92
|
- !ruby/object:Gem::Version
|
95
93
|
version: '0'
|
96
|
-
none: false
|
97
94
|
requirements: []
|
98
95
|
rubyforge_project: warden
|
99
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.4.5.1
|
100
97
|
signing_key:
|
101
|
-
specification_version:
|
98
|
+
specification_version: 4
|
102
99
|
summary: Rack middleware that provides authentication for rack applications
|
103
100
|
test_files: []
|
104
|
-
has_rdoc:
|