warden 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +27 -0
- data/.gitignore +6 -0
- data/.rspec +3 -0
- data/{History.rdoc → CHANGELOG.md} +74 -39
- data/Gemfile +2 -2
- data/LICENSE +2 -1
- data/README.md +18 -0
- data/Rakefile +3 -8
- data/lib/warden/config.rb +1 -1
- data/lib/warden/errors.rb +2 -2
- data/lib/warden/hooks.rb +1 -1
- data/lib/warden/manager.rb +2 -2
- data/lib/warden/mixins/common.rb +1 -1
- data/lib/warden/proxy.rb +24 -5
- data/lib/warden/session_serializer.rb +1 -1
- data/lib/warden/strategies/base.rb +2 -1
- data/lib/warden/test/helpers.rb +2 -2
- data/lib/warden/test/mock.rb +5 -5
- data/lib/warden/test/warden_helpers.rb +1 -1
- data/lib/warden/version.rb +2 -2
- data/lib/warden.rb +1 -1
- data/warden.gemspec +18 -18
- metadata +18 -36
- data/README.textile +0 -9
- data/spec/helpers/request_helper.rb +0 -52
- data/spec/helpers/strategies/fail_with_user.rb +0 -11
- data/spec/helpers/strategies/failz.rb +0 -9
- data/spec/helpers/strategies/invalid.rb +0 -9
- data/spec/helpers/strategies/pass.rb +0 -9
- data/spec/helpers/strategies/pass_with_message.rb +0 -9
- data/spec/helpers/strategies/password.rb +0 -14
- data/spec/helpers/strategies/single.rb +0 -13
- data/spec/spec_helper.rb +0 -26
- data/spec/warden/authenticated_data_store_spec.rb +0 -115
- data/spec/warden/config_spec.rb +0 -49
- data/spec/warden/errors_spec.rb +0 -48
- data/spec/warden/hooks_spec.rb +0 -374
- data/spec/warden/manager_spec.rb +0 -341
- data/spec/warden/proxy_spec.rb +0 -1051
- data/spec/warden/scoped_session_serializer.rb +0 -124
- data/spec/warden/session_serializer_spec.rb +0 -54
- data/spec/warden/strategies/base_spec.rb +0 -314
- data/spec/warden/strategies_spec.rb +0 -95
- data/spec/warden/test/helpers_spec.rb +0 -94
- data/spec/warden/test/mock_spec.rb +0 -16
- data/spec/warden/test/test_mode_spec.rb +0 -76
@@ -1,76 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Warden::Test::WardenHelpers do
|
6
|
-
before :all do
|
7
|
-
Warden.test_mode!
|
8
|
-
end
|
9
|
-
|
10
|
-
before do
|
11
|
-
$captures = []
|
12
|
-
@app = lambda{|e| valid_response }
|
13
|
-
end
|
14
|
-
|
15
|
-
after do
|
16
|
-
Warden.test_reset!
|
17
|
-
end
|
18
|
-
|
19
|
-
it{ expect(Warden).to respond_to(:test_mode!) }
|
20
|
-
it{ expect(Warden).to respond_to(:on_next_request) }
|
21
|
-
it{ expect(Warden).to respond_to(:test_reset!) }
|
22
|
-
|
23
|
-
it "should execute the on_next_request block on the next request" do
|
24
|
-
Warden.on_next_request do |warden|
|
25
|
-
$captures << warden
|
26
|
-
end
|
27
|
-
|
28
|
-
setup_rack(@app).call(env_with_params)
|
29
|
-
expect($captures.length).to eq(1)
|
30
|
-
expect($captures.first).to be_an_instance_of(Warden::Proxy)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should execute many on_next_request blocks on the next request" do
|
34
|
-
Warden.on_next_request{|w| $captures << :first }
|
35
|
-
Warden.on_next_request{|w| $captures << :second }
|
36
|
-
setup_rack(@app).call(env_with_params)
|
37
|
-
expect($captures).to eq([: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
|
-
expect($captures).to eq([:first])
|
45
|
-
$captures.clear
|
46
|
-
app.call(env_with_params)
|
47
|
-
expect($captures).to 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
|
-
expect($captures).to eq([:first])
|
55
|
-
Warden.on_next_request{|w| $captures << :second }
|
56
|
-
app.call(env_with_params)
|
57
|
-
expect($captures).to eq([: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
|
-
expect($captures).to eq([])
|
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
|
-
expect($captures).to eq([])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|