merb-core 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/LICENSE +1 -1
  2. data/README +3 -3
  3. data/Rakefile +144 -33
  4. data/bin/merb +0 -0
  5. data/bin/merb-specs +0 -0
  6. data/docs/bootloading.dox +1 -0
  7. data/docs/merb-core-call-stack-diagram.mmap +0 -0
  8. data/docs/merb-core-call-stack-diagram.pdf +0 -0
  9. data/docs/merb-core-call-stack-diagram.png +0 -0
  10. data/lib/merb-core.rb +159 -37
  11. data/lib/merb-core/autoload.rb +1 -0
  12. data/lib/merb-core/bootloader.rb +208 -92
  13. data/lib/merb-core/config.rb +20 -6
  14. data/lib/merb-core/controller/abstract_controller.rb +113 -61
  15. data/lib/merb-core/controller/exceptions.rb +28 -13
  16. data/lib/merb-core/controller/merb_controller.rb +73 -44
  17. data/lib/merb-core/controller/mime.rb +25 -7
  18. data/lib/merb-core/controller/mixins/authentication.rb +1 -1
  19. data/lib/merb-core/controller/mixins/controller.rb +44 -8
  20. data/lib/merb-core/controller/mixins/render.rb +191 -128
  21. data/lib/merb-core/controller/mixins/responder.rb +65 -63
  22. data/lib/merb-core/controller/template.rb +103 -54
  23. data/lib/merb-core/core_ext.rb +7 -12
  24. data/lib/merb-core/core_ext/kernel.rb +128 -136
  25. data/lib/merb-core/dispatch/cookies.rb +26 -4
  26. data/lib/merb-core/dispatch/default_exception/default_exception.rb +93 -0
  27. data/lib/merb-core/dispatch/default_exception/views/_css.html.erb +198 -0
  28. data/lib/merb-core/dispatch/default_exception/views/_javascript.html.erb +73 -0
  29. data/lib/merb-core/dispatch/default_exception/views/index.html.erb +92 -0
  30. data/lib/merb-core/dispatch/dispatcher.rb +156 -224
  31. data/lib/merb-core/dispatch/request.rb +126 -25
  32. data/lib/merb-core/dispatch/router.rb +61 -6
  33. data/lib/merb-core/dispatch/router/behavior.rb +122 -41
  34. data/lib/merb-core/dispatch/router/route.rb +147 -22
  35. data/lib/merb-core/dispatch/session.rb +52 -2
  36. data/lib/merb-core/dispatch/session/cookie.rb +4 -2
  37. data/lib/merb-core/dispatch/session/memcached.rb +38 -27
  38. data/lib/merb-core/dispatch/session/memory.rb +18 -11
  39. data/lib/merb-core/dispatch/worker.rb +28 -0
  40. data/lib/merb-core/gem_ext/erubis.rb +58 -0
  41. data/lib/merb-core/logger.rb +3 -31
  42. data/lib/merb-core/plugins.rb +25 -3
  43. data/lib/merb-core/rack.rb +18 -12
  44. data/lib/merb-core/rack/adapter.rb +10 -8
  45. data/lib/merb-core/rack/adapter/ebb.rb +2 -2
  46. data/lib/merb-core/rack/adapter/irb.rb +31 -21
  47. data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +26 -0
  48. data/lib/merb-core/rack/adapter/thin.rb +19 -9
  49. data/lib/merb-core/rack/adapter/thin_turbo.rb +24 -0
  50. data/lib/merb-core/rack/application.rb +9 -84
  51. data/lib/merb-core/rack/middleware.rb +26 -0
  52. data/lib/merb-core/rack/middleware/path_prefix.rb +31 -0
  53. data/lib/merb-core/rack/middleware/profiler.rb +19 -0
  54. data/lib/merb-core/rack/middleware/static.rb +45 -0
  55. data/lib/merb-core/server.rb +27 -9
  56. data/lib/merb-core/tasks/audit.rake +68 -0
  57. data/lib/merb-core/tasks/merb.rb +1 -0
  58. data/lib/merb-core/tasks/merb_rake_helper.rb +12 -0
  59. data/lib/merb-core/tasks/stats.rake +71 -0
  60. data/lib/merb-core/test.rb +2 -1
  61. data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -3
  62. data/lib/merb-core/test/helpers/request_helper.rb +66 -24
  63. data/lib/merb-core/test/matchers/controller_matchers.rb +36 -4
  64. data/lib/merb-core/test/matchers/route_matchers.rb +12 -3
  65. data/lib/merb-core/test/matchers/view_matchers.rb +3 -3
  66. data/lib/merb-core/test/run_specs.rb +1 -0
  67. data/lib/merb-core/test/tasks/spectasks.rb +13 -5
  68. data/lib/merb-core/test/test_ext/string.rb +14 -0
  69. data/lib/merb-core/vendor/facets/dictionary.rb +3 -3
  70. data/lib/merb-core/vendor/facets/inflect.rb +82 -37
  71. data/lib/merb-core/version.rb +2 -2
  72. data/spec/private/config/config_spec.rb +39 -4
  73. data/spec/private/core_ext/kernel_spec.rb +3 -14
  74. data/spec/private/dispatch/bootloader_spec.rb +1 -1
  75. data/spec/private/dispatch/cookies_spec.rb +181 -69
  76. data/spec/private/dispatch/fixture/app/controllers/exceptions.rb +0 -2
  77. data/spec/private/dispatch/fixture/app/controllers/foo.rb +0 -2
  78. data/spec/private/dispatch/fixture/config/rack.rb +10 -0
  79. data/spec/private/dispatch/fixture/log/merb_test.log +7054 -1802
  80. data/spec/private/dispatch/route_params_spec.rb +2 -3
  81. data/spec/private/dispatch/session_mixin_spec.rb +47 -0
  82. data/spec/private/plugins/plugin_spec.rb +73 -59
  83. data/spec/private/router/behavior_spec.rb +60 -0
  84. data/spec/private/router/fixture/log/merb_test.log +1693 -0
  85. data/spec/private/router/route_spec.rb +414 -0
  86. data/spec/private/router/router_spec.rb +175 -0
  87. data/spec/private/vendor/facets/plural_spec.rb +564 -0
  88. data/spec/private/vendor/facets/singular_spec.rb +489 -0
  89. data/spec/public/abstract_controller/controllers/cousins.rb +41 -0
  90. data/spec/public/abstract_controller/controllers/helpers.rb +12 -2
  91. data/spec/public/abstract_controller/controllers/partial.rb +17 -2
  92. data/spec/public/abstract_controller/controllers/render.rb +16 -1
  93. data/spec/public/abstract_controller/controllers/views/helpers/capture_eq/index.erb +1 -0
  94. data/spec/public/abstract_controller/controllers/views/helpers/capture_with_args/index.erb +1 -0
  95. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_two_throw_contents/index.erb +1 -0
  96. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/_collection.erb +1 -0
  97. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/index.erb +1 -0
  98. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb +1 -0
  99. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb +1 -0
  100. data/spec/public/abstract_controller/filter_spec.rb +20 -1
  101. data/spec/public/abstract_controller/helper_spec.rb +10 -2
  102. data/spec/public/abstract_controller/partial_spec.rb +8 -0
  103. data/spec/public/abstract_controller/render_spec.rb +8 -0
  104. data/spec/public/abstract_controller/spec_helper.rb +7 -3
  105. data/spec/public/boot_loader/boot_loader_spec.rb +2 -2
  106. data/spec/public/controller/base_spec.rb +10 -2
  107. data/spec/public/controller/config/init.rb +6 -0
  108. data/spec/public/controller/controllers/authentication.rb +9 -11
  109. data/spec/public/controller/controllers/base.rb +2 -8
  110. data/spec/public/controller/controllers/cookies.rb +16 -0
  111. data/spec/public/controller/controllers/dispatcher.rb +35 -0
  112. data/spec/public/controller/controllers/display.rb +62 -14
  113. data/spec/public/controller/controllers/redirect.rb +36 -0
  114. data/spec/public/controller/controllers/responder.rb +37 -11
  115. data/spec/public/controller/controllers/views/layout/custom_arg.json.erb +1 -0
  116. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.html.erb +1 -0
  117. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.xml.erb +1 -0
  118. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/no_layout.html.erb +1 -0
  119. data/spec/public/controller/cookies_spec.rb +23 -0
  120. data/spec/public/controller/dispatcher_spec.rb +411 -0
  121. data/spec/public/controller/display_spec.rb +43 -10
  122. data/spec/public/controller/redirect_spec.rb +33 -0
  123. data/spec/public/controller/responder_spec.rb +79 -11
  124. data/spec/public/controller/spec_helper.rb +3 -1
  125. data/spec/public/controller/url_spec.rb +10 -0
  126. data/spec/public/core/merb_core_spec.rb +11 -0
  127. data/spec/public/core_ext/fixtures/core_ext_dependency.rb +2 -0
  128. data/spec/public/core_ext/kernel_spec.rb +9 -0
  129. data/spec/public/core_ext/spec_helper.rb +1 -0
  130. data/spec/public/directory_structure/directory/log/merb_test.log +3729 -272
  131. data/spec/public/directory_structure/directory_spec.rb +3 -4
  132. data/spec/public/logger/logger_spec.rb +4 -4
  133. data/spec/public/reloading/directory/log/merb_test.log +288066 -15
  134. data/spec/public/reloading/reload_spec.rb +49 -27
  135. data/spec/public/request/multipart_spec.rb +26 -0
  136. data/spec/public/request/request_spec.rb +21 -2
  137. data/spec/public/router/fixation_spec.rb +27 -0
  138. data/spec/public/router/fixture/log/merb_test.log +30050 -0
  139. data/spec/public/router/nested_matches_spec.rb +97 -0
  140. data/spec/public/router/resource_spec.rb +1 -9
  141. data/spec/public/router/resources_spec.rb +0 -20
  142. data/spec/public/router/spec_helper.rb +27 -9
  143. data/spec/public/router/special_spec.rb +21 -8
  144. data/spec/public/template/template_spec.rb +17 -5
  145. data/spec/public/test/controller_matchers_spec.rb +10 -0
  146. data/spec/public/test/request_helper_spec.rb +29 -0
  147. data/spec/public/test/route_helper_spec.rb +18 -1
  148. data/spec/public/test/route_matchers_spec.rb +28 -1
  149. data/spec/public/test/view_matchers_spec.rb +3 -3
  150. data/spec/spec_helper.rb +56 -12
  151. metadata +89 -47
  152. data/lib/merb-core/core_ext/class.rb +0 -299
  153. data/lib/merb-core/core_ext/hash.rb +0 -426
  154. data/lib/merb-core/core_ext/mash.rb +0 -154
  155. data/lib/merb-core/core_ext/object.rb +0 -147
  156. data/lib/merb-core/core_ext/object_space.rb +0 -14
  157. data/lib/merb-core/core_ext/rubygems.rb +0 -28
  158. data/lib/merb-core/core_ext/set.rb +0 -46
  159. data/lib/merb-core/core_ext/string.rb +0 -89
  160. data/lib/merb-core/core_ext/time.rb +0 -13
  161. data/lib/merb-core/dispatch/exceptions.html.erb +0 -297
  162. data/spec/private/core_ext/class_spec.rb +0 -22
  163. data/spec/private/core_ext/hash_spec.rb +0 -522
  164. data/spec/private/core_ext/object_spec.rb +0 -121
  165. data/spec/private/core_ext/set_spec.rb +0 -26
  166. data/spec/private/core_ext/string_spec.rb +0 -167
  167. data/spec/private/core_ext/time_spec.rb +0 -16
  168. data/spec/private/dispatch/dispatch_spec.rb +0 -26
  169. data/spec/private/dispatch/fixture/log/development.log +0 -1
  170. data/spec/private/dispatch/fixture/log/merb.4000.pid +0 -1
  171. data/spec/private/dispatch/fixture/log/production.log +0 -1
  172. data/spec/private/dispatch/fixture/merb.4000.pid +0 -1
  173. data/spec/private/rack/application_spec.rb +0 -43
  174. data/spec/public/controller/log/merb.4000.pid +0 -1
  175. data/spec/public/directory_structure/directory/log/merb.4000.pid +0 -1
  176. data/spec/public/directory_structure/directory/merb.4000.pid +0 -1
  177. data/spec/public/reloading/directory/log/merb.4000.pid +0 -1
  178. data/spec/public/reloading/directory/merb.4000.pid +0 -1
