warden 1.2.5 → 1.2.8

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