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
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
# Must set before requiring generator libs.
|
4
|
-
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
5
|
-
PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
|
6
|
-
app_root = File.join(TMP_ROOT, PROJECT_NAME)
|
7
|
-
if defined?(APP_ROOT)
|
8
|
-
APP_ROOT.replace(app_root)
|
9
|
-
else
|
10
|
-
APP_ROOT = app_root
|
11
|
-
end
|
12
|
-
|
13
|
-
begin
|
14
|
-
require 'rubigen'
|
15
|
-
rescue LoadError
|
16
|
-
require 'rubygems'
|
17
|
-
require 'rubigen'
|
18
|
-
end
|
19
|
-
require 'rubigen/helpers/generator_test_helper'
|
20
|
-
|
21
|
-
|
22
|
-
def directory_should_be_created(directory)
|
23
|
-
File.should be_exist(File.join(APP_ROOT, directory))
|
24
|
-
File.should be_directory(File.join(APP_ROOT, directory))
|
25
|
-
end
|
26
|
-
|
27
|
-
def file_should_be_created(file)
|
28
|
-
File.should be_exist(File.join(APP_ROOT, file))
|
29
|
-
File.should be_file(File.join(APP_ROOT, file))
|
30
|
-
end
|
31
|
-
|
32
|
-
def file_should_be_executable(file)
|
33
|
-
File.should be_executable(File.join(APP_ROOT, file))
|
34
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
$TESTING=true
|
2
|
-
require 'timeout'
|
3
|
-
require 'open-uri'
|
4
|
-
require 'net/http'
|
5
|
-
require 'rubygems'
|
6
|
-
require 'spec'
|
7
|
-
require 'mocha'
|
8
|
-
require 'hpricot'
|
9
|
-
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
10
|
-
$:.push File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'server')
|
11
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'merb', 'config')
|
12
|
-
Merb::Config.setup
|
13
|
-
require 'merb'
|
14
|
-
require 'merb/test/helper'
|
15
|
-
|
16
|
-
FIXTURES = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) unless defined?(FIXTURES)
|
17
|
-
def require_fixtures(path)
|
18
|
-
require File.expand_path(File.join(FIXTURES, path))
|
19
|
-
end
|
20
|
-
|
21
|
-
require File.join(File.dirname(__FILE__), "spec_helpers", "url_shared_behaviour")
|
22
|
-
|
23
|
-
Spec::Runner.configure do |config|
|
24
|
-
config.include(Merb::Test::Helper)
|
25
|
-
config.include(Merb::Test::RspecMatchers)
|
26
|
-
# config.include(Merb::Test::MerbRspecControllerRedirect)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Creates a new controller, e.g.
|
30
|
-
# c = new_controller('index', Examples) do |request|
|
31
|
-
# request.post_body = "blah"
|
32
|
-
# end
|
33
|
-
def new_controller(action = 'index', controller = nil, additional_params = {})
|
34
|
-
request = OpenStruct.new
|
35
|
-
request.params = {:action => action, :controller => (controller.to_s || "Test")}
|
36
|
-
request.params.update(additional_params)
|
37
|
-
request.cookies = {}
|
38
|
-
request.accept ||= '*/*'
|
39
|
-
|
40
|
-
yield request if block_given?
|
41
|
-
|
42
|
-
response = OpenStruct.new
|
43
|
-
response.read = ""
|
44
|
-
(controller || Merb::Controller).build(request, response)
|
45
|
-
end
|
46
|
-
|
47
|
-
class Merb::Controller
|
48
|
-
require "lib/merb/session/memory_session"
|
49
|
-
Merb::MemorySessionContainer.setup
|
50
|
-
include ::Merb::SessionMixin
|
51
|
-
self.session_secret_key = "footo the bar to the baz"
|
52
|
-
end
|
53
|
-
|
54
|
-
class String
|
55
|
-
def clean
|
56
|
-
Hpricot(chomp).to_s
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
# -- Global custom matchers --
|
62
|
-
|
63
|
-
# A better +be_kind_of+ with more informative error messages.
|
64
|
-
#
|
65
|
-
# The default +be_kind_of+ just says
|
66
|
-
#
|
67
|
-
# "expected to return true but got false"
|
68
|
-
#
|
69
|
-
# This one says
|
70
|
-
#
|
71
|
-
# "expected File but got Tempfile"
|
72
|
-
|
73
|
-
class BeKindOf
|
74
|
-
|
75
|
-
def initialize(expected) # + args
|
76
|
-
@expected = expected
|
77
|
-
end
|
78
|
-
|
79
|
-
def matches?(target)
|
80
|
-
@target = target
|
81
|
-
@target.kind_of?(@expected)
|
82
|
-
end
|
83
|
-
|
84
|
-
def failure_message
|
85
|
-
"expected #{@expected} but got #{@target.class}"
|
86
|
-
end
|
87
|
-
|
88
|
-
def negative_failure_message
|
89
|
-
"expected #{@expected} to not be #{@target.class}"
|
90
|
-
end
|
91
|
-
|
92
|
-
def description
|
93
|
-
"be_kind_of #{@target}"
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
def be_kind_of(expected) # + args
|
99
|
-
BeKindOf.new(expected)
|
100
|
-
end
|
101
|
-
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../fixtures/models/router_spec_models')
|
2
|
-
|
3
|
-
describe "class with general url generation", :shared => true do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
Merb::Router.prepare do |r|
|
7
|
-
@resource_routes = r.resources(:blogs)
|
8
|
-
r.resources(:gardens) do |gardens|
|
9
|
-
@nested_resource = gardens.resources :flowers
|
10
|
-
end
|
11
|
-
@test_route = r.match("/the/:place/:goes/here").to(:controller => "Test", :action => "show").name(:test)
|
12
|
-
@default_route = r.default_routes
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
it "should generate a url from a route using a hash" do
|
18
|
-
c = new_url_controller(@test_route, :place => "1")
|
19
|
-
c.url_from_route(@test_route, :goes => "g").should == "/the/1/g/here"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should generate a url from a route using an object" do
|
23
|
-
c = new_url_controller(@test_route, :place => "2")
|
24
|
-
obj = OpenStruct.new(:goes => "elsewhere")
|
25
|
-
c.url_from_route(@test_route, obj).should == "/the/2/elsewhere/here"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should generate a url and tack extra params on as a query string" do
|
29
|
-
c = new_url_controller(@test_route, :place => "1")
|
30
|
-
c.url_from_route(@test_route, :goes => "g", :page => 2).should == "/the/1/g/here?page=2"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should generate a url directly from a hash using the current route as a default" do
|
34
|
-
c = new_url_controller(@test_route, :goes => "swimmingly")
|
35
|
-
c.url(:place => "provo").should == "/the/provo/swimmingly/here"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should generate a default route url with just :controller" do
|
39
|
-
c = new_url_controller(@default_route)
|
40
|
-
c.url(:controller => "welcome").should == "/welcome"
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should generate urls from nested resources' do
|
44
|
-
c = new_url_controller(@nested_resource, :garden => 5)
|
45
|
-
c.url(:flower, :garden_id => 1, :id => 3).should == "/gardens/1/flowers/3"
|
46
|
-
end
|
47
|
-
|
48
|
-
# it "should generate a default route url with an extra param" do
|
49
|
-
# c = new_url_controller(@default_route, :controller => "foo", :action => "bar")
|
50
|
-
# c.url(:controller => :current, :monkey => "quux").should == "/foo/bar?monkey=quux"
|
51
|
-
# end
|
52
|
-
|
53
|
-
it "should generate a default route url with all options" do
|
54
|
-
c = new_url_controller(@default_route, :controller => "foo", :action => "bar")
|
55
|
-
c.url(:controller => "foo", :action => "bar", :id => "baz", :format => :js, :monkey => "quux").should == "/foo/bar/baz.js?monkey=quux"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should handle an object as the second arg" do
|
59
|
-
c = new_url_controller(@resource_routes, :controller => "blogs", :action => "show")
|
60
|
-
blog = Blog.new
|
61
|
-
url = c.url(:blog, blog)
|
62
|
-
url.should == "/blogs/hello42"
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should point to /blogs/:blog_id if @blog is not new_record" do
|
66
|
-
c = new_url_controller(@resource_routes, :controller => "blogs", :action => "index")
|
67
|
-
blog = Blog.new
|
68
|
-
blog.should_receive(:new_record?).once.and_return(false)
|
69
|
-
url = c.url(:blog, blog)
|
70
|
-
url.should == "/blogs/hello42"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should point to /blogs/ if @blog is new_record" do
|
74
|
-
c = new_url_controller(@resource_routes, :controller => "blogs", :action => "index")
|
75
|
-
blog = Blog.new
|
76
|
-
blog.should_receive(:new_record?).once.and_return(true)
|
77
|
-
url = c.url(:blog, blog)
|
78
|
-
url.should == "/blogs/"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "non routeable controller with url mixin", :shared => true do
|
83
|
-
|
84
|
-
before(:all) do
|
85
|
-
Merb::Router.prepare do |r|
|
86
|
-
@resource_routes = r.resources(:blogs)
|
87
|
-
r.resources(:gardens) do |gardens|
|
88
|
-
@nested_resource = gardens.resources :flowers
|
89
|
-
end
|
90
|
-
@test_route = r.match("/the/:place/:goes/here").to(:controller => "Test", :action => "show").name(:test)
|
91
|
-
@default_route = r.default_routes
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should route when given a controller and an action" do
|
96
|
-
c = new_url_controller(@default_route, :controller => "blah")
|
97
|
-
the_url = c.url(:controller => "foo", :action => "bar")
|
98
|
-
the_url.should == "/foo/bar"
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should generate a route when only a controller is given" do
|
102
|
-
c = new_url_controller(@default_route, :controller => "blah")
|
103
|
-
the_url = c.url(:controller => "foo")
|
104
|
-
the_url.should == "/foo"
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should generate a route with controller action and extra options" do
|
108
|
-
c = new_url_controller(@default_route, :controller => "blah")
|
109
|
-
the_url = c.url(:controller => "foo", :action => "bar", :cool => "false")
|
110
|
-
the_url.should == "/foo/bar?cool=false"
|
111
|
-
end
|
112
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'merb'
|
2
|
-
class MerbControllerTestGenerator < RubiGen::Base
|
3
|
-
|
4
|
-
default_options :author => nil
|
5
|
-
|
6
|
-
attr_reader :name, :class_name, :file_name
|
7
|
-
|
8
|
-
def initialize(runtime_args, runtime_options = {})
|
9
|
-
super
|
10
|
-
usage if args.empty?
|
11
|
-
@name = args.shift
|
12
|
-
@class_name = @name.camel_case
|
13
|
-
@file_name = @name.snake_case
|
14
|
-
extract_options
|
15
|
-
end
|
16
|
-
|
17
|
-
def manifest
|
18
|
-
record do |m|
|
19
|
-
m.directory 'test/functional'
|
20
|
-
m.template "functional_test.rb", "test/functional/#{file_name}_test.rb"
|
21
|
-
|
22
|
-
m.directory 'test/helpers'
|
23
|
-
m.template "helper_test.rb", "test/helpers/#{file_name}_helper_test.rb"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
protected
|
28
|
-
def banner
|
29
|
-
<<-EOS
|
30
|
-
Creates a test unit stub for a resource controller
|
31
|
-
|
32
|
-
USAGE: #{$0} #{spec.name} name"
|
33
|
-
EOS
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_options!(opts)
|
37
|
-
# opts.separator ''
|
38
|
-
# opts.separator 'Options:'
|
39
|
-
# For each option below, place the default
|
40
|
-
# at the top of the file next to "default_options"
|
41
|
-
# opts.on("-a", "--author=\"Your Name\"", String,
|
42
|
-
# "Some comment about this option",
|
43
|
-
# "Default: none") { |options[:author]| }
|
44
|
-
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
45
|
-
end
|
46
|
-
|
47
|
-
def extract_options
|
48
|
-
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
49
|
-
# Templates can access these value via the attr_reader-generated methods, but not the
|
50
|
-
# raw instance variable value.
|
51
|
-
# @author = options[:author]
|
52
|
-
end
|
53
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
|
3
|
-
# Re-raise errors caught by the controller.
|
4
|
-
class <%= class_name.pluralize %>; def rescue_action(e) raise e end; end
|
5
|
-
|
6
|
-
class <%= class_name.pluralize %>Test < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def setup
|
9
|
-
@controller = <%= class_name.pluralize %>.build(fake_request)
|
10
|
-
@controller.dispatch('index')
|
11
|
-
end
|
12
|
-
|
13
|
-
# Replace this with your real tests.
|
14
|
-
def test_should_be_setup
|
15
|
-
assert false
|
16
|
-
end
|
17
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'merb/generators/merb_generator_helpers'
|
2
|
-
class MerbModelTestGenerator < Merb::GeneratorHelpers::MerbModelTestGenerator
|
3
|
-
|
4
|
-
def initialize( *args )
|
5
|
-
super( *args )
|
6
|
-
@model_test_template_name = "model_test_unit_template.erb"
|
7
|
-
@model_test_path_name = File.join( "test", "unit" )
|
8
|
-
@model_test_file_suffix = "test"
|
9
|
-
end
|
10
|
-
|
11
|
-
def banner
|
12
|
-
<<-EOS
|
13
|
-
Creates a model Test::Unit stub for use in Merb
|
14
|
-
|
15
|
-
USAGE: #{$0} #{spec.name} NameOfModel
|
16
|
-
Example:
|
17
|
-
#{$0} #{spec.name} project
|
18
|
-
|
19
|
-
|
20
|
-
EOS
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.superclass
|
24
|
-
RubiGen::Base
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class MerbTesterThing
|
29
|
-
end
|