@@ -1,121 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- class Foo
3
- end
4
-
5
-
6
- describe Object do
7
- it "should treat an empty string as blank" do
8
- "".should be_blank
9
- end
10
-
11
- it "should treat a string with just spaces as blank" do
12
- " ".should be_blank
13
- end
14
-
15
- it "should treat an empty array as blank" do
16
- [].should be_blank
17
- end
18
-
19
- it "should treat boolean false as blank" do
20
- false.should be_blank
21
- end
22
- end
23
-
24
-
25
-
26
- describe Object, "#quacks_like" do
27
- it "use respond_to? to determine quacks_like :symbol" do
28
- "Foo".should be_quacks_like(:strip)
29
- end
30
-
31
- it "should return true if any of the elements in the Array are true" do
32
- "Foo".should be_quacks_like([String, Array])
33
- end
34
-
35
- it "should return false if an invalid value is passed in" do
36
- "Foo".should_not be_quacks_like({})
37
- end
38
- end
39
-
40
-
41
-
42
- describe Object, "#full_const_get" do
43
- class April
44
- class In
45
- class Paris
46
- PERFORMER = "Ella Fitzgerald"
47
- end
48
- end
49
- end
50
-
51
- module Succubus
52
- module In
53
- module Rapture
54
- PERFORMER = "Dimmu Borgir"
55
- end
56
- end
57
- end
58
-
59
- it "returns constant corresponding to the name" do
60
- self.full_const_get("April").should == April
61
- end
62
-
63
- it "handles nested classes" do
64
- self.full_const_get("April::In::Paris").should == April::In::Paris
65
- end
66
-
67
- it "handles nested modules" do
68
- self.full_const_get("Succubus::In::Rapture").should == Succubus::In::Rapture
69
- end
70
-
71
- it "handles in-scoped constants in modules" do
72
- self.full_const_get("Succubus::In::Rapture::PERFORMER").should == "Dimmu Borgir"
73
- end
74
-
75
- it "handles in-scoped constants in classes" do
76
- self.full_const_get("April::In::Paris::PERFORMER").should == "Ella Fitzgerald"
77
- end
78
-
79
- it "acts as a global function" do
80
- lambda { April::In::Paris.full_const_get("PERFORMER") }.should raise_error(NameError)
81
- end
82
-
83
- it "raises an exception if constant is undefined" do
84
- lambda { self.full_const_get("We::May::Never::Meet::Again") }.should raise_error(NameError)
85
- end
86
- end
87
-
88
-
89
-
90
- describe Object, "#make_module" do
91
- it "defines module from a string name" do
92
- Object.make_module("Cant::Take::That::Away::From::Me")
93
-
94
- defined?(Cant::Take::That::Away::From::Me).should == "constant"
95
- end
96
-
97
- it "is OK if module already defined" do
98
- module Merb
99
- module Is
100
- module Modular
101
- end
102
- end
103
- end
104
-
105
- lambda { Object.make_module("Merb::Is::Modular") }.should_not raise_error
106
- end
107
- end
108
-
109
- describe Object, "#in?" do
110
- it "should be true if the argument includes self" do
111
- 4.in?([1,2,4,5]).should be_true
112
- end
113
-
114
- it "should be false if the argument does not include self" do
115
- 4.in?([1,2,3,5]).should be_false
116
- end
117
-
118
- it "should splat the args so [] are not required" do
119
- 4.in?(1,2,3,4,5).should be_true
120
- end
121
- end
@@ -1,26 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Merb::SimpleSet do
4
-
5
- before do
6
- @s = Merb::SimpleSet.new("Foo")
7
- end
8
-
9
- it "should support <<" do
10
- @s << "Hello"
11
- @s.should be_include("Hello")
12
- end
13
-
14
- it "should support merge" do
15
- @s.should include("Foo")
16
- @t = @s.merge(["Bar"])
17
- @t.should be_kind_of(Merb::SimpleSet)
18
- @t.should include("Foo")
19
- @t.should include("Bar")
20
- end
21
-
22
- it "should support inspect" do
23
- @s.inspect.should == "#<SimpleSet: {\"Foo\"}>"
24
- end
25
-
26
- end
@@ -1,167 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe String, "#to_const_string" do
4
- it "swaps slashes with ::" do
5
- "foo/bar".to_const_string.should == "Foo::Bar"
6
- end
7
-
8
- it "replaces snake_case with CamelCase" do
9
- "foo/bar/baz_bat".to_const_string.should == "Foo::Bar::BazBat"
10
- end
11
-
12
- it "leaves constant string as is" do
13
- "Merb::Test".to_const_string.should == "Merb::Test"
14
- end
15
- end
16
-
17
-
18
-
19
- describe String, "#to_const_path" do
20
- it "swaps :: with slash" do
21
- "Foo::Bar".to_const_path.should == "foo/bar"
22
- end
23
-
24
- it "snake_cases string" do
25
- "Merb::Test::ViewHelper".to_const_path.should == "merb/test/view_helper"
26
- end
27
-
28
- it "leaves slash-separated snake case string as is" do
29
- "merb/test/view_helper".to_const_path.should == "merb/test/view_helper"
30
- end
31
- end
32
-
33
-
34
-
35
- describe String, "#camel_case" do
36
- it "handles lowercase without underscore" do
37
- "merb".camel_case.should == "Merb"
38
- end
39
-
40
- it "handles lowercase with 1 underscore" do
41
- "merb_core".camel_case.should == "MerbCore"
42
- end
43
-
44
- it "handles lowercase with more than 1 underscore" do
45
- "so_you_want_contribute_to_merb_core".camel_case.should == "SoYouWantContributeToMerbCore"
46
- end
47
-
48
- it "handles lowercase with more than 1 underscore in a row" do
49
- "__python__is__like__this".camel_case.should == "PythonIsLikeThis"
50
- end
51
-
52
- it "handle first capital letter with underscores" do
53
- "Python__Is__Like__This".camel_case.should == "PythonIsLikeThis"
54
- end
55
-
56
- it "leaves CamelCase as is" do
57
- "TestController".camel_case.should == "TestController"
58
- end
59
- end
60
-
61
-
62
-
63
- describe String, "#snake_case" do
64
- it "lowercases one word CamelCase" do
65
- "Merb".snake_case.should == "merb"
66
- end
67
-
68
- it "makes one underscore snake_case two word CamelCase" do
69
- "MerbCore".snake_case.should == "merb_core"
70
- end
71
-
72
- it "handles CamelCase with more than 2 words" do
73
- "SoYouWantContributeToMerbCore".snake_case.should == "so_you_want_contribute_to_merb_core"
74
- end
75
-
76
- it "handles CamelCase with more than 2 capital letter in a row" do
77
- "CNN".snake_case.should == "cnn"
78
- "CNNNews".snake_case.should == "cnn_news"
79
- "HeadlineCNNNews".snake_case.should == "headline_cnn_news"
80
- end
81
-
82
- it "does NOT change one word lowercase" do
83
- "merb".snake_case.should == "merb"
84
- end
85
-
86
- it "leaves snake_case as is" do
87
- "merb_core".snake_case.should == "merb_core"
88
- end
89
- end
90
-
91
-
92
-
93
- describe String, "#escape_regexp" do
94
- it "escapes all * in a string" do
95
- "*and*".escape_regexp.should == "\\*and\\*"
96
- end
97
-
98
- it "escapes all ? in a string" do
99
- "?and?".escape_regexp.should == "\\?and\\?"
100
- end
101
-
102
- it "escapes all { in a string" do
103
- "{and{".escape_regexp.should == "\\{and\\{"
104
- end
105
-
106
- it "escapes all } in a string" do
107
- "}and}".escape_regexp.should == "\\}and\\}"
108
- end
109
-
110
- it "escapes all . in a string" do
111
- ".and.".escape_regexp.should == "\\.and\\."
112
- end
113
-
114
- it "escapes all regexp special characters used in a string" do
115
- "*?{}.".escape_regexp.should == "\\*\\?\\{\\}\\."
116
- end
117
- end
118
-
119
-
120
-
121
- describe String, "#unescape_regexp" do
122
- it "unescapes all \\* in a string" do
123
- "\\*and\\*".unescape_regexp.should == "*and*"
124
- end
125
-
126
- it "unescapes all \\? in a string" do
127
- "\\?and\\?".unescape_regexp.should == "?and?"
128
- end
129
-
130
- it "unescapes all \\{ in a string" do
131
- "\\{and\\{".unescape_regexp.should == "{and{"
132
- end
133
-
134
- it "unescapes all \\} in a string" do
135
- "\\}and\\}".unescape_regexp.should == "}and}"
136
- end
137
-
138
- it "unescapes all \\. in a string" do
139
- "\\.and\\.".unescape_regexp.should == ".and."
140
- end
141
-
142
- it "unescapes all regexp special characters used in a string" do
143
- "\\*\\?\\{\\}\\.".unescape_regexp.should == "*?{}."
144
- end
145
- end
146
-
147
-
148
-
149
- describe String, "#/" do
150
- it "concanates operands with File::SEPARATOR" do
151
- ("merb" / "core").should == "merb#{File::SEPARATOR}core"
152
- end
153
- end
154
-
155
-
156
- require 'rbconfig'
157
- describe String, "#relative_path_from" do
158
- it "uses other operand as base for path calculation" do
159
- site_dir = Config::CONFIG["sitedir"]
160
-
161
- two_levels_up = site_dir.split(File::SEPARATOR)
162
- 2.times { two_levels_up.pop } # remove two deepest directories
163
- two_levels_up = File::SEPARATOR + two_levels_up.join(File::SEPARATOR)
164
-
165
- two_levels_up.relative_path_from(site_dir).should == "../.."
166
- end
167
- end
@@ -1,16 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'json'
3
-
4
- describe Time, "#to_json" do
5
-
6
- before do
7
- @expected = "\"2008-03-28T22:54:20Z\""
8
- end
9
-
10
- it "should transform itself into a ISO 8601 compatible string" do
11
- Time.utc(2008, 3, 28, 22, 54, 20).to_json.should == @expected
12
- Time.xmlschema("2008-03-28T22:54:20Z").to_json.should == @expected
13
- Time.xmlschema("2008-03-28T17:54:20-05:00").to_json.should == @expected
14
- end
15
-
16
- end
@@ -1,26 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
- require 'rack/mock'
3
- require 'stringio'
4
- Merb.start :environment => 'test',
5
- :merb_root => File.dirname(__FILE__) / 'fixture'
6
-
7
- describe Merb::Dispatcher do
8
-
9
- it "should handle return an Exceptions controller for a bad route request" do
10
- env = Rack::MockRequest.env_for("/notreal")
11
- Merb::Dispatcher.handle(env).should be_kind_of(Exceptions)
12
- end
13
-
14
- it "should search for an action matching the specific exception in the Exceptions controller" do
15
- env = Rack::MockRequest.env_for("/foo/raise_not_acceptable")
16
- env['REQUEST_URI'] = '/foo/raise_not_acceptable'
17
- Merb::Dispatcher.handle(env).action_name.should == 'not_acceptable'
18
- end
19
-
20
- it "should search for actions matching more general exception types if the specific one cannot be found in the Exception controller" do
21
- env = Rack::MockRequest.env_for("/foo/raise_conflict")
22
- env['REQUEST_URI'] = '/foo/raise_conflict'
23
- Merb::Dispatcher.handle(env).action_name.should == 'client_error'
24
- end
25
-
26
- end
@@ -1 +0,0 @@
1
- Fri, 29 Feb 2008 08:16:44 GMT ~ info ~ Logfile created
@@ -1 +0,0 @@
1
- Fri, 29 Feb 2008 08:16:44 GMT ~ info ~ Logfile created
@@ -1,43 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
2
- require 'rack/mock'
3
-
4
- Merb.start :environment => 'test'
5
-
6
- describe Merb::Rack::Application do
7
-
8
- before do
9
- @app = Merb::Rack::Application.new
10
- end
11
-
12
- it "should return a MockResponse" do
13
- res = Rack::MockRequest.new(@app).get("")
14
- res.should be_kind_of(Rack::MockResponse)
15
- end
16
-
17
- end
18
-
19
- describe Merb::Rack::Application, "with :path_prefix set" do
20
-
21
- before do
22
- Merb::Config[:path_prefix] = "/quux"
23
- @app = Merb::Rack::Application.new
24
- @nullobj = mock('controller', :null_object => true)
25
- end
26
-
27
- it "should strip the path_prefix from a request's REQUEST_URI and PATH_INFO" do
28
- Merb::Dispatcher.should_receive(:handle).with(
29
- {'REQUEST_URI' => "/foo/bar", 'PATH_INFO' => "/foo/bar"}
30
- ).and_return @nullobj
31
-
32
- @app.call('REQUEST_URI' => "/quux/foo/bar", 'PATH_INFO' => "/quux/foo/bar")
33
- end
34
-
35
- it "should not leave REQUEST_URI or PATH_INFO empty" do
36
- Merb::Dispatcher.should_receive(:handle).with(
37
- {'REQUEST_URI' => "/", 'PATH_INFO' => "/"}
38
- ).and_return @nullobj
39
-
40
- @app.call('REQUEST_URI' => "/quux", 'PATH_INFO' => "/quux")
41
- end
42
-
43
- end