merb 0.4.0 → 0.4.1
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/README +23 -160
- data/Rakefile +15 -14
- data/app_generators/merb/merb_generator.rb +4 -3
- data/app_generators/merb/templates/Rakefile +1 -6
- data/app_generators/merb/templates/app/mailers/views/layout/{application.erb → application.html.erb} +0 -0
- data/app_generators/merb/templates/app/mailers/views/layout/application.text.erb +1 -0
- data/app_generators/merb/templates/app/parts/views/layout/application.html.erb +1 -0
- data/app_generators/merb/templates/app/views/layout/application.html.erb +2 -2
- data/app_generators/merb/templates/config/dependencies.rb +1 -1
- data/app_generators/merb/templates/config/router.rb +4 -1
- data/app_generators/merb/templates/spec/spec_helper.rb +2 -3
- data/lib/autotest/merb_rspec.rb +1 -0
- data/lib/merb/abstract_controller.rb +31 -2
- data/lib/merb/controller.rb +5 -5
- data/lib/merb/core_ext/get_args.rb +5 -1
- data/lib/merb/exceptions.rb +17 -0
- data/lib/merb/generators/merb_app/merb_app.rb +4 -1
- data/lib/merb/generators/merb_plugin.rb +4 -1
- data/lib/merb/logger.rb +5 -1
- data/lib/merb/mail_controller.rb +1 -1
- data/lib/merb/mailer.rb +2 -2
- data/lib/merb/mixins/controller.rb +5 -1
- data/lib/merb/mixins/render.rb +57 -27
- data/lib/merb/part_controller.rb +1 -1
- data/lib/merb/request.rb +2 -2
- data/lib/merb/server.rb +33 -5
- data/lib/merb/template/erubis.rb +1 -1
- data/lib/merb.rb +15 -5
- data/merb_generators/resource/resource_generator.rb +9 -2
- data/spec/fixtures/config/merb.yml +18 -0
- data/spec/fixtures/controllers/dispatch_spec_controllers.rb +227 -0
- data/spec/fixtures/controllers/render_spec_controllers.rb +115 -0
- data/spec/fixtures/foo.rb +3 -0
- data/spec/fixtures/mailers/views/layout/application.html.erb +3 -0
- data/spec/fixtures/mailers/views/layout/application.text.erb +3 -0
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.html.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.text.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/first.html.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/first.text.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.html.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.text.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/second.text.erb +1 -0
- data/spec/fixtures/mailers/views/test_mail_controller/third.html.erb +1 -0
- data/spec/fixtures/models/router_spec_models.rb +20 -0
- data/spec/fixtures/parts/views/layout/todo_part.html.erb +3 -0
- data/spec/fixtures/parts/views/layout/todo_part.xml.erb +3 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/list.html.erb +3 -0
- data/spec/fixtures/sample.txt +1 -0
- data/spec/fixtures/views/erubis.html.erb +1 -0
- data/spec/fixtures/views/examples/_erubis.html.erb +1 -0
- data/spec/fixtures/views/examples/_haml.html.haml +1 -0
- data/spec/fixtures/views/examples/_markaby.html.mab +1 -0
- data/spec/fixtures/views/examples/_throw_content.html.erb +6 -0
- data/spec/fixtures/views/examples/hello.xml.builder +1 -0
- data/spec/fixtures/views/examples/js.js.erb +1 -0
- data/spec/fixtures/views/examples/template_catch_content.html.erb +15 -0
- data/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb +6 -0
- data/spec/fixtures/views/examples/template_throw_content.html.erb +10 -0
- data/spec/fixtures/views/exceptions/admin_access_required.html.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/_nested_js.js.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/_nested_xml.xml.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/erubis_templates.html.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/erubis_templates.js.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/erubis_templates.rhtml +1 -0
- data/spec/fixtures/views/extension_template_controller/erubis_templates.xml.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/haml_index.html.haml +0 -0
- data/spec/fixtures/views/extension_template_controller/haml_templates.html.haml +1 -0
- data/spec/fixtures/views/extension_template_controller/haml_templates.js.haml +1 -0
- data/spec/fixtures/views/extension_template_controller/haml_templates.xml.haml +1 -0
- data/spec/fixtures/views/extension_template_controller/index.html.erb +0 -0
- data/spec/fixtures/views/extension_template_controller/markaby_index.html.mab +0 -0
- data/spec/fixtures/views/extension_template_controller/markaby_templates.html.mab +1 -0
- data/spec/fixtures/views/extension_template_controller/markaby_templates.js.mab +1 -0
- data/spec/fixtures/views/extension_template_controller/markaby_templates.xml.mab +1 -0
- data/spec/fixtures/views/extension_template_controller/render_multiple_partials.html.erb +4 -0
- data/spec/fixtures/views/extension_template_controller/render_nested_js.js.erb +1 -0
- data/spec/fixtures/views/extension_template_controller/render_nested_xml.xml.erb +1 -0
- data/spec/fixtures/views/haml.html.haml +1 -0
- data/spec/fixtures/views/haml.xml.haml +2 -0
- data/spec/fixtures/views/layout/application.html.erb +1 -0
- data/spec/fixtures/views/layout/application.xml.erb +1 -0
- data/spec/fixtures/views/layout/nested/example.html.erb +1 -0
- data/spec/fixtures/views/markaby.html.mab +1 -0
- data/spec/fixtures/views/nested/example/test.html.erb +1 -0
- data/spec/fixtures/views/partials/_erubis.html.erb +1 -0
- data/spec/fixtures/views/partials/_erubis_collection.html.erb +1 -0
- data/spec/fixtures/views/partials/_erubis_collection_with_locals.html.erb +1 -0
- data/spec/fixtures/views/partials/_erubis_new.html.erb +1 -0
- data/spec/fixtures/views/partials/_haml.html.haml +1 -0
- data/spec/fixtures/views/partials/_haml_collection.html.haml +1 -0
- data/spec/fixtures/views/partials/_haml_collection_with_locals.html.haml +1 -0
- data/spec/fixtures/views/partials/_haml_new.html.haml +1 -0
- data/spec/fixtures/views/partials/_markaby.html.mab +1 -0
- data/spec/fixtures/views/partials/_markaby_collection.html.mab +1 -0
- data/spec/fixtures/views/partials/_markaby_collection_with_locals.html.mab +1 -0
- data/spec/fixtures/views/partials/_markaby_new.html.mab +1 -0
- data/spec/fixtures/views/render_object_controller/render_object_with_template.html.erb +1 -0
- data/spec/fixtures/views/render_object_controller/render_object_with_template.js.erb +1 -0
- data/spec/fixtures/views/render_object_controller/render_object_with_template.xml.erb +1 -0
- data/spec/fixtures/views/template_views/interface__buffer_erubis.html.erb +4 -0
- data/spec/fixtures/views/template_views/interface__buffer_haml.html.haml +7 -0
- data/spec/fixtures/views/template_views/interface__buffer_markaby.html.mab +7 -0
- data/spec/fixtures/views/template_views/interface_capture_erubis.html.erb +15 -0
- data/spec/fixtures/views/template_views/interface_capture_haml.html.haml +15 -0
- data/spec/fixtures/views/template_views/interface_capture_markaby.html.mab +4 -0
- data/spec/fixtures/views/template_views/interface_concat_erubis.html.erb +12 -0
- data/spec/fixtures/views/template_views/interface_concat_haml.html.haml +11 -0
- data/spec/fixtures/views/template_views/interface_concat_markaby.html.mab +14 -0
- data/spec/fixtures/views/test.dir/the_template.html.erb +1 -0
- data/spec/merb/abstract_controller_spec.rb +37 -0
- data/spec/merb/caching_spec.rb +102 -0
- data/spec/merb/config_spec.rb +29 -0
- data/spec/merb/controller_filters_spec.rb +188 -0
- data/spec/merb/controller_spec.rb +144 -0
- data/spec/merb/cookie_store_spec.rb +85 -0
- data/spec/merb/core_ext_spec.rb +430 -0
- data/spec/merb/dispatch_spec.rb +514 -0
- data/spec/merb/fake_request_spec.rb +72 -0
- data/spec/merb/form_control_mixin_spec.rb +431 -0
- data/spec/merb/generator_spec.rb +121 -0
- data/spec/merb/handler_spec.rb +169 -0
- data/spec/merb/mail_controller_spec.rb +144 -0
- data/spec/merb/mailer_spec.rb +87 -0
- data/spec/merb/multipart_spec.rb +49 -0
- data/spec/merb/part_controller_spec.rb +92 -0
- data/spec/merb/plugins_spec.rb +80 -0
- data/spec/merb/render_spec.rb +378 -0
- data/spec/merb/request_spec.rb +243 -0
- data/spec/merb/responder_spec.rb +561 -0
- data/spec/merb/router_spec.rb +726 -0
- data/spec/merb/template_spec.rb +41 -0
- data/spec/merb/upload_handler_spec.rb +101 -0
- data/spec/merb/view_context_spec.rb +148 -0
- data/spec/spec_generator_helper.rb +19 -0
- data/spec/spec_helper.rb +88 -0
- metadata +203 -65
- data/lib/merb/caching/store/memcache.rb +0 -20
- data/script/destroy +0 -14
- data/script/generate +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_html_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_js_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_xml_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is a text file with some small content in it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= "Hello!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= "Hello!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= "Hello!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"Hello!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xml.hello "world"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
new Ajax.Request("<%= :embedded_ruby_symbol %>");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% throw_content :header do %>
|
|
2
|
+
CAUGHT CONTENT
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% throw_content :footer do %>
|
|
6
|
+
CAUGHT FOOTER
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
START HEADER
|
|
10
|
+
<%= catch_content :header -%>
|
|
11
|
+
END HEADER
|
|
12
|
+
|
|
13
|
+
START FOOTER
|
|
14
|
+
<%= catch_content :footer -%>
|
|
15
|
+
END FOOTER
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= "An Error Occurred!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nested_js_partial
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nested_xml_partial
|
data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= count %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= partial( "nested_js" )%>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= partial("nested_xml") %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= "Hello!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= catch_content :layout %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= catch_content :layout %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= catch_content :layout %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"Hello!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= "Hello!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= respond_to?(:yo) ? yo : "No Locals!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= erubis_collection %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= number %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= respond_to?(:yo) ? yo : "No Locals!" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= respond_to?(:yo) && yo ? yo : "No Locals!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= haml_collection
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= number
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= respond_to?(:yo) && yo ? yo : "No Locals!"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"#{defined?(yo) && yo ? yo : "No Locals!"}"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"#{markaby_collection}\n"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"#{number}\n"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"#{defined?(yo) && yo ? yo : "No Locals!"}"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
object with template html format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
object with template js format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
object with template xml format
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% @foo = capture do %>
|
|
2
|
+
Capture Text Without Args
|
|
3
|
+
<% end %>
|
|
4
|
+
<%= @foo %>
|
|
5
|
+
|
|
6
|
+
<% @struct = Struct.new( :value ) -%>
|
|
7
|
+
<% @obj = @struct.new( "capture text from yielded object" )%>
|
|
8
|
+
|
|
9
|
+
<% @foo2 = capture( @obj ) do |obj| %>
|
|
10
|
+
BEFORE
|
|
11
|
+
<%= obj.value %>
|
|
12
|
+
AFTER
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<%= @foo2 %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Test the Concat Helper
|
|
2
|
+
<% concat( "Concat Text", binding ) -%>
|
|
3
|
+
|
|
4
|
+
<% def tester( &block ) -%>
|
|
5
|
+
<% concat( "Start Tester Block", block.binding ) %>
|
|
6
|
+
<% yield %>
|
|
7
|
+
<% concat( "Finish Tester Block", block.binding ) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<% tester do %>
|
|
11
|
+
In Tester Block
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
p do
|
|
2
|
+
"Test the Concat Helper"
|
|
3
|
+
concat( "Concat Text", binding )
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def tester_helper( &block )
|
|
7
|
+
concat( "Start Tester Block", block.binding )
|
|
8
|
+
yield
|
|
9
|
+
concat( "Finish Tester Block", block.binding )
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
tester_helper do
|
|
13
|
+
text "In Tester Block"
|
|
14
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Merb::AbstractController do
|
|
4
|
+
|
|
5
|
+
before(:all) do
|
|
6
|
+
@abc = Merb::AbstractController
|
|
7
|
+
@template = "/my/template/path/file.html.erb"
|
|
8
|
+
@key = "/my/template/path/file.html"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
@abc.reset_template_path_cache!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after(:all) do
|
|
16
|
+
Merb::Server.load_controller_template_path_cache
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should add a template path" do
|
|
20
|
+
@abc.add_path_to_template_cache(@template)
|
|
21
|
+
@abc._template_path_cache.should include(@key)
|
|
22
|
+
@abc._template_path_cache[@key].should == @template
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should reset the template_path_cache" do
|
|
26
|
+
@abc.add_path_to_template_cache(@template)
|
|
27
|
+
@abc._template_path_cache.should_not be_empty
|
|
28
|
+
@abc.reset_template_path_cache!
|
|
29
|
+
@abc._template_path_cache.should be_empty
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should return false if the template is the wrong format when adding" do
|
|
33
|
+
@abc.add_path_to_template_cache("/my/path/to/template.rhtml").should == false
|
|
34
|
+
@abc._template_path_cache.should_not include( "/my/path/to/template.rhtml")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "all fragment caching", :shared => true do
|
|
4
|
+
|
|
5
|
+
it "should be able to store and retrieve a key" do
|
|
6
|
+
@c.put(:foo, "Bar")
|
|
7
|
+
@c.get(:foo).should == "Bar"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should be able to expire a fragment" do
|
|
11
|
+
@c.put(:foo, "Bar")
|
|
12
|
+
@c.get(:foo).should == "Bar"
|
|
13
|
+
@c.expire_fragment(:foo)
|
|
14
|
+
@c.get(:foo).should == nil
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should clear the cache on reset" do
|
|
18
|
+
@c.put(:foo, "Bar")
|
|
19
|
+
@c.get(:foo).should == "Bar"
|
|
20
|
+
@c.clear
|
|
21
|
+
@c.get(:foo).should == nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should be ok to clear the cache twice" do
|
|
25
|
+
@c.clear
|
|
26
|
+
@c.clear
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should accept keys and subkeys" do
|
|
30
|
+
@c.put([:user, :joe], "Joe's data")
|
|
31
|
+
@c.get([:user, :joe]).should. == "Joe's data"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should keep subkeys separate" do
|
|
35
|
+
@c.put([:user, :joe], "Joe's data")
|
|
36
|
+
@c.put([:user, :bill], "Bill's data")
|
|
37
|
+
@c.get([:user, :joe]).should == "Joe's data"
|
|
38
|
+
@c.get([:user, :bill]).should == "Bill's data"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should expire a subkey" do
|
|
42
|
+
@c.put([:user, :joe], "Joe's data")
|
|
43
|
+
@c.put([:user, :bill], "Bill's data")
|
|
44
|
+
@c.expire_fragment([:user,:joe])
|
|
45
|
+
@c.get([:user, :joe]).should == nil
|
|
46
|
+
@c.get([:user, :bill]).should == "Bill's data"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should expire a key and all its children when passed an array containing only the top key" do
|
|
50
|
+
@c.put([:user, :joe], "Joe's data")
|
|
51
|
+
@c.put([:user, :bill], "Bill's data")
|
|
52
|
+
@c.expire_fragment([:user])
|
|
53
|
+
@c.get([:user, :joe]).should == nil
|
|
54
|
+
@c.get([:user, :bill]).should == nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should expire a key and all its children when passed only the top key" do
|
|
58
|
+
@c.put([:user, :joe], "Joe's data")
|
|
59
|
+
@c.put([:user, :bill], "Bill's data")
|
|
60
|
+
@c.expire_fragment(:user)
|
|
61
|
+
@c.get([:user, :joe]).should == nil
|
|
62
|
+
@c.get([:user, :bill]).should == nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "should handle arbitrary levels of keys" do
|
|
66
|
+
@c.put([:users, :show, :bob], "Bob's data")
|
|
67
|
+
@c.put([:users, :show, :mary], "Mary's data")
|
|
68
|
+
@c.put([:users, :edit, :bob], "Bob's editable data")
|
|
69
|
+
@c.get([:users, :show, :bob]).should == "Bob's data"
|
|
70
|
+
@c.get([:users, :edit, :bob]).should == "Bob's editable data"
|
|
71
|
+
@c.expire_fragment([:users, :show, :mary])
|
|
72
|
+
@c.get([:users, :show, :mary]).should == nil
|
|
73
|
+
@c.get([:users, :show, :bob]).should == "Bob's data"
|
|
74
|
+
@c.expire_fragment([:users, :show])
|
|
75
|
+
@c.get([:users, :show, :bob]).should == nil
|
|
76
|
+
@c.expire_fragment([:users])
|
|
77
|
+
@c.get([:users, :edit, :bob]).should == nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
describe "fragment caching in memory" do
|
|
85
|
+
before do
|
|
86
|
+
Merb::Server.config['cache_store'] = 'memory'
|
|
87
|
+
@c = Merb::Caching::Fragment
|
|
88
|
+
@c.clear
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it_should_behave_like "all fragment caching"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe "fragment caching to a file" do
|
|
95
|
+
before do
|
|
96
|
+
Merb::Server.config[:cache_store] = 'file'
|
|
97
|
+
@c = Merb::Caching::Fragment
|
|
98
|
+
@c.clear
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it_should_behave_like "all fragment caching"
|
|
102
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Merb::Config do
|
|
4
|
+
before(:all) do
|
|
5
|
+
@config_yml = File.expand_path(File.dirname(__FILE__) / ".." / "fixtures")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should have a default configuration" do
|
|
9
|
+
Merb::Config.defaults.should be_is_a(Hash)
|
|
10
|
+
Merb::Config.defaults[:merb_root].should == Dir.pwd
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should not load the config.yml file if it does not exist" do
|
|
14
|
+
Merb::Config.setup.should be_is_a(Hash)
|
|
15
|
+
Merb::Config.setup.should == Merb::Config.defaults
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should load the config.yml file if it exists" do
|
|
19
|
+
Merb::Config.defaults.merge!(:merb_root => @config_yml)
|
|
20
|
+
Merb::Config.setup.should be_is_a(Hash)
|
|
21
|
+
Merb::Config.setup[:host].should == "127.0.0.1"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should accept erb in the config.yml file" do
|
|
25
|
+
Merb::Config.defaults.merge!(:merb_root => @config_yml)
|
|
26
|
+
Merb::Config.setup.should be_is_a(Hash)
|
|
27
|
+
Merb::Config.setup[:environment].should == "test"
|
|
28
|
+
end
|
|
29
|
+
end
|