aker 3.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/CHANGELOG.md +210 -0
  2. data/README.md +282 -0
  3. data/assets/aker/form/login.css +73 -0
  4. data/assets/aker/form/login.html.erb +44 -0
  5. data/lib/aker/authorities/automatic_access.rb +36 -0
  6. data/lib/aker/authorities/composite.rb +301 -0
  7. data/lib/aker/authorities/static.rb +283 -0
  8. data/lib/aker/authorities/support/find_sole_user.rb +24 -0
  9. data/lib/aker/authorities/support.rb +9 -0
  10. data/lib/aker/authorities.rb +46 -0
  11. data/lib/aker/cas/authority.rb +79 -0
  12. data/lib/aker/cas/configuration_helper.rb +85 -0
  13. data/lib/aker/cas/middleware/logout_responder.rb +49 -0
  14. data/lib/aker/cas/middleware/ticket_remover.rb +35 -0
  15. data/lib/aker/cas/middleware.rb +6 -0
  16. data/lib/aker/cas/proxy_mode.rb +108 -0
  17. data/lib/aker/cas/rack_proxy_callback.rb +188 -0
  18. data/lib/aker/cas/service_mode.rb +88 -0
  19. data/lib/aker/cas/service_url.rb +62 -0
  20. data/lib/aker/cas/user_ext.rb +64 -0
  21. data/lib/aker/cas.rb +31 -0
  22. data/lib/aker/central_parameters.rb +101 -0
  23. data/lib/aker/configuration.rb +534 -0
  24. data/lib/aker/deprecation.rb +105 -0
  25. data/lib/aker/form/custom_views_mode.rb +80 -0
  26. data/lib/aker/form/login_form_asset_provider.rb +56 -0
  27. data/lib/aker/form/middleware/custom_view_login_responder.rb +19 -0
  28. data/lib/aker/form/middleware/login_renderer.rb +72 -0
  29. data/lib/aker/form/middleware/login_responder.rb +71 -0
  30. data/lib/aker/form/middleware/logout_responder.rb +26 -0
  31. data/lib/aker/form/middleware.rb +10 -0
  32. data/lib/aker/form/mode.rb +118 -0
  33. data/lib/aker/form.rb +26 -0
  34. data/lib/aker/group.rb +67 -0
  35. data/lib/aker/group_membership.rb +162 -0
  36. data/lib/aker/ldap/authority.rb +392 -0
  37. data/lib/aker/ldap/user_ext.rb +19 -0
  38. data/lib/aker/ldap.rb +22 -0
  39. data/lib/aker/modes/base.rb +85 -0
  40. data/lib/aker/modes/http_basic.rb +100 -0
  41. data/lib/aker/modes/support/attempted_path.rb +22 -0
  42. data/lib/aker/modes/support/rfc_2617.rb +32 -0
  43. data/lib/aker/modes/support.rb +12 -0
  44. data/lib/aker/modes.rb +48 -0
  45. data/lib/aker/rack/authenticate.rb +37 -0
  46. data/lib/aker/rack/configuration_helper.rb +18 -0
  47. data/lib/aker/rack/default_logout_responder.rb +36 -0
  48. data/lib/aker/rack/environment_helper.rb +34 -0
  49. data/lib/aker/rack/facade.rb +102 -0
  50. data/lib/aker/rack/failure.rb +69 -0
  51. data/lib/aker/rack/logout.rb +63 -0
  52. data/lib/aker/rack/request_ext.rb +19 -0
  53. data/lib/aker/rack/session_timer.rb +95 -0
  54. data/lib/aker/rack/setup.rb +77 -0
  55. data/lib/aker/rack.rb +107 -0
  56. data/lib/aker/test/helpers.rb +22 -0
  57. data/lib/aker/test.rb +8 -0
  58. data/lib/aker/user.rb +231 -0
  59. data/lib/aker/version.rb +3 -0
  60. data/lib/aker.rb +51 -0
  61. data/spec/aker/aker-sample.yml +11 -0
  62. data/spec/aker/authorities/automatic_access_spec.rb +52 -0
  63. data/spec/aker/authorities/composite_spec.rb +488 -0
  64. data/spec/aker/authorities/nu-schema.jar +0 -0
  65. data/spec/aker/authorities/static_spec.rb +455 -0
  66. data/spec/aker/authorities/support/find_sole_user_spec.rb +33 -0
  67. data/spec/aker/authorities_spec.rb +16 -0
  68. data/spec/aker/cas/authority_spec.rb +106 -0
  69. data/spec/aker/cas/configuration_helper_spec.rb +92 -0
  70. data/spec/aker/cas/middleware/logout_responder_spec.rb +47 -0
  71. data/spec/aker/cas/middleware/ticket_remover_spec.rb +49 -0
  72. data/spec/aker/cas/proxy_mode_spec.rb +185 -0
  73. data/spec/aker/cas/rack_proxy_callback_spec.rb +190 -0
  74. data/spec/aker/cas/service_mode_spec.rb +122 -0
  75. data/spec/aker/cas/service_url_spec.rb +114 -0
  76. data/spec/aker/cas/user_ext_spec.rb +27 -0
  77. data/spec/aker/cas_spec.rb +19 -0
  78. data/spec/aker/central_parameters_spec.rb +44 -0
  79. data/spec/aker/configuration_spec.rb +465 -0
  80. data/spec/aker/deprecation_spec.rb +115 -0
  81. data/spec/aker/form/a_form_mode.rb +129 -0
  82. data/spec/aker/form/custom_views_mode_spec.rb +34 -0
  83. data/spec/aker/form/login_form_asset_provider_spec.rb +80 -0
  84. data/spec/aker/form/middleware/a_form_login_responder.rb +89 -0
  85. data/spec/aker/form/middleware/custom_view_login_responder_spec.rb +47 -0
  86. data/spec/aker/form/middleware/login_renderer_spec.rb +56 -0
  87. data/spec/aker/form/middleware/login_responder_spec.rb +34 -0
  88. data/spec/aker/form/middleware/logout_responder_spec.rb +55 -0
  89. data/spec/aker/form/mode_spec.rb +15 -0
  90. data/spec/aker/form_spec.rb +11 -0
  91. data/spec/aker/group_membership_spec.rb +208 -0
  92. data/spec/aker/group_spec.rb +66 -0
  93. data/spec/aker/ldap/authority_spec.rb +414 -0
  94. data/spec/aker/ldap/ldap-users.ldif +197 -0
  95. data/spec/aker/ldap_spec.rb +11 -0
  96. data/spec/aker/modes/a_aker_mode.rb +41 -0
  97. data/spec/aker/modes/http_basic_spec.rb +127 -0
  98. data/spec/aker/modes/support/attempted_path_spec.rb +32 -0
  99. data/spec/aker/modes_spec.rb +11 -0
  100. data/spec/aker/rack/authenticate_spec.rb +78 -0
  101. data/spec/aker/rack/default_logout_responder_spec.rb +67 -0
  102. data/spec/aker/rack/facade_spec.rb +154 -0
  103. data/spec/aker/rack/failure_spec.rb +151 -0
  104. data/spec/aker/rack/logout_spec.rb +63 -0
  105. data/spec/aker/rack/request_ext_spec.rb +29 -0
  106. data/spec/aker/rack/session_timer_spec.rb +134 -0
  107. data/spec/aker/rack/setup_spec.rb +87 -0
  108. data/spec/aker/rack_spec.rb +216 -0
  109. data/spec/aker/test/helpers_spec.rb +44 -0
  110. data/spec/aker/user_spec.rb +362 -0
  111. data/spec/aker_spec.rb +80 -0
  112. data/spec/deprecation_helper.rb +58 -0
  113. data/spec/java_helper.rb +5 -0
  114. data/spec/logger_helper.rb +17 -0
  115. data/spec/matchers.rb +31 -0
  116. data/spec/mock_builder.rb +25 -0
  117. data/spec/spec_helper.rb +52 -0
  118. metadata +265 -0
