merb-core 0.9.2 → 0.9.3
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.
- data/Rakefile +61 -11
- data/bin/merb +5 -1
- data/lib/merb-core.rb +202 -25
- data/lib/merb-core/autoload.rb +19 -17
- data/lib/merb-core/bootloader.rb +84 -71
- data/lib/merb-core/config.rb +19 -14
- data/lib/merb-core/controller/abstract_controller.rb +16 -17
- data/lib/merb-core/controller/exceptions.rb +115 -70
- data/lib/merb-core/controller/merb_controller.rb +62 -38
- data/lib/merb-core/controller/mime.rb +1 -1
- data/lib/merb-core/controller/mixins/authentication.rb +87 -0
- data/lib/merb-core/controller/mixins/controller.rb +16 -15
- data/lib/merb-core/controller/mixins/render.rb +113 -19
- data/lib/merb-core/controller/mixins/responder.rb +8 -2
- data/lib/merb-core/controller/template.rb +1 -1
- data/lib/merb-core/core_ext.rb +1 -0
- data/lib/merb-core/core_ext/class.rb +113 -6
- data/lib/merb-core/core_ext/hash.rb +43 -39
- data/lib/merb-core/core_ext/kernel.rb +75 -38
- data/lib/merb-core/core_ext/mash.rb +4 -4
- data/lib/merb-core/core_ext/object.rb +18 -7
- data/lib/merb-core/core_ext/set.rb +9 -4
- data/lib/merb-core/core_ext/string.rb +29 -9
- data/lib/merb-core/core_ext/time.rb +13 -0
- data/lib/merb-core/dispatch/cookies.rb +1 -2
- data/lib/merb-core/dispatch/dispatcher.rb +18 -10
- data/lib/merb-core/dispatch/exceptions.html.erb +1 -1
- data/lib/merb-core/dispatch/request.rb +3 -0
- data/lib/merb-core/dispatch/router.rb +10 -7
- data/lib/merb-core/dispatch/router/behavior.rb +36 -27
- data/lib/merb-core/dispatch/router/route.rb +7 -2
- data/lib/merb-core/dispatch/session/cookie.rb +4 -4
- data/lib/merb-core/dispatch/session/memcached.rb +17 -5
- data/lib/merb-core/logger.rb +2 -2
- data/lib/merb-core/plugins.rb +16 -4
- data/lib/merb-core/rack/adapter/ebb.rb +4 -1
- data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -0
- data/lib/merb-core/rack/adapter/fcgi.rb +1 -0
- data/lib/merb-core/rack/adapter/mongrel.rb +1 -0
- data/lib/merb-core/rack/adapter/runner.rb +1 -0
- data/lib/merb-core/rack/adapter/thin.rb +3 -1
- data/lib/merb-core/rack/adapter/webrick.rb +1 -0
- data/lib/merb-core/rack/application.rb +17 -1
- data/lib/merb-core/server.rb +78 -28
- data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -3
- data/lib/merb-core/test/helpers/request_helper.rb +81 -27
- data/lib/merb-core/test/helpers/view_helper.rb +1 -1
- data/lib/merb-core/test/matchers/controller_matchers.rb +55 -5
- data/lib/merb-core/test/matchers/route_matchers.rb +8 -17
- data/lib/merb-core/test/matchers/view_matchers.rb +53 -11
- data/lib/merb-core/test/run_specs.rb +22 -14
- data/lib/merb-core/test/tasks/spectasks.rb +54 -33
- data/lib/merb-core/vendor/facets/inflect.rb +91 -2
- data/lib/merb-core/version.rb +2 -2
- data/spec/private/config/config_spec.rb +54 -26
- data/spec/private/core_ext/class_spec.rb +22 -0
- data/spec/private/core_ext/hash_spec.rb +70 -54
- data/spec/private/core_ext/kernel_spec.rb +149 -14
- data/spec/private/core_ext/object_spec.rb +92 -10
- data/spec/private/core_ext/string_spec.rb +162 -4
- data/spec/private/core_ext/time_spec.rb +16 -0
- data/spec/private/dispatch/bootloader_spec.rb +24 -0
- data/spec/private/dispatch/fixture/app/views/exeptions/client_error.html.erb +1 -1
- data/spec/private/dispatch/fixture/app/views/exeptions/internal_server_error.html.erb +1 -1
- data/spec/private/dispatch/fixture/app/views/exeptions/not_acceptable.html.erb +1 -1
- data/spec/private/dispatch/fixture/app/views/exeptions/not_found.html.erb +1 -1
- data/spec/private/dispatch/fixture/config/black_hole.rb +12 -0
- data/spec/private/dispatch/fixture/log/merb_test.log +138 -0
- data/spec/private/plugins/plugin_spec.rb +79 -8
- data/spec/private/rack/application_spec.rb +1 -1
- data/spec/public/abstract_controller/controllers/filters.rb +26 -0
- data/spec/public/abstract_controller/controllers/helpers.rb +2 -2
- data/spec/public/abstract_controller/controllers/partial.rb +2 -2
- data/spec/public/abstract_controller/controllers/render.rb +16 -4
- data/spec/public/abstract_controller/filter_spec.rb +8 -0
- data/spec/public/abstract_controller/render_spec.rb +12 -0
- data/spec/public/controller/authentication_spec.rb +103 -0
- data/spec/public/controller/base_spec.rb +4 -3
- data/spec/public/controller/controllers/authentication.rb +47 -0
- data/spec/public/controller/controllers/base.rb +1 -0
- data/spec/public/controller/controllers/display.rb +30 -0
- data/spec/public/controller/controllers/views/layout/custom_arg.html.erb +1 -0
- data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template_argument/index.html.erb +1 -0
- data/spec/public/controller/display_spec.rb +17 -0
- data/spec/public/controller/spec_helper.rb +1 -0
- data/spec/public/controller/url_spec.rb +25 -7
- data/spec/public/core/merb_core_spec.rb +34 -0
- data/spec/public/directory_structure/directory/app/controllers/custom.rb +2 -2
- data/spec/public/directory_structure/directory/log/merb_test.log +48 -0
- data/spec/public/logger/logger_spec.rb +10 -4
- data/spec/public/reloading/directory/app/controllers/reload.rb +1 -1
- data/spec/public/reloading/directory/log/merb_test.log +13 -0
- data/spec/public/reloading/reload_spec.rb +23 -22
- data/spec/public/request/request_spec.rb +2 -0
- data/spec/public/router/nested_resources_spec.rb +7 -0
- data/spec/public/router/resources_spec.rb +46 -1
- data/spec/public/router/special_spec.rb +5 -1
- data/spec/public/test/controller_matchers_spec.rb +25 -1
- data/spec/public/test/controllers/spec_helper_controller.rb +8 -0
- data/spec/public/test/request_helper_spec.rb +52 -1
- data/spec/public/test/route_matchers_spec.rb +27 -25
- data/spec/public/test/view_helper_spec.rb +1 -1
- data/spec/public/test/view_matchers_spec.rb +148 -72
- metadata +23 -3
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Merb::BootLoader::RackUpApplication do
|
|
4
|
+
|
|
5
|
+
it "should default to rack config (rack.rb)" do
|
|
6
|
+
options = {:merb_root => File.dirname(__FILE__) / 'fixture'}
|
|
7
|
+
Merb::Config.setup(options)
|
|
8
|
+
app = Merb::BootLoader::RackUpApplication.run
|
|
9
|
+
app.class.should == Merb::Rack::Application
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should use rackup config that we specified" do
|
|
13
|
+
options = {:rackup => File.dirname(__FILE__) / 'fixture' / 'config' / 'black_hole.rb'}
|
|
14
|
+
Merb::Config.setup(options)
|
|
15
|
+
app = Merb::BootLoader::RackUpApplication.run
|
|
16
|
+
app.class.should == Rack::Adapter::BlackHole
|
|
17
|
+
|
|
18
|
+
env = Rack::MockRequest.env_for("/black_hole")
|
|
19
|
+
status, header, body = app.call(env)
|
|
20
|
+
status.should == 200
|
|
21
|
+
header.should == { "Content-Type" => "text/plain" }
|
|
22
|
+
body.should == ""
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
<div class="internalError">
|
|
130
130
|
|
|
131
131
|
<div class="header">
|
|
132
|
-
<h1><%= @exception_name %> <sup class="error_<%= @exception.class
|
|
132
|
+
<h1><%= @exception_name %> <sup class="error_<%= @exception.class.status %>"><%= @exception.class.status %></sup></h1>
|
|
133
133
|
<% if show_details = ::Merb::Config[:exception_details] -%>
|
|
134
134
|
<h2><%= @exception.message %></h2>
|
|
135
135
|
<% else -%>
|
|
@@ -2038,3 +2038,141 @@ Mon, 25 Feb 2008 23:13:12 GMT ~ {:before_filters_time=>6.0e-06, :action_time=>0.
|
|
|
2038
2038
|
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2039
2039
|
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2040
2040
|
~ {:action_time=>0.000269, :dispatch_time=>0.000425, :before_filters_time=>5.0e-06, :after_filters_time=>5.0e-06}
|
|
2041
|
+
~ Loaded TEST Environment...
|
|
2042
|
+
~ Compiling routes...
|
|
2043
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2044
|
+
~ Loaded TEST Environment...
|
|
2045
|
+
~ Compiling routes...
|
|
2046
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2047
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2048
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2049
|
+
~ {:action_time=>0.00086, :dispatch_time=>0.001065, :before_filters_time=>8.0e-06, :after_filters_time=>6.0e-06}
|
|
2050
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2051
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2052
|
+
~ {:action_time=>0.000247, :dispatch_time=>0.000385, :before_filters_time=>6.0e-06, :after_filters_time=>5.0e-06}
|
|
2053
|
+
~ Loaded TEST Environment...
|
|
2054
|
+
~ Compiling routes...
|
|
2055
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2056
|
+
~ Loaded TEST Environment...
|
|
2057
|
+
~ Compiling routes...
|
|
2058
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2059
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2060
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2061
|
+
~ {:action_time=>0.000836, :dispatch_time=>0.00103, :before_filters_time=>8.0e-06, :after_filters_time=>6.0e-06}
|
|
2062
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2063
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2064
|
+
~ {:action_time=>0.000239, :dispatch_time=>0.000377, :before_filters_time=>4.0e-06, :after_filters_time=>5.0e-06}
|
|
2065
|
+
~ Loaded TEST Environment...
|
|
2066
|
+
~ Compiling routes...
|
|
2067
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2068
|
+
~ Loaded TEST Environment...
|
|
2069
|
+
~ Compiling routes...
|
|
2070
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2071
|
+
~ Loaded TEST Environment...
|
|
2072
|
+
~ Compiling routes...
|
|
2073
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2074
|
+
~ Loaded TEST Environment...
|
|
2075
|
+
~ Compiling routes...
|
|
2076
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2077
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2078
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2079
|
+
~ {:action_time=>0.000839, :dispatch_time=>0.001034, :before_filters_time=>7.0e-06, :after_filters_time=>6.0e-06}
|
|
2080
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2081
|
+
~ Routed to: {:action=>"bar", :format=>nil, :controller=>"foo", :id=>"54"}
|
|
2082
|
+
~ {:action_time=>0.000238, :dispatch_time=>0.000373, :before_filters_time=>4.0e-06, :after_filters_time=>5.0e-06}
|
|
2083
|
+
~ Loaded TEST Environment...
|
|
2084
|
+
~ Compiling routes...
|
|
2085
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2086
|
+
~ Loaded TEST Environment...
|
|
2087
|
+
~ Compiling routes...
|
|
2088
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2089
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2090
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2091
|
+
~ {:dispatch_time=>0.00124, :action_time=>0.001025, :before_filters_time=>1.0e-05, :after_filters_time=>6.0e-06}
|
|
2092
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2093
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2094
|
+
~ {:dispatch_time=>0.000476, :action_time=>0.000335, :before_filters_time=>6.0e-06, :after_filters_time=>5.0e-06}
|
|
2095
|
+
~ Loaded TEST Environment...
|
|
2096
|
+
~ Compiling routes...
|
|
2097
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2098
|
+
~ Loaded TEST Environment...
|
|
2099
|
+
~ Compiling routes...
|
|
2100
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2101
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2102
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2103
|
+
~ {:dispatch_time=>0.001202, :action_time=>0.000997, :before_filters_time=>9.0e-06, :after_filters_time=>5.0e-06}
|
|
2104
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2105
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2106
|
+
~ {:dispatch_time=>0.000541, :action_time=>0.000322, :before_filters_time=>5.0e-06, :after_filters_time=>4.0e-06}
|
|
2107
|
+
~ Loaded TEST Environment...
|
|
2108
|
+
~ Compiling routes...
|
|
2109
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2110
|
+
~ Loaded TEST Environment...
|
|
2111
|
+
~ Compiling routes...
|
|
2112
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2113
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2114
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2115
|
+
~ {:dispatch_time=>0.001481, :action_time=>0.001224, :before_filters_time=>1.0e-05, :after_filters_time=>6.0e-06}
|
|
2116
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2117
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2118
|
+
~ {:dispatch_time=>0.000606, :action_time=>0.00042, :before_filters_time=>7.0e-06, :after_filters_time=>6.0e-06}
|
|
2119
|
+
~ Loaded TEST Environment...
|
|
2120
|
+
~ Compiling routes...
|
|
2121
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2122
|
+
~ Loaded TEST Environment...
|
|
2123
|
+
~ Compiling routes...
|
|
2124
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2125
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2126
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2127
|
+
~ {:dispatch_time=>0.001454, :action_time=>0.00121, :before_filters_time=>9.0e-06, :after_filters_time=>7.0e-06}
|
|
2128
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2129
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2130
|
+
~ {:dispatch_time=>0.000594, :action_time=>0.000413, :before_filters_time=>7.0e-06, :after_filters_time=>5.0e-06}
|
|
2131
|
+
~ Loaded TEST Environment...
|
|
2132
|
+
~ Compiling routes...
|
|
2133
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2134
|
+
~ Loaded TEST Environment...
|
|
2135
|
+
~ Compiling routes...
|
|
2136
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2137
|
+
~ Routed to: {:format=>nil, :action=>"bar", :id=>"54", :controller=>"foo"}
|
|
2138
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2139
|
+
~ {:before_filters_time=>9.0e-06, :after_filters_time=>7.0e-06, :dispatch_time=>0.001479, :action_time=>0.001234}
|
|
2140
|
+
~ Routed to: {:format=>nil, :action=>"bar", :id=>"54", :controller=>"foo"}
|
|
2141
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2142
|
+
~ {:before_filters_time=>7.0e-06, :after_filters_time=>7.0e-06, :dispatch_time=>0.000594, :action_time=>0.000407}
|
|
2143
|
+
~ Loaded TEST Environment...
|
|
2144
|
+
~ Compiling routes...
|
|
2145
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2146
|
+
~ Loaded TEST Environment...
|
|
2147
|
+
~ Compiling routes...
|
|
2148
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2149
|
+
~ Routed to: {:controller=>"foo", :format=>nil, :action=>"bar", :id=>"54"}
|
|
2150
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2151
|
+
~ {:dispatch_time=>0.001304, :action_time=>0.001105, :before_filters_time=>8.0e-06, :after_filters_time=>5.0e-06}
|
|
2152
|
+
~ Routed to: {:controller=>"foo", :format=>nil, :action=>"bar", :id=>"54"}
|
|
2153
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2154
|
+
~ {:dispatch_time=>0.000448, :action_time=>0.000307, :before_filters_time=>6.0e-06, :after_filters_time=>5.0e-06}
|
|
2155
|
+
~ Loaded TEST Environment...
|
|
2156
|
+
~ Compiling routes...
|
|
2157
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2158
|
+
~ Loaded TEST Environment...
|
|
2159
|
+
~ Compiling routes...
|
|
2160
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2161
|
+
~ Routed to: {:controller=>"foo", :format=>nil, :action=>"bar", :id=>"54"}
|
|
2162
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2163
|
+
~ {:dispatch_time=>0.001304, :action_time=>0.001105, :before_filters_time=>8.0e-06, :after_filters_time=>6.0e-06}
|
|
2164
|
+
~ Routed to: {:controller=>"foo", :format=>nil, :action=>"bar", :id=>"54"}
|
|
2165
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2166
|
+
~ {:dispatch_time=>0.000486, :action_time=>0.000345, :before_filters_time=>5.0e-06, :after_filters_time=>6.0e-06}
|
|
2167
|
+
~ Loaded TEST Environment...
|
|
2168
|
+
~ Compiling routes...
|
|
2169
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2170
|
+
~ Loaded TEST Environment...
|
|
2171
|
+
~ Compiling routes...
|
|
2172
|
+
~ Using 'share-nothing' cookie sessions (4kb limit per client)
|
|
2173
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2174
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2175
|
+
~ {:dispatch_time=>0.001314, :action_time=>0.001112, :before_filters_time=>8.0e-06, :after_filters_time=>6.0e-06}
|
|
2176
|
+
~ Routed to: {:format=>nil, :action=>"bar", :controller=>"foo", :id=>"54"}
|
|
2177
|
+
~ Params: {"format"=>nil, "action"=>"bar", "id"=>"54", "controller"=>"foo"}
|
|
2178
|
+
~ {:dispatch_time=>0.000446, :action_time=>0.000305, :before_filters_time=>6.0e-06, :after_filters_time=>5.0e-06}
|
|
@@ -18,13 +18,13 @@ end
|
|
|
18
18
|
|
|
19
19
|
describe "Plugins","use_orm" do
|
|
20
20
|
before(:each) do
|
|
21
|
-
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
21
|
+
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
22
22
|
Kernel.stub!(:dependency)
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should raise an error if use_orm is called twice" do
|
|
26
26
|
use_orm(:activerecord)
|
|
27
|
-
lambda { use_orm(:datamapper) }.should raise_error
|
|
27
|
+
lambda { use_orm(:datamapper) }.should raise_error("Don't call use_orm more than once")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it "should not have :merb_default in GENERATOR_SCOPE with use_orm(:activerecord)" do
|
|
@@ -41,21 +41,22 @@ describe "Plugins","use_orm" do
|
|
|
41
41
|
use_orm(:activerecord)
|
|
42
42
|
Merb.generator_scope.first.should == :activerecord
|
|
43
43
|
end
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
it "should call dependency :merb_activerecord with use_orm(:activerecord)" do
|
|
46
46
|
Kernel.should_receive(:dependency).with("merb_activerecord").once.
|
|
47
47
|
and_return(true)
|
|
48
48
|
use_orm(:activerecord)
|
|
49
49
|
end
|
|
50
|
-
|
|
51
50
|
end
|
|
52
51
|
|
|
52
|
+
|
|
53
|
+
|
|
53
54
|
describe "Plugins","use_test" do
|
|
54
55
|
before(:each) do
|
|
55
56
|
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
56
57
|
Kernel.stub!(:dependency)
|
|
57
58
|
end
|
|
58
|
-
|
|
59
|
+
|
|
59
60
|
it "should have :rspec in GENERATOR_SCOPE by default" do
|
|
60
61
|
Merb.generator_scope.should include(:rspec)
|
|
61
62
|
end
|
|
@@ -74,8 +75,78 @@ describe "Plugins","use_test" do
|
|
|
74
75
|
use_test(:test_unit)
|
|
75
76
|
Merb.generator_scope.last.should == :test_unit
|
|
76
77
|
end
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
it "should raise an error if called with an unsupported test framework" do
|
|
79
80
|
lambda { use_test(:fiddlefaddle) }.should raise_error
|
|
80
81
|
end
|
|
81
|
-
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
describe "Plugins", "register_orm" do
|
|
86
|
+
before(:each) do
|
|
87
|
+
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
88
|
+
Kernel.stub!(:dependency)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it "registers ORM plugin at generator scope" do
|
|
92
|
+
register_orm(:sequel)
|
|
93
|
+
|
|
94
|
+
Merb.generator_scope.should include(:sequel)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
describe "Plugins", "registred_orm?" do
|
|
101
|
+
before(:each) do
|
|
102
|
+
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
103
|
+
Kernel.stub!(:dependency)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "returns false unless ORM is registred" do
|
|
107
|
+
registred_orm?(:sequel).should be(false)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "returns true once ORM is registred" do
|
|
111
|
+
use_orm(:sequel)
|
|
112
|
+
|
|
113
|
+
registred_orm?(:sequel).should be(false)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
describe "Plugins", "register_test_framework" do
|
|
121
|
+
before(:each) do
|
|
122
|
+
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
123
|
+
Kernel.stub!(:dependency)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "registers test framework at generator scope" do
|
|
127
|
+
register_test_framework(:test_unit)
|
|
128
|
+
|
|
129
|
+
Merb.generator_scope.should include(:test_unit)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
describe "Plugins", "supported_test_framework?" do
|
|
136
|
+
before(:each) do
|
|
137
|
+
Merb.generator_scope.replace [:merb_default, :merb, :rspec]
|
|
138
|
+
Kernel.stub!(:dependency)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "supports RSpec" do
|
|
142
|
+
supported_test_framework?(:rspec).should be(true)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it "supports Test::Unit" do
|
|
146
|
+
supported_test_framework?(:rspec).should be(true)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it "DOES NOT yet support MSpec (of Rubinius fame)" do
|
|
150
|
+
supported_test_framework?(:mspec).should be(false)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
@@ -163,5 +163,31 @@ module Merb::Test::Fixtures
|
|
|
163
163
|
"index action"
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
|
+
|
|
167
|
+
class TestBeforeFilterWithArgument < Testing
|
|
168
|
+
before :foo, :with => "bar"
|
|
169
|
+
|
|
170
|
+
def index
|
|
171
|
+
"index action"
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
private
|
|
175
|
+
def foo(bar)
|
|
176
|
+
bar == "bar"
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
class TestBeforeFilterWithArguments < Testing
|
|
181
|
+
before :foo, :with => ["bar", "baz"]
|
|
182
|
+
|
|
183
|
+
def index
|
|
184
|
+
"index action"
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
private
|
|
188
|
+
def foo(bar,baz)
|
|
189
|
+
bar == "bar" && baz == "baz"
|
|
190
|
+
end
|
|
191
|
+
end
|
|
166
192
|
end
|
|
167
193
|
end
|
|
@@ -4,8 +4,8 @@ module Merb::Test::Fixtures
|
|
|
4
4
|
class HelperTesting < Merb::AbstractController
|
|
5
5
|
self._template_root = File.dirname(__FILE__) / "views"
|
|
6
6
|
|
|
7
|
-
def _template_location(
|
|
8
|
-
"helpers/#{File.basename(controller)}/#{
|
|
7
|
+
def _template_location(context, type = nil, controller = controller_name)
|
|
8
|
+
"helpers/#{File.basename(controller)}/#{context}"
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -7,8 +7,8 @@ module Merb::Test::Fixtures
|
|
|
7
7
|
class RenderIt < Merb::AbstractController
|
|
8
8
|
self._template_root = File.dirname(__FILE__) / "views"
|
|
9
9
|
|
|
10
|
-
def _template_location(
|
|
11
|
-
"partial/#{File.basename(controller)}/#{
|
|
10
|
+
def _template_location(context, type = nil, controller = controller_name)
|
|
11
|
+
"partial/#{File.basename(controller)}/#{context}"
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -58,9 +58,21 @@ module Merb::Test::Fixtures
|
|
|
58
58
|
self._template_root = File.dirname(__FILE__) / "alt_views"
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
class RenderNoDefaultAppLayout < RenderString
|
|
62
|
+
self._template_root = File.dirname(__FILE__) / "alt_views"
|
|
63
|
+
self.layout false
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class RenderNoDefaultAppLayoutInherited < RenderNoDefaultAppLayout
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class RenderDefaultAppLayoutInheritedOverride < RenderNoDefaultAppLayout
|
|
70
|
+
self.default_layout
|
|
71
|
+
end
|
|
72
|
+
|
|
61
73
|
class RenderTemplateCustomLocation < RenderTemplate
|
|
62
|
-
def _template_location(
|
|
63
|
-
"wonderful/#{
|
|
74
|
+
def _template_location(context, type = nil, controller = controller_name)
|
|
75
|
+
"wonderful/#{context}"
|
|
64
76
|
end
|
|
65
77
|
end
|
|
66
78
|
|
|
@@ -75,8 +87,8 @@ module Merb::Test::Fixtures
|
|
|
75
87
|
class RenderTemplateMultipleRootsAndCustomLocation < RenderTemplate
|
|
76
88
|
self._template_roots = [[File.dirname(__FILE__) / "alt_views", :_custom_template_location]]
|
|
77
89
|
|
|
78
|
-
def _custom_template_location(
|
|
79
|
-
"#{self.class.name.split('::')[-1].to_const_path}/#{
|
|
90
|
+
def _custom_template_location(context, type = nil, controller = controller_name)
|
|
91
|
+
"#{self.class.name.split('::')[-1].to_const_path}/#{context}"
|
|
80
92
|
end
|
|
81
93
|
end
|
|
82
94
|
|