merb 0.5.3 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +0 -20
- data/README +0 -277
- data/Rakefile +80 -199
- data/TODO +0 -3
- metadata +19 -438
- data/SVN_REVISION +0 -1
- data/app_generators/merb/USAGE +0 -5
- data/app_generators/merb/merb_generator.rb +0 -108
- data/app_generators/merb/templates/Rakefile +0 -124
- data/app_generators/merb/templates/app/controllers/application.rb +0 -3
- data/app_generators/merb/templates/app/controllers/exceptions.rb +0 -13
- data/app_generators/merb/templates/app/helpers/global_helper.rb +0 -5
- data/app_generators/merb/templates/app/mailers/views/layout/application.html.erb +0 -1
- data/app_generators/merb/templates/app/mailers/views/layout/application.text.erb +0 -1
- data/app_generators/merb/templates/app/parts/views/layout/application.html.erb +0 -1
- data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +0 -216
- data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +0 -38
- data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +0 -40
- data/app_generators/merb/templates/app/views/layout/application.html.erb +0 -11
- data/app_generators/merb/templates/config/boot.rb +0 -11
- data/app_generators/merb/templates/config/dependencies.rb +0 -41
- data/app_generators/merb/templates/config/environments/development.rb +0 -1
- data/app_generators/merb/templates/config/environments/production.rb +0 -1
- data/app_generators/merb/templates/config/environments/test.rb +0 -1
- data/app_generators/merb/templates/config/merb.yml +0 -82
- data/app_generators/merb/templates/config/merb_init.rb +0 -17
- data/app_generators/merb/templates/config/plugins.yml +0 -1
- data/app_generators/merb/templates/config/router.rb +0 -35
- data/app_generators/merb/templates/config/upload.conf +0 -0
- data/app_generators/merb/templates/public/images/merb.jpg +0 -0
- data/app_generators/merb/templates/public/merb.fcgi +0 -6
- data/app_generators/merb/templates/public/stylesheets/master.css +0 -119
- data/app_generators/merb/templates/script/destroy +0 -32
- data/app_generators/merb/templates/script/generate +0 -32
- data/app_generators/merb/templates/script/stop_merb +0 -13
- data/app_generators/merb/templates/script/win_script.cmd +0 -1
- data/app_generators/merb/templates/spec/spec.opts +0 -6
- data/app_generators/merb/templates/spec/spec_helper.rb +0 -15
- data/app_generators/merb/templates/test/test_helper.rb +0 -14
- data/app_generators/merb_plugin/USAGE +0 -5
- data/app_generators/merb_plugin/merb_plugin_generator.rb +0 -68
- data/app_generators/merb_plugin/templates/LICENSE +0 -20
- data/app_generators/merb_plugin/templates/README +0 -4
- data/app_generators/merb_plugin/templates/Rakefile +0 -35
- data/app_generators/merb_plugin/templates/TODO +0 -5
- data/app_generators/merb_plugin/templates/merbtasks.rb +0 -6
- data/app_generators/merb_plugin/templates/sampleplugin.rb +0 -10
- data/app_generators/merb_plugin/templates/sampleplugin_spec.rb +0 -7
- data/app_generators/merb_plugin/templates/spec_helper.rb +0 -2
- data/bin/merb +0 -4
- data/lib/autotest/discover.rb +0 -3
- data/lib/autotest/merb_rspec.rb +0 -80
- data/lib/merb.rb +0 -188
- data/lib/merb/abstract_controller.rb +0 -399
- data/lib/merb/assets.rb +0 -160
- data/lib/merb/assets.rb.orig +0 -119
- data/lib/merb/boot_loader.rb +0 -286
- data/lib/merb/boot_loader.rb.orig +0 -235
- data/lib/merb/caching.rb +0 -5
- data/lib/merb/caching/action_cache.rb +0 -92
- data/lib/merb/caching/fragment_cache.rb +0 -39
- data/lib/merb/caching/store/file_cache.rb +0 -90
- data/lib/merb/caching/store/memory_cache.rb +0 -85
- data/lib/merb/config.rb +0 -290
- data/lib/merb/constants.rb +0 -50
- data/lib/merb/controller.rb +0 -220
- data/lib/merb/cookies.rb +0 -95
- data/lib/merb/core_ext.rb +0 -15
- data/lib/merb/core_ext/array.rb +0 -0
- data/lib/merb/core_ext/class.rb +0 -180
- data/lib/merb/core_ext/enumerable.rb +0 -49
- data/lib/merb/core_ext/get_args.rb +0 -76
- data/lib/merb/core_ext/hash.rb +0 -306
- data/lib/merb/core_ext/inflections.rb +0 -112
- data/lib/merb/core_ext/inflector.rb +0 -275
- data/lib/merb/core_ext/kernel.rb +0 -242
- data/lib/merb/core_ext/mash.rb +0 -88
- data/lib/merb/core_ext/module.rb +0 -67
- data/lib/merb/core_ext/numeric.rb +0 -72
- data/lib/merb/core_ext/object.rb +0 -183
- data/lib/merb/core_ext/string.rb +0 -53
- data/lib/merb/core_ext/symbol.rb +0 -6
- data/lib/merb/dispatcher.rb +0 -109
- data/lib/merb/drb_server.rb +0 -19
- data/lib/merb/erubis_ext.rb +0 -10
- data/lib/merb/exceptions.rb +0 -192
- data/lib/merb/generators/merb_app/merb_app.rb +0 -22
- data/lib/merb/generators/merb_generator_helpers.rb +0 -318
- data/lib/merb/generators/merb_plugin.rb +0 -22
- data/lib/merb/logger.rb +0 -78
- data/lib/merb/mail_controller.rb +0 -268
- data/lib/merb/mailer.rb +0 -87
- data/lib/merb/mixins/basic_authentication.rb +0 -35
- data/lib/merb/mixins/controller.rb +0 -160
- data/lib/merb/mixins/erubis_capture.rb +0 -68
- data/lib/merb/mixins/general_controller.rb +0 -253
- data/lib/merb/mixins/inline_partial.rb +0 -32
- data/lib/merb/mixins/render.rb +0 -465
- data/lib/merb/mixins/responder.rb +0 -449
- data/lib/merb/mixins/view_context.rb +0 -558
- data/lib/merb/mixins/web_controller.rb +0 -36
- data/lib/merb/mongrel_handler.rb +0 -168
- data/lib/merb/part_controller.rb +0 -29
- data/lib/merb/plugins.rb +0 -16
- data/lib/merb/rack_adapter.rb +0 -37
- data/lib/merb/request.rb +0 -465
- data/lib/merb/router.rb +0 -646
- data/lib/merb/server.rb +0 -169
- data/lib/merb/session.rb +0 -23
- data/lib/merb/session/cookie_store.rb +0 -118
- data/lib/merb/session/mem_cache_session.rb +0 -131
- data/lib/merb/session/memory_session.rb +0 -176
- data/lib/merb/template.rb +0 -37
- data/lib/merb/template/erubis.rb +0 -68
- data/lib/merb/template/haml.rb +0 -87
- data/lib/merb/template/markaby.rb +0 -59
- data/lib/merb/template/xml_builder.rb +0 -50
- data/lib/merb/test/fake_request.rb +0 -74
- data/lib/merb/test/helper.rb +0 -260
- data/lib/merb/test/hpricot.rb +0 -136
- data/lib/merb/test/multipart.rb +0 -66
- data/lib/merb/test/rspec.rb +0 -18
- data/lib/merb/test/rspec_matchers/controller_matchers.rb +0 -117
- data/lib/merb/test/rspec_matchers/markup_matchers.rb +0 -98
- data/lib/merb/upload_handler.rb +0 -80
- data/lib/merb/upload_progress.rb +0 -48
- data/lib/merb/version.rb +0 -49
- data/lib/merb/view_context.rb +0 -79
- data/lib/tasks.rb +0 -7
- data/lib/tasks/merb.rake +0 -54
- data/merb_default_generators/model/USAGE +0 -0
- data/merb_default_generators/model/model_generator.rb +0 -16
- data/merb_default_generators/model/templates/new_model_template.erb +0 -5
- data/merb_default_generators/resource_controller/USAGE +0 -0
- data/merb_default_generators/resource_controller/resource_controller_generator.rb +0 -26
- data/merb_default_generators/resource_controller/templates/controller.rb +0 -30
- data/merb_default_generators/resource_controller/templates/edit.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/helper.rb +0 -5
- data/merb_default_generators/resource_controller/templates/index.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/new.html.erb +0 -1
- data/merb_default_generators/resource_controller/templates/show.html.erb +0 -1
- data/merb_generators/controller/USAGE +0 -5
- data/merb_generators/controller/controller_generator.rb +0 -16
- data/merb_generators/controller/templates/controller.rb +0 -8
- data/merb_generators/controller/templates/helper.rb +0 -5
- data/merb_generators/controller/templates/index.html.erb +0 -3
- data/merb_generators/part_controller/USAGE +0 -5
- data/merb_generators/part_controller/part_controller_generator.rb +0 -27
- data/merb_generators/part_controller/templates/controller.rb +0 -8
- data/merb_generators/part_controller/templates/helper.rb +0 -5
- data/merb_generators/part_controller/templates/index.html.erb +0 -3
- data/merb_generators/resource/USAGE +0 -0
- data/merb_generators/resource/resource_generator.rb +0 -67
- data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +0 -67
- data/rspec_generators/merb_controller_test/templates/controller_spec.rb +0 -8
- data/rspec_generators/merb_controller_test/templates/edit_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/helper_spec.rb +0 -5
- data/rspec_generators/merb_controller_test/templates/index_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/new_spec.rb +0 -12
- data/rspec_generators/merb_controller_test/templates/show_spec.rb +0 -5
- data/rspec_generators/merb_model_test/merb_model_test_generator.rb +0 -26
- data/rspec_generators/merb_model_test/templates/model_spec_template.erb +0 -7
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/fixtures/config/environments/environment_config_test.yml +0 -1
- data/spec/fixtures/config/merb.yml +0 -18
- data/spec/fixtures/controllers/dispatch_spec_controllers.rb +0 -235
- data/spec/fixtures/controllers/render_spec_controllers.rb +0 -184
- data/spec/fixtures/foo.rb +0 -3
- data/spec/fixtures/mailers/views/layout/application.html.erb +0 -3
- data/spec/fixtures/mailers/views/layout/application.text.erb +0 -3
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/eighth.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/first.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/first.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.html.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/ninth.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/second.text.erb +0 -1
- data/spec/fixtures/mailers/views/test_mail_controller/third.html.erb +0 -1
- data/spec/fixtures/models/router_spec_models.rb +0 -30
- data/spec/fixtures/parts/views/layout/todo_part.html.erb +0 -3
- data/spec/fixtures/parts/views/layout/todo_part.xml.erb +0 -3
- data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +0 -1
- data/spec/fixtures/parts/views/todo_part/list.html.erb +0 -3
- data/spec/fixtures/sample.txt +0 -1
- data/spec/fixtures/views/erubis.html.erb +0 -1
- data/spec/fixtures/views/examples/_erubis.html.erb +0 -1
- data/spec/fixtures/views/examples/_haml.html.haml +0 -1
- data/spec/fixtures/views/examples/_markaby.html.mab +0 -1
- data/spec/fixtures/views/examples/_throw_content.html.erb +0 -6
- data/spec/fixtures/views/examples/hello.xml.builder +0 -1
- data/spec/fixtures/views/examples/js.js.erb +0 -1
- data/spec/fixtures/views/examples/template_catch_content.html.erb +0 -15
- data/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb +0 -6
- data/spec/fixtures/views/examples/template_throw_content.html.erb +0 -10
- data/spec/fixtures/views/examples/template_throw_content_without_block.html.erb +0 -3
- data/spec/fixtures/views/exceptions/admin_access_required.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_nested_js.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_nested_xml.xml.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.html.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.rhtml +0 -1
- data/spec/fixtures/views/extension_template_controller/erubis_templates.xml.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_index.html.haml +0 -0
- data/spec/fixtures/views/extension_template_controller/haml_templates.html.haml +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_templates.js.haml +0 -1
- data/spec/fixtures/views/extension_template_controller/haml_templates.xml.haml +0 -1
- 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 +0 -1
- data/spec/fixtures/views/extension_template_controller/markaby_templates.js.mab +0 -1
- data/spec/fixtures/views/extension_template_controller/markaby_templates.xml.mab +0 -1
- data/spec/fixtures/views/extension_template_controller/render_multiple_partials.html.erb +0 -4
- data/spec/fixtures/views/extension_template_controller/render_nested_js.js.erb +0 -1
- data/spec/fixtures/views/extension_template_controller/render_nested_xml.xml.erb +0 -1
- data/spec/fixtures/views/haml.html.haml +0 -1
- data/spec/fixtures/views/haml.xml.haml +0 -2
- data/spec/fixtures/views/layout/application.html.erb +0 -1
- data/spec/fixtures/views/layout/application.xml.erb +0 -1
- data/spec/fixtures/views/layout/nested/example.html.erb +0 -1
- data/spec/fixtures/views/markaby.html.mab +0 -1
- data/spec/fixtures/views/nested/example/test.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_collection.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_collection_with_locals.html.erb +0 -1
- data/spec/fixtures/views/partials/_erubis_new.html.erb +0 -1
- data/spec/fixtures/views/partials/_haml.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_collection.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_collection_with_locals.html.haml +0 -1
- data/spec/fixtures/views/partials/_haml_new.html.haml +0 -1
- data/spec/fixtures/views/partials/_markaby.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_collection.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_collection_with_locals.html.mab +0 -1
- data/spec/fixtures/views/partials/_markaby_new.html.mab +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.html.erb +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.js.erb +0 -1
- data/spec/fixtures/views/render_object_controller/render_object_with_template.xml.erb +0 -1
- data/spec/fixtures/views/template_views/interface__buffer_erubis.html.erb +0 -4
- data/spec/fixtures/views/template_views/interface__buffer_haml.html.haml +0 -7
- data/spec/fixtures/views/template_views/interface__buffer_markaby.html.mab +0 -7
- data/spec/fixtures/views/template_views/interface_capture_erubis.html.erb +0 -15
- data/spec/fixtures/views/template_views/interface_capture_haml.html.haml +0 -15
- data/spec/fixtures/views/template_views/interface_capture_markaby.html.mab +0 -4
- data/spec/fixtures/views/template_views/interface_concat_erubis.html.erb +0 -12
- data/spec/fixtures/views/template_views/interface_concat_haml.html.haml +0 -11
- data/spec/fixtures/views/template_views/interface_concat_markaby.html.mab +0 -14
- data/spec/fixtures/views/test.dir/the_template.html.erb +0 -1
- data/spec/merb/abstract_controller_spec.rb +0 -38
- data/spec/merb/assets_spec.rb +0 -207
- data/spec/merb/caching_spec.rb +0 -102
- data/spec/merb/config_spec.rb +0 -29
- data/spec/merb/controller_filters_spec.rb +0 -253
- data/spec/merb/controller_spec.rb +0 -126
- data/spec/merb/cookie_store_spec.rb +0 -72
- data/spec/merb/cookies_spec.rb +0 -96
- data/spec/merb/core_ext/class_spec.rb +0 -97
- data/spec/merb/core_ext/enumerable_spec.rb +0 -27
- data/spec/merb/core_ext/hash_spec.rb +0 -251
- data/spec/merb/core_ext/inflector_spec.rb +0 -34
- data/spec/merb/core_ext/kernel_spec.rb +0 -25
- data/spec/merb/core_ext/numeric_spec.rb +0 -26
- data/spec/merb/core_ext/object_spec.rb +0 -47
- data/spec/merb/core_ext/string_spec.rb +0 -22
- data/spec/merb/core_ext/symbol_spec.rb +0 -7
- data/spec/merb/dependency_spec.rb +0 -22
- data/spec/merb/dispatch_spec.rb +0 -528
- data/spec/merb/fake_request_spec.rb +0 -80
- data/spec/merb/generator_spec.rb +0 -248
- data/spec/merb/handler_spec.rb +0 -169
- data/spec/merb/mail_controller_spec.rb +0 -177
- data/spec/merb/mailer_spec.rb +0 -87
- data/spec/merb/multipart_spec.rb +0 -50
- data/spec/merb/part_controller_spec.rb +0 -124
- data/spec/merb/plugins_spec.rb +0 -80
- data/spec/merb/render_spec.rb +0 -469
- data/spec/merb/request_spec.rb +0 -287
- data/spec/merb/responder_spec.rb +0 -562
- data/spec/merb/router_spec.rb +0 -900
- data/spec/merb/server_spec.rb +0 -19
- data/spec/merb/template_spec.rb +0 -41
- data/spec/merb/upload_handler_spec.rb +0 -108
- data/spec/merb/version_spec.rb +0 -33
- data/spec/merb/view_context_spec.rb +0 -366
- data/spec/spec_generator_helper.rb +0 -34
- data/spec/spec_helper.rb +0 -101
- data/spec/spec_helpers/url_shared_behaviour.rb +0 -112
- data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +0 -53
- data/test_unit_generators/merb_controller_test/templates/functional_test.rb +0 -17
- data/test_unit_generators/merb_controller_test/templates/helper_test.rb +0 -9
- data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +0 -29
- data/test_unit_generators/merb_model_test/templates/model_test_unit_template.erb +0 -9
data/lib/merb/template.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Merb
|
2
|
-
module Template
|
3
|
-
autoload :Erubis, 'merb/template/erubis'
|
4
|
-
autoload :Haml, 'merb/template/haml'
|
5
|
-
autoload :Markaby, 'merb/template/markaby'
|
6
|
-
autoload :XMLBuilder, 'merb/template/xml_builder'
|
7
|
-
|
8
|
-
EXTENSIONS = {} unless defined?(EXTENSIONS)
|
9
|
-
|
10
|
-
# lookup the template_extensions for the extname of the filename
|
11
|
-
# you pass. Answers with the engine that matches the extension
|
12
|
-
def self.engine_for(file)
|
13
|
-
engine_for_extension(File.extname(file)[1..-1])
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.engine_for_extension(ext)
|
17
|
-
const_get EXTENSIONS[ext]
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.register_extensions(engine,extensions)
|
21
|
-
raise ArgumentError unless engine.is_a?(Symbol) && extensions.is_a?(Array)
|
22
|
-
extensions.each{ |ext| EXTENSIONS[ext] = engine }
|
23
|
-
end
|
24
|
-
|
25
|
-
# Register the default extensions. They must be here
|
26
|
-
# since the template engines will not be loaded until they
|
27
|
-
# are directly referenced, or a file with their extension is found.
|
28
|
-
# If these are declared inside the template engine then
|
29
|
-
# they will never be found :(
|
30
|
-
register_extensions( :Erubis, %w[erb])
|
31
|
-
register_extensions( :Haml, %w[haml])
|
32
|
-
register_extensions( :Markaby, %w[mab])
|
33
|
-
register_extensions( :XMLBuilder, %w[builder])
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/lib/merb/template/erubis.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
module Merb # :nodoc:
|
2
|
-
module Template # :nodoc:
|
3
|
-
|
4
|
-
class ErubisViewContext < ViewContext
|
5
|
-
include ::Merb::ErubisCaptureMixin
|
6
|
-
include ::Merb::InlinePartialMixin
|
7
|
-
end
|
8
|
-
|
9
|
-
# Module to allow you to use Embedded Ruby templates through Erubis["http://www.kuwata-lab.com/erubis/"].
|
10
|
-
# Your template must end in .herb (HTML and ERb), .jerb (JavaScript ERb), .erb (Embedded Ruby), or .rhtml (Ruby HTML) for Merb to use it.
|
11
|
-
module Erubis
|
12
|
-
class << self
|
13
|
-
|
14
|
-
@@erbs = {}
|
15
|
-
@@mtimes = {}
|
16
|
-
|
17
|
-
def exempt_from_layout? # :nodoc:
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
|
-
# Main method to compile the ERb template.
|
22
|
-
#
|
23
|
-
# In the case of ERb/Erubis, it first checks the template cache for precompiled
|
24
|
-
# templates. If no precompiled version is found, then it compiles the template
|
25
|
-
# by calling <tt>new_eruby_obj</tt>, which will compile the template and return an Erubis
|
26
|
-
# object holding the parsed template.
|
27
|
-
def transform(options = {})
|
28
|
-
opts, text, file, view_context = options.values_at(:opts, :text, :file, :view_context)
|
29
|
-
eruby = text ? ::Erubis::MEruby.new(text) : new_eruby_obj(file)
|
30
|
-
eruby.evaluate(view_context)
|
31
|
-
end
|
32
|
-
|
33
|
-
def view_context_klass
|
34
|
-
ErubisViewContext
|
35
|
-
end
|
36
|
-
|
37
|
-
# Creates a new Erubis object to parse the template given in +path+.
|
38
|
-
def new_eruby_obj(path)
|
39
|
-
if @@erbs[path] && Merb.environment == 'production'
|
40
|
-
return @@erbs[path]
|
41
|
-
else
|
42
|
-
begin
|
43
|
-
eruby = ::Erubis::MEruby.new(IO.read(path))
|
44
|
-
eruby.init_evaluator :filename => path
|
45
|
-
if cache_template?(path)
|
46
|
-
@@erbs[path], @@mtimes[path] = eruby, Time.now
|
47
|
-
end
|
48
|
-
eruby
|
49
|
-
rescue Errno::ENOENT
|
50
|
-
raise "No template found at path: #{path}"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
def cache_template?(path)
|
57
|
-
return false unless ::Merb::Config[:cache_templates]
|
58
|
-
return true unless @@erbs[path]
|
59
|
-
@@mtimes[path] < File.mtime(path) ||
|
60
|
-
(File.symlink?(path) && (@@mtimes[path] < File.lstat(path).mtime))
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
data/lib/merb/template/haml.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'haml/engine'
|
3
|
-
rescue LoadError
|
4
|
-
puts "you must install the haml gem to use .haml templates"
|
5
|
-
end
|
6
|
-
require File.join( File.dirname(__FILE__), "..", "template")
|
7
|
-
|
8
|
-
module Haml
|
9
|
-
module Helpers
|
10
|
-
|
11
|
-
def _buffer( binding )
|
12
|
-
@_buffer = eval( "_erbout", binding )
|
13
|
-
end
|
14
|
-
|
15
|
-
alias_method :capture, :capture_haml
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module Merb
|
21
|
-
module Template
|
22
|
-
|
23
|
-
class HamlViewContext < ViewContext
|
24
|
-
include ::Merb::InlinePartialMixin
|
25
|
-
end
|
26
|
-
|
27
|
-
module Haml
|
28
|
-
|
29
|
-
class << self
|
30
|
-
|
31
|
-
@@hamls ||= {}
|
32
|
-
@@mtimes ||= {}
|
33
|
-
|
34
|
-
def exempt_from_layout?
|
35
|
-
false
|
36
|
-
end
|
37
|
-
|
38
|
-
def transform(options = {})
|
39
|
-
opts, text, file, view_context = options.values_at(:opts, :text, :file, :view_context)
|
40
|
-
|
41
|
-
begin
|
42
|
-
|
43
|
-
# Merb handles the locals
|
44
|
-
opts.delete(:locals)
|
45
|
-
|
46
|
-
template = text ? text : load_template(file)
|
47
|
-
|
48
|
-
haml = ::Haml::Engine.new(template, opts)
|
49
|
-
haml.to_html(view_context)
|
50
|
-
rescue
|
51
|
-
# ::Haml::Engine often inserts a bogus "(haml):#{line_number}" entry in the backtrace.
|
52
|
-
# Let's replace it with the path of the actual template
|
53
|
-
$@[0].sub! /\(haml\)/, file
|
54
|
-
raise # Raise the exception again
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def view_context_klass
|
59
|
-
HamlViewContext
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
def load_template(file)
|
64
|
-
template = ""
|
65
|
-
if @@hamls[file] && !cache_template?(file)
|
66
|
-
template = @@hamls[file]
|
67
|
-
else
|
68
|
-
template = IO.read(file)
|
69
|
-
if cache_template?(file)
|
70
|
-
@@hamls[file], @@mtimes[file] = template, Time.now
|
71
|
-
end
|
72
|
-
return template
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def cache_template?(path)
|
77
|
-
return false unless ::Merb::Config[:cache_templates]
|
78
|
-
return true unless @@hamls[path]
|
79
|
-
@@mtimes[path] < File.mtime(path) ||
|
80
|
-
(File.symlink?(path) && (@@mtimes[path] < File.lstat(path).mtime))
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'markaby'
|
3
|
-
rescue LoadError
|
4
|
-
puts "you must install the markaby gem to use .mab templates"
|
5
|
-
end
|
6
|
-
|
7
|
-
module Markaby
|
8
|
-
class Builder
|
9
|
-
def _buffer( binding )
|
10
|
-
eval( "_erbout", binding )
|
11
|
-
end
|
12
|
-
|
13
|
-
def concat( string, binding )
|
14
|
-
_buffer( binding ) << string
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Merb
|
20
|
-
|
21
|
-
module Template
|
22
|
-
module Markaby
|
23
|
-
class << self
|
24
|
-
|
25
|
-
def exempt_from_layout?
|
26
|
-
false
|
27
|
-
end
|
28
|
-
|
29
|
-
# OPTIMIZE : add mab template caching. what does this mean for mab?
|
30
|
-
# mab is just ruby, there's no two phase compile and run
|
31
|
-
def transform(options = {})
|
32
|
-
opts, text, file, view_context = options.values_at(:opts, :text, :file, :view_context)
|
33
|
-
|
34
|
-
if opts[:locals]
|
35
|
-
locals = ""
|
36
|
-
opts[:locals].keys.each do |key|
|
37
|
-
locals << "#{key} = @_merb_partial_locals[:#{key}]\n"
|
38
|
-
end
|
39
|
-
locals
|
40
|
-
end
|
41
|
-
|
42
|
-
template = text ? text : File.read(file)
|
43
|
-
mab = ::Markaby::Builder.new({}, view_context) {
|
44
|
-
instance_eval("#{locals}#{template}")
|
45
|
-
}
|
46
|
-
mab.to_s
|
47
|
-
end
|
48
|
-
|
49
|
-
def view_context_klass
|
50
|
-
::Merb::ViewContext
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'builder'
|
3
|
-
rescue LoadError
|
4
|
-
puts "you must install the builder gem to use .rxml templates"
|
5
|
-
end
|
6
|
-
|
7
|
-
module Merb
|
8
|
-
|
9
|
-
module Template # :nodoc:
|
10
|
-
# A module to allow you to use Builder["http://builder.rubyforge.org/"] templates in your Merb applications.
|
11
|
-
# Your Builder templates must end in .rxml, .xerb, or .builder for Merb to use them.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
module XMLBuilder
|
16
|
-
|
17
|
-
class << self
|
18
|
-
|
19
|
-
def exempt_from_layout? # :nodoc:
|
20
|
-
true
|
21
|
-
end
|
22
|
-
|
23
|
-
# Main method to run the Builder template.
|
24
|
-
#
|
25
|
-
# In Builder's case, it sets the content type and encoding,
|
26
|
-
# executes the Builder template by feeding it to <tt>Builder::XmlMarkup.new</tt>,
|
27
|
-
# then calls <tt>target!</tt> on the<tt>Builder::XmlMarkup</tt> instance to get its XML output.
|
28
|
-
def transform(options = {})
|
29
|
-
opts, text, file, view_context = options.values_at(:opts, :text, :file, :view_context)
|
30
|
-
xml_body = text ? text : IO.read(file)
|
31
|
-
view_context.headers['Content-Type'] ||= 'application/xml'
|
32
|
-
view_context.headers['Encoding'] = 'UTF-8'
|
33
|
-
view_context.instance_eval %{
|
34
|
-
xml = Builder::XmlMarkup.new :indent => 2
|
35
|
-
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
36
|
-
#{xml_body}
|
37
|
-
return xml.target!
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def view_context_klass
|
42
|
-
::Merb::ViewContext
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
module Merb
|
4
|
-
module Test
|
5
|
-
# FakeRequest sets up a default enviroment which can be overridden either
|
6
|
-
# by passing and env into initialize or using request['HTTP_VAR'] = 'foo'
|
7
|
-
class FakeRequest < Request
|
8
|
-
attr_reader :req
|
9
|
-
alias :body :req
|
10
|
-
alias :params :env
|
11
|
-
alias :to_hash :env
|
12
|
-
|
13
|
-
def initialize(env = {}, req = StringIO.new)
|
14
|
-
env[:http_cookie] = env.delete(:cookies) if env[:cookies]
|
15
|
-
env.environmentize_keys!
|
16
|
-
|
17
|
-
r = OpenStruct.new
|
18
|
-
r.params = DEFAULT_ENV.dup.merge(env)
|
19
|
-
r.body = req
|
20
|
-
super(r)
|
21
|
-
self.post_body = ''
|
22
|
-
@session = {}
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.with(path, options = {})
|
26
|
-
options.merge!(:QUERY_STRING => path.split("?")[1])
|
27
|
-
options.environmentize_keys!
|
28
|
-
new({'REQUEST_URI' => path,
|
29
|
-
'PATH_INFO' => path.sub(/\?.*$/,'')}.merge(options))
|
30
|
-
end
|
31
|
-
|
32
|
-
def post_body=(post)
|
33
|
-
@req = StringIO.new(post)
|
34
|
-
end
|
35
|
-
|
36
|
-
def session
|
37
|
-
@session
|
38
|
-
end
|
39
|
-
|
40
|
-
def [](key)
|
41
|
-
@env[key]
|
42
|
-
end
|
43
|
-
|
44
|
-
def []=(key, value)
|
45
|
-
@env[key] = value
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
DEFAULT_ENV = Mash.new({
|
50
|
-
'SERVER_NAME' => 'localhost',
|
51
|
-
'PATH_INFO' => '/',
|
52
|
-
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
|
53
|
-
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0',
|
54
|
-
'SCRIPT_NAME' => '/',
|
55
|
-
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
56
|
-
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
57
|
-
'HTTP_ACCEPT_LANGUAGE' => 'en,ja;q=0.9,fr;q=0.9,de;q=0.8,es;q=0.7,it;q=0.7,nl;q=0.6,sv;q=0.5,nb;q=0.5,da;q=0.4,fi;q=0.3,pt;q=0.3,zh-Hans;q=0.2,zh-Hant;q=0.1,ko;q=0.1',
|
58
|
-
'HTTP_HOST' => 'localhost',
|
59
|
-
'REMOTE_ADDR' => '127.0.0.1',
|
60
|
-
'SERVER_SOFTWARE' => 'Mongrel 1.1',
|
61
|
-
'HTTP_KEEP_ALIVE' => '300',
|
62
|
-
'HTTP_REFERER' => 'http://localhost/',
|
63
|
-
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
|
64
|
-
'HTTP_VERSION' => 'HTTP/1.1',
|
65
|
-
'REQUEST_URI' => '/',
|
66
|
-
'SERVER_PORT' => '80',
|
67
|
-
'GATEWAY_INTERFACE' => 'CGI/1.2',
|
68
|
-
'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
|
69
|
-
'HTTP_CONNECTION' => 'keep-alive',
|
70
|
-
'REQUEST_METHOD' => 'GET'
|
71
|
-
}) unless defined?(DEFAULT_ENV)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
data/lib/merb/test/helper.rb
DELETED
@@ -1,260 +0,0 @@
|
|
1
|
-
require 'merb/test/fake_request'
|
2
|
-
require 'merb/test/hpricot'
|
3
|
-
require 'merb/test/multipart'
|
4
|
-
include HpricotTestHelper
|
5
|
-
|
6
|
-
module Merb
|
7
|
-
module Test
|
8
|
-
module Helper
|
9
|
-
include Merb::GeneralControllerMixin
|
10
|
-
|
11
|
-
# Create a FakeRequest suitable for passing to Controller.build
|
12
|
-
def fake_request(params = {})
|
13
|
-
method = method.to_s.upcase
|
14
|
-
Merb::Test::FakeRequest.with("/", {:request_method => "GET"}.merge(params))
|
15
|
-
end
|
16
|
-
|
17
|
-
# For integration/functional testing
|
18
|
-
#
|
19
|
-
# This helper is the basis of the <tt>get</tt>, <tt>post</tt>, <tt>put</tt>, and <tt>delete</tt> helper
|
20
|
-
#
|
21
|
-
# By default a fake request is yielded to the block for local modification.
|
22
|
-
# +opts+ takes any options that you want pass to the methods, plus some reserved ones
|
23
|
-
#
|
24
|
-
# ===Yielding
|
25
|
-
# You can get the request helper to yield either a fake request object, or a controller
|
26
|
-
# Do this with the +:yield+ option. Values can be +:request+, or +:controller+. +:request+ is default
|
27
|
-
# When you yield the controller, it is available inside the block with the controller method, so you don't need to
|
28
|
-
# explicitly set it in the block chute.
|
29
|
-
# ====Example
|
30
|
-
# request( :get, '/', :yields => :controller) do |controller|
|
31
|
-
# controller.stub!(:render)
|
32
|
-
# end
|
33
|
-
#
|
34
|
-
# You can also pass in a fake request object which may be useful if your yielding a controller.
|
35
|
-
# Use the opts[:fake_request] to do this.
|
36
|
-
# ====Example
|
37
|
-
# request( :get, '/', :yields => :controller, :fake_request => @my_fake_request) do
|
38
|
-
# controller.stub!(:render)
|
39
|
-
# end
|
40
|
-
def request(verb, path, opts = {}, &block)
|
41
|
-
response = StringIO.new
|
42
|
-
|
43
|
-
yield_to_controller = opts.delete(:yields)
|
44
|
-
|
45
|
-
request = opts.delete(:fake_request) || Merb::Test::FakeRequest.with(path_with_options(path, opts), :request_method => (verb.to_s.upcase rescue 'GET'))
|
46
|
-
|
47
|
-
if yield_to_controller == :controller
|
48
|
-
request_yielding_controller(request, response, &block)
|
49
|
-
else
|
50
|
-
request_yielding_request(request, response, &block)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Makes a get request routed to +path+ with any options encoded into the
|
55
|
-
# request url
|
56
|
-
# Example
|
57
|
-
# {{{
|
58
|
-
# get "/users", :user => {:login => "dave", :email => "email@example.com"}
|
59
|
-
# }}}
|
60
|
-
def get(path, opts = {}, &block)
|
61
|
-
request("GET", path, opts, &block)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Makes a post request routed to +path+ with any options encoded into the
|
65
|
-
# request url
|
66
|
-
# Example
|
67
|
-
# {{{
|
68
|
-
# post "/users", :user => {:login => "dave", :email => "email@example.com"}
|
69
|
-
# }}}
|
70
|
-
def post(path, opts = {}, &block)
|
71
|
-
request("POST",path, opts, &block)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Makes a put request routed to +path+ with any options encoded into the
|
75
|
-
# request url
|
76
|
-
# Example
|
77
|
-
# {{{
|
78
|
-
# put "/users/1", :user => {:login => "dave", :email => "email@example.com"}
|
79
|
-
# }}}
|
80
|
-
def put(path,opts = {}, &block)
|
81
|
-
request("PUT",path, opts, &block)
|
82
|
-
end
|
83
|
-
|
84
|
-
# Makes a delete request routed to +path+ with any options encoded into the request url
|
85
|
-
# Example
|
86
|
-
# {{{
|
87
|
-
# delete "/users/1", :user => {:login => "dave", :email => "email@example.com"}
|
88
|
-
# }}}
|
89
|
-
def delete(path, opts= {}, &block)
|
90
|
-
request("DELETE",path, opts, &block)
|
91
|
-
end
|
92
|
-
|
93
|
-
# Posts multipart form data to a path
|
94
|
-
# pass the +path+ to send and the parameters. For file uploads, just include a file as the option value.
|
95
|
-
# ===Example
|
96
|
-
# multipart_post("/my_collection", :foo => "bar", :user => { :login => "joe", :image => File.open("my_image.png")})
|
97
|
-
def multipart_post(path, params = {}, &block)
|
98
|
-
multipart_request(path, params.merge!(:request_method => 'POST'), &block)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Posts multipart form data to a path
|
102
|
-
# Same as +multipart_post+ but used for PUT(ting) data to the server
|
103
|
-
def multipart_put(path, params = {}, &block)
|
104
|
-
multipart_request(path, params.merge!(:request_method => 'PUT'), &block)
|
105
|
-
end
|
106
|
-
|
107
|
-
def controller
|
108
|
-
@controller
|
109
|
-
end
|
110
|
-
|
111
|
-
[:body, :status, :params, :cookies, :headers,
|
112
|
-
:session, :response, :route].each do |method|
|
113
|
-
define_method method do
|
114
|
-
controller ? controller.send(method) : nil
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
# Checks that a route is made to the correct controller etc
|
119
|
-
#
|
120
|
-
# === Example
|
121
|
-
# with_route("/pages/1", "PUT") do |params|
|
122
|
-
# params[:controller].should == "pages"
|
123
|
-
# params[:action].should == "update"
|
124
|
-
# params[:id].should == "1"
|
125
|
-
# end
|
126
|
-
def with_route(the_path, _method = "GET")
|
127
|
-
_fake_request = Merb::Test::FakeRequest.with(the_path, :request_method => _method)
|
128
|
-
result = Merb::Router.match(_fake_request, {})
|
129
|
-
yield result[1] if block_given?
|
130
|
-
result
|
131
|
-
end
|
132
|
-
|
133
|
-
def fixtures(*files)
|
134
|
-
files.each do |name|
|
135
|
-
klass = Kernel::const_get(Inflector.classify(Inflector.singularize(name)))
|
136
|
-
entries = YAML::load_file(File.dirname(__FILE__) + "/fixtures/#{name}.yaml")
|
137
|
-
entries.each do |name, entry|
|
138
|
-
klass::create(entry)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
# Dispatches an action to a controller. Defaults to index.
|
145
|
-
# The opts hash, if provided will act as the params hash in the controller
|
146
|
-
# and the params method in the controller is infact the provided opts hash
|
147
|
-
# This controller is based on a fake_request and does not go through the router
|
148
|
-
#
|
149
|
-
# === Simple Example
|
150
|
-
# {{{
|
151
|
-
# controller, result = dispatch_to(Pages, :show, :id => 1, :title => "blah")
|
152
|
-
# }}}
|
153
|
-
#
|
154
|
-
# === Complex Example
|
155
|
-
# By providing a block to the dispatch_to method, the controller may be stubbed or mocked prior to the
|
156
|
-
# actual dispatch action being called.
|
157
|
-
# {{{
|
158
|
-
# controller, result = dispatch_to(Pages, :show, :id => 1) do |controller|
|
159
|
-
# controller.stub!(:render).and_return("rendered response")
|
160
|
-
# end
|
161
|
-
# }}}
|
162
|
-
def dispatch_to(controller, action = :index, opts = {})
|
163
|
-
klass = controller.class == Class ? controller : controller.class
|
164
|
-
@controller = klass.build(fake_request)
|
165
|
-
@controller.stub!(:params).and_return(opts.merge(:controller => klass.name.downcase, :action => action.to_s).to_mash)
|
166
|
-
yield @controller if block_given?
|
167
|
-
[@controller, @controller.dispatch(action.to_sym)]
|
168
|
-
end
|
169
|
-
|
170
|
-
def path_with_options(path, opts)
|
171
|
-
path = path << "?" << params_to_query_string(opts) unless opts.empty?
|
172
|
-
path
|
173
|
-
end
|
174
|
-
|
175
|
-
protected
|
176
|
-
|
177
|
-
def request_yielding_request(request, response, &block)
|
178
|
-
# response = StringIO.new
|
179
|
-
# @request = Merb::Test::FakeRequest.with(path, :request_method => (verb.to_s.upcase rescue 'GET'))
|
180
|
-
@request = request
|
181
|
-
|
182
|
-
yield @request if block_given?
|
183
|
-
|
184
|
-
@controller, @action = Merb::Dispatcher.handle @request, response
|
185
|
-
end
|
186
|
-
|
187
|
-
def request_yielding_controller(request, response, &block)
|
188
|
-
# response = StringIO.new
|
189
|
-
# @request = Merb::Test::FakeRequest.with(path, :request_method => (verb.to_s.upcase rescue 'GET'))
|
190
|
-
@request = Merb::Request.new(request)
|
191
|
-
|
192
|
-
check_request_for_route(@request)
|
193
|
-
|
194
|
-
dispatch_fake_request(@request, response, &block)
|
195
|
-
end
|
196
|
-
|
197
|
-
def multipart_request(path, params = {}, &block)
|
198
|
-
response = StringIO.new
|
199
|
-
request = request_with_multipart_params(path, params)
|
200
|
-
check_request_for_route(request)
|
201
|
-
dispatch_fake_request(request, response, &block)
|
202
|
-
end
|
203
|
-
|
204
|
-
|
205
|
-
def check_request_for_route(request)
|
206
|
-
if request.route_params.empty?
|
207
|
-
raise ControllerExceptions::BadRequest, "No routes match the request"
|
208
|
-
elsif request.controller_name.nil?
|
209
|
-
raise ControllerExceptions::BadRequest, "Route matched, but route did not specify a controller"
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
# Used for yielding a controller with request and multipart helpers
|
214
|
-
def dispatch_fake_request(request, response, status = 200, &block)
|
215
|
-
klass = request.controller_class
|
216
|
-
@controller = klass.build(request, response, status)
|
217
|
-
|
218
|
-
@controller.send(:setup_session)
|
219
|
-
# This will be a mock framework agnostic way of ensuring setup_session is not done again
|
220
|
-
class << @controller
|
221
|
-
def setup_session; true; end
|
222
|
-
end
|
223
|
-
|
224
|
-
yield @controller if block_given?
|
225
|
-
|
226
|
-
@controller.dispatch(request.action)
|
227
|
-
[@controller, request.action]
|
228
|
-
|
229
|
-
rescue => exception
|
230
|
-
exception = Dispatcher.send(:controller_exception, exception)
|
231
|
-
@controller, @action = Dispatcher.send(:dispatch_exception, request, response, exception)
|
232
|
-
end
|
233
|
-
|
234
|
-
def request_with_multipart_params(path, params = {})
|
235
|
-
request_method = params.delete(:request_method) || "GET"
|
236
|
-
request = Merb::Test::FakeRequest.new(:request_uri => path)
|
237
|
-
m = Merb::Test::Multipart::Post.new(params)
|
238
|
-
body, head = m.to_multipart
|
239
|
-
request['REQUEST_METHOD'] = request_method
|
240
|
-
request['CONTENT_TYPE'] = head
|
241
|
-
request['CONTENT_LENGTH'] = body.length
|
242
|
-
request.post_body = body
|
243
|
-
Merb::Request.new(request)
|
244
|
-
end
|
245
|
-
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
class Object
|
251
|
-
# Checks that an object has assigned an instance variable of name
|
252
|
-
# :name
|
253
|
-
#
|
254
|
-
# ===Example in a spec
|
255
|
-
# @my_obj.assings(:my_value).should == @my_value
|
256
|
-
def assigns(attr)
|
257
|
-
self.instance_variable_get("@#{attr}")
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|