@@ -0,0 +1,129 @@
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
+ require File.expand_path("../../modes/a_aker_mode", __FILE__)
3
+ require "rack"
4
+
5
+ module Aker::Form
6
+ shared_examples 'a form mode' do
7
+ let(:config) { Aker::Configuration.new(:slices => [Aker::Rack::Slice.new]) }
8
+
9
+ before do
10
+ @env = ::Rack::MockRequest.env_for("/")
11
+ @env['aker.configuration'] = config
12
+ @scope = mock
13
+ @mode = Mode.new(@env, @scope)
14
+ end
15
+
16
+ it_should_behave_like "a aker mode"
17
+
18
+ describe "#kind" do
19
+ it "is :user" do
20
+ @mode.kind.should == :user
21
+ end
22
+ end
23
+
24
+ describe "#credentials" do
25
+ it "contains username and password" do
26
+ set_params("username" => "foo", "password" => "bar")
27
+
28
+ @mode.credentials.should == ["foo", "bar"]
29
+ end
30
+
31
+ it "is an empty array if neither username nor password were given" do
32
+ @mode.credentials.should == []
33
+ end
34
+ end
35
+
36
+ describe "#valid?" do
37
+ it "returns true if a username and password are present" do
38
+ set_params("username" => "foo", "password" => "bar")
39
+
40
+ @mode.should be_valid
41
+ end
42
+
43
+ it "returns false if a username or password are missing" do
44
+ @mode.should_not be_valid
45
+ end
46
+ end
47
+
48
+ describe "#authenticate!" do
49
+ before do
50
+ set_params("username" => "foo", "password" => "bar")
51
+
52
+ @authority = mock
53
+ @mode.stub!(:authority => @authority)
54
+ end
55
+
56
+ it "signals success if the username and password are good" do
57
+ user = stub
58
+ @authority.should_receive(:valid_credentials?).with(:user, "foo", "bar").and_return(user)
59
+ @mode.should_receive(:success!).with(user)
60
+
61
+ @mode.authenticate!
62
+ end
63
+
64
+ it "does not signal success if the username or password are bad" do
65
+ @authority.stub!(:valid_credentials? => nil)
66
+ @mode.should_not_receive(:success!)
67
+
68
+ @mode.authenticate!
69
+ end
70
+ end
71
+
72
+ describe "#login_url" do
73
+ it "uses '/login' as its path" do
74
+ URI.parse(@mode.login_url).path.should == "/login"
75
+ end
76
+
77
+ it "respects SCRIPT_NAME" do
78
+ @env["SCRIPT_NAME"] = "/app"
79
+
80
+ URI.parse(@mode.login_url).path.should == "/app/login"
81
+ end
82
+
83
+ it 'uses another path if one is specified in the configuration' do
84
+ @env['SCRIPT_NAME'] = '/banjo'
85
+ config.parameters_for(:rack)[:login_path] = '/auth/login'
86
+
87
+ URI.parse(@mode.login_url).path.should == "/banjo/auth/login"
88
+ end
89
+ end
90
+
91
+ describe "#on_ui_failure" do
92
+ include Rack::Utils
93
+
94
+ it "redirects to the login form" do
95
+ response = @mode.on_ui_failure
96
+
97
+ response.should be_redirect
98
+ URI.parse(response.location).path.should == "/login"
99
+ end
100
+
101
+ it 'redirects to a different login form path if specified in the configuration' do
102
+ config.parameters_for(:rack)[:login_path] = '/auth/login'
103
+ response = @mode.on_ui_failure
104
+
105
+ URI.parse(response.location).path.should == '/auth/login'
106
+ end
107
+
108
+ it "puts the URL the user was trying to reach in the query string" do
109
+ @env["warden.options"] = { :attempted_path => "http://www.example.edu" }
110
+
111
+ response = @mode.on_ui_failure
112
+
113
+ URI.parse(response.location).query.should == "url=" + escape("http://www.example.edu")
114
+ end
115
+
116
+ it 'puts the session expiration parameter in the URL if the has to log in due to session expiration' do
117
+ @env['aker.session_expired'] = true
118
+
119
+ response = @mode.on_ui_failure
120
+
121
+ URI.parse(response.location).query.should == "url=&session_expired=true"
122
+ end
123
+ end
124
+
125
+ def set_params(params)
126
+ @env.update(::Rack::MockRequest.env_for("/", :params => params))
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
+ require File.expand_path("../a_form_mode", __FILE__)
3
+ require "rack"
4
+
5
+ module Aker::Form
6
+ describe CustomViewsMode do
7
+ it_should_behave_like "a form mode"
8
+
9
+ describe "#key" do
10
+ it "is :custom_form" do
11
+ CustomViewsMode.key.should == :custom_form
12
+ end
13
+ end
14
+
15
+ describe "middleware" do
16
+ let(:builder) { Aker::Spec::MockBuilder.new }
17
+
18
+ it "prepends nothing" do
19
+ CustomViewsMode.prepend_middleware(builder)
20
+ builder.uses.should be_empty
21
+ end
22
+
23
+ it 'appends only one piece of middleware' do
24
+ CustomViewsMode.append_middleware(builder)
25
+ builder.should have(1).uses
26
+ end
27
+
28
+ it "appends its own login responder" do
29
+ CustomViewsMode.append_middleware(builder)
30
+ builder.should be_using(Middleware::CustomViewLoginResponder)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,80 @@
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
+ require 'nokogiri'
3
+
4
+ module Aker::Form
5
+ describe LoginFormAssetProvider do
6
+ let(:vessel) do
7
+ Object.new.tap { |o| o.extend(LoginFormAssetProvider) }
8
+ end
9
+
10
+ let(:configuration) do
11
+ Aker::Configuration.new do
12
+ rack_parameters :login_path => '/auth/login'
13
+ end
14
+ end
15
+
16
+ describe "#login_html" do
17
+ let(:env) { { 'SCRIPT_NAME' => '/foo', 'aker.configuration' => configuration } }
18
+
19
+ before do
20
+ @doc = Nokogiri.HTML(vessel.login_html(env))
21
+ end
22
+
23
+ it "includes SCRIPT_NAME in the postback URL" do
24
+ (@doc/'form').first.attributes["action"].value.should == "/foo/auth/login"
25
+ end
26
+
27
+ it "includes SCRIPT_NAME in the CSS URL" do
28
+ (@doc/'link[rel="stylesheet"]').first.attributes["href"].value.should == "/foo/auth/login/login.css"
29
+ end
30
+
31
+ it "can render a 'login failed' message" do
32
+ @doc = Nokogiri.HTML(vessel.login_html(env, { :login_failed => true }))
33
+
34
+ (@doc/'.error').first.inner_html.should == 'Login failed'
35
+ end
36
+
37
+ it "can render a 'logged out' message" do
38
+ @doc = Nokogiri.HTML(vessel.login_html(env, { :logged_out => true }))
39
+
40
+ (@doc/'h1').first.inner_html.should == 'Logged out'
41
+ end
42
+
43
+ it "can render a 'session expired' message" do
44
+ @doc = Nokogiri.HTML(vessel.login_html(env, { :session_expired => true }))
45
+
46
+ (@doc/'.error').first.inner_html.should == 'Session expired'
47
+ end
48
+
49
+ it "can render text in the username text field" do
50
+ @doc = Nokogiri.HTML(vessel.login_html(env, { :username => "user" }))
51
+
52
+ (@doc/'input[name="username"]').first['value'].should == 'user'
53
+ end
54
+
55
+ it "can store a URL to go to after login succeeds" do
56
+ @doc = Nokogiri.HTML(vessel.login_html(env, { :url => 'http://www.example.edu' }))
57
+
58
+ (@doc/'input[name="url"]').first['value'].should == 'http://www.example.edu'
59
+ end
60
+
61
+ it "escapes HTML in usernames" do
62
+ html = vessel.login_html(env, { :username => "user<a/>" })
63
+
64
+ # Annoyingly, Nokogiri.HTML automatically unescapes escaped entities in
65
+ # attribute values.
66
+ html.should include("user&lt;a&#x2F;&gt;");
67
+ html.should_not include("user<a/>")
68
+ end
69
+ end
70
+
71
+ describe "#login_css" do
72
+ it "provides CSS for the login form" do
73
+ expected_css = File.read(File.join(File.dirname(__FILE__),
74
+ %w(.. .. .. assets aker form login.css)))
75
+
76
+ vessel.login_css.should == expected_css
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,89 @@
1
+ require File.expand_path('../../../../spec_helper.rb', __FILE__)
2
+
3
+ shared_context 'login responder context' do
4
+ include Rack::Test::Methods
5
+
6
+ let(:app) do
7
+ mw = responder_middleware_class
8
+ capture = captured_env
9
+ Rack::Builder.new do
10
+ use mw
11
+
12
+ app = lambda do |env|
13
+ capture << env
14
+ [200, {"Content-Type" => "text/html"}, ["Hello"]]
15
+ end
16
+
17
+ run app
18
+ end
19
+ end
20
+
21
+ let(:login_path) { '/auth/login' }
22
+
23
+ let(:configuration) do
24
+ path = login_path;
25
+ Aker::Configuration.new { rack_parameters :login_path => path }
26
+ end
27
+
28
+ let(:env) do
29
+ { 'aker.configuration' => configuration }
30
+ end
31
+
32
+ let(:captured_env) { [] }
33
+ end
34
+
35
+ shared_examples 'a form login responder' do
36
+ include_context 'login responder context'
37
+
38
+ it "does not intercept GETs to the login path" do
39
+ get login_path, {}, env
40
+
41
+ last_response.should be_ok
42
+ last_response.body.should == "Hello"
43
+ end
44
+
45
+ it "does not intercept POSTs to paths that are not the login path" do
46
+ post "/foo", {}, env
47
+
48
+ last_response.should be_ok
49
+ last_response.body.should == "Hello"
50
+ end
51
+
52
+ describe "#call" do
53
+ let(:warden) { mock }
54
+
55
+ before do
56
+ env.update("warden" => warden, "REQUEST_METHOD" => "POST")
57
+ end
58
+
59
+ describe "when authentication succeeded" do
60
+ it "redirects to a given URL" do
61
+ warden.should_receive(:authenticated?).and_return(true)
62
+
63
+ post login_path, { :url => "/protected" }, env
64
+
65
+ last_response.should be_redirect
66
+ last_response.location.should == "/protected"
67
+ end
68
+
69
+ it "redirects to the application's root if no URL was given" do
70
+ warden.should_receive(:authenticated?).and_return(true)
71
+ env['SCRIPT_NAME'] = "/foo"
72
+
73
+ post login_path, {}, env
74
+
75
+ last_response.should be_redirect
76
+ last_response.location.should == "/foo/"
77
+ end
78
+
79
+ it "redirects to the application's root if the URL given is a blank string" do
80
+ warden.should_receive(:authenticated?).and_return(true)
81
+
82
+ post login_path, { :url => "" }, env
83
+
84
+ last_response.should be_redirect
85
+ last_response.location.should == "/"
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,47 @@
1
+ require File.expand_path("../../../../spec_helper", __FILE__)
2
+ require File.expand_path('../a_form_login_responder', __FILE__)
3
+ require "rack/test"
4
+
5
+ module Aker::Form::Middleware
6
+ describe CustomViewLoginResponder do
7
+ let(:responder_middleware_class) { Aker::Form::Middleware::CustomViewLoginResponder }
8
+
9
+ it_behaves_like 'a form login responder'
10
+
11
+ include_context 'login responder context'
12
+
13
+ describe "#call" do
14
+ let(:warden) { mock }
15
+
16
+ before do
17
+ env.update("warden" => warden, "REQUEST_METHOD" => "POST")
18
+ end
19
+
20
+ describe "when authentication failed" do
21
+ before do
22
+ warden.stub(:authenticated? => false, :custom_failure! => nil)
23
+
24
+ post login_path,
25
+ {'username' => 'jo', 'password' => 'wrong'},
26
+ env
27
+ end
28
+
29
+ def recorded_env
30
+ captured_env.first
31
+ end
32
+
33
+ it "adds the login failed flag to the environment" do
34
+ recorded_env['aker.form.login_failed'].should == true
35
+ end
36
+
37
+ it "adds the attempted username to the environment" do
38
+ recorded_env['aker.form.username'].should == 'jo'
39
+ end
40
+
41
+ it 'calls the app' do
42
+ last_response.body.should == "Hello"
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,56 @@
1
+ require File.expand_path("../../../../spec_helper", __FILE__)
2
+ require "rack/test"
3
+
4
+ module Aker::Form::Middleware
5
+ describe LoginRenderer do
6
+ include Rack::Test::Methods
7
+
8
+ let(:app) do
9
+ Rack::Builder.new do
10
+ use Aker::Form::Middleware::LoginRenderer
11
+ run lambda { |env| [200, {"Content-Type" => "text/html"}, ["Hello"]] }
12
+ end
13
+ end
14
+
15
+ let(:env) do
16
+ { 'aker.configuration' => configuration }
17
+ end
18
+
19
+ let(:configuration) do
20
+ path = login_path
21
+ Aker::Configuration.new {
22
+ rack_parameters :login_path => path
23
+ }
24
+ end
25
+
26
+ let(:login_path) { '/log-in-here' }
27
+
28
+ it "does not intercept POSTs to the login path" do
29
+ post login_path, {}, env
30
+
31
+ last_response.should be_ok
32
+ last_response.body.should == "Hello"
33
+ end
34
+
35
+ it "does not intercept GETs to paths that are not the login path" do
36
+ get "/foo", {}, env
37
+
38
+ last_response.should be_ok
39
+ last_response.body.should == "Hello"
40
+ end
41
+
42
+ it "renders login forms for GETs on the login path" do
43
+ get login_path, {}, env
44
+
45
+ last_response.should be_ok
46
+ last_response.content_type.should == "text/html"
47
+ end
48
+
49
+ it "outputs CSS for GETs on (the login path) + .css" do
50
+ get "/log-in-here/login.css", {}, env
51
+
52
+ last_response.should be_ok
53
+ last_response.content_type.should == "text/css"
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path("../../../../spec_helper", __FILE__)
2
+ require File.expand_path('../a_form_login_responder', __FILE__)
3
+ require "rack/test"
4
+
5
+ module Aker::Form::Middleware
6
+ describe LoginResponder do
7
+ let(:responder_middleware_class) { Aker::Form::Middleware::LoginResponder }
8
+
9
+ it_behaves_like 'a form login responder'
10
+
11
+ include_context 'login responder context'
12
+
13
+ describe "#call" do
14
+ let(:warden) { mock }
15
+
16
+ before do
17
+ env.update("warden" => warden, "REQUEST_METHOD" => "POST")
18
+ end
19
+
20
+ describe "when authentication failed" do
21
+ before do
22
+ warden.stub(:authenticated? => false, :custom_failure! => nil)
23
+ end
24
+
25
+ it "renders a 'login failed' message" do
26
+ post login_path, {}, env
27
+
28
+ last_response.status.should == 401
29
+ last_response.body.should include("Login failed")
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,55 @@
1
+ require File.expand_path("../../../../spec_helper", __FILE__)
2
+ require "rack/test"
3
+
4
+ module Aker::Form::Middleware
5
+ describe LogoutResponder do
6
+ include Rack::Test::Methods
7
+
8
+ let(:app) do
9
+ Rack::Builder.new do
10
+ use Aker::Form::Middleware::LogoutResponder
11
+
12
+ app = lambda do |env|
13
+ if env["REQUEST_METHOD"] == "GET" && env["PATH_INFO"] == "/this/logout"
14
+ [200, {"Content-Type" => "text/plain"}, ["Logged out"]]
15
+ else
16
+ [404, {"Content-Type" => "text/plain"}, []]
17
+ end
18
+ end
19
+
20
+ run app
21
+ end
22
+ end
23
+
24
+ let(:configuration) {
25
+ Aker::Configuration.new do
26
+ rack_parameters :logout_path => '/this/logout'
27
+ end
28
+ }
29
+
30
+ let(:env) do
31
+ { 'aker.configuration' => configuration }
32
+ end
33
+
34
+ describe '#call' do
35
+ it "responds to GET {configured logout path}" do
36
+ get "/this/logout", {}, env
37
+
38
+ last_response.should be_ok
39
+ last_response.content_type.should == "text/html"
40
+ end
41
+
42
+ it 'does not respond on other paths' do
43
+ get "/", {}, env
44
+
45
+ last_response.status.should == 404
46
+ end
47
+
48
+ it 'does not respond on other methods' do
49
+ post "/this/logout", {}, env
50
+
51
+ last_response.status.should == 404
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
+ require File.expand_path("../a_form_mode", __FILE__)
3
+ require "rack"
4
+
5
+ module Aker::Form
6
+ describe Mode do
7
+ it_should_behave_like "a form mode"
8
+
9
+ describe "#key" do
10
+ it "is :form" do
11
+ Mode.key.should == :form
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Aker
4
+ describe Form::Slice do
5
+ let(:configuration) { Configuration.new(:slices => [Form::Slice.new]) }
6
+
7
+ it 'registers the cas proxy mode' do
8
+ configuration.registered_modes.should include(Aker::Form::Mode)
9
+ end
10
+ end
11
+ end