thoughtbot-clearance 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +99 -0
- data/TODO.textile +21 -0
- data/generators/clearance/templates/app/views/sessions/new.html.erb +17 -0
- data/generators/clearance/templates/app/views/user_mailer/change_password.html.erb +6 -0
- data/generators/clearance/templates/app/views/user_mailer/confirmation.html.erb +1 -0
- data/generators/clearance/templates/app/views/users/_form.html.erb +7 -0
- data/generators/clearance/templates/app/views/users/edit.html.erb +4 -0
- data/generators/clearance/templates/app/views/users/new.html.erb +4 -0
- data/generators/clearance/templates/test/functional/confirmations_controller_test.rb +5 -0
- data/generators/clearance/templates/test/functional/passwords_controller_test.rb +5 -0
- data/generators/clearance/templates/test/functional/sessions_controller_test.rb +5 -0
- data/lib/clearance/test/functionals/users_controller_test.rb +60 -0
- data/lib/clearance/version.rb +7 -0
- data/lib/clearance.rb +1 -0
- data/test/rails_root/Capfile +3 -0
- data/test/rails_root/Rakefile +10 -0
- data/test/rails_root/app/controllers/application.rb +5 -0
- data/test/rails_root/app/controllers/confirmations_controller.rb +3 -0
- data/test/rails_root/app/controllers/passwords_controller.rb +3 -0
- data/test/rails_root/app/controllers/sessions_controller.rb +3 -0
- data/test/rails_root/app/controllers/users_controller.rb +3 -0
- data/test/rails_root/app/helpers/application_helper.rb +5 -0
- data/test/rails_root/app/helpers/confirmations_helper.rb +2 -0
- data/test/rails_root/app/helpers/passwords_helper.rb +2 -0
- data/test/rails_root/app/models/user.rb +3 -0
- data/test/rails_root/app/models/user_mailer.rb +7 -0
- data/test/rails_root/app/views/confirmations/new.html.erb +4 -0
- data/test/rails_root/app/views/layouts/_flashes.erb +5 -0
- data/test/rails_root/app/views/layouts/application.html.erb +14 -0
- data/test/rails_root/app/views/passwords/edit.html.erb +28 -0
- data/test/rails_root/app/views/passwords/new.html.erb +13 -0
- data/test/rails_root/app/views/sessions/new.html.erb +17 -0
- data/test/rails_root/app/views/user_mailer/change_password.html.erb +6 -0
- data/test/rails_root/app/views/user_mailer/confirmation.html.erb +1 -0
- data/test/rails_root/app/views/users/_form.html.erb +7 -0
- data/test/rails_root/app/views/users/edit.html.erb +4 -0
- data/test/rails_root/app/views/users/new.html.erb +4 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +13 -0
- data/test/rails_root/config/environment.rb +17 -0
- data/test/rails_root/config/environments/development.rb +20 -0
- data/test/rails_root/config/environments/test.rb +24 -0
- data/test/rails_root/config/initializers/clearance.rb +8 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/time_formats.rb +4 -0
- data/test/rails_root/config/routes.rb +19 -0
- data/test/rails_root/db/migrate/001_create_users.rb +18 -0
- data/test/rails_root/doc/README_FOR_APP +2 -0
- data/test/rails_root/doc/README_FOR_TEMPLATE +15 -0
- data/test/rails_root/lib/tasks/bootstrap.rake +16 -0
- data/test/rails_root/lib/tasks/capistrano.rake +96 -0
- data/test/rails_root/lib/tasks/git_tasks.rake +129 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/builder.js +136 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
- data/test/rails_root/public/javascripts/slider.js +277 -0
- data/test/rails_root/public/javascripts/sound.js +60 -0
- data/test/rails_root/public/robots.txt +1 -0
- data/test/rails_root/script/about +3 -0
- data/test/rails_root/script/breakpointer +3 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/performance/request +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/process/inspector +3 -0
- data/test/rails_root/script/process/reaper +3 -0
- data/test/rails_root/script/process/spawner +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/factories.rb +9 -0
- data/test/rails_root/test/functional/confirmations_controller_test.rb +5 -0
- data/test/rails_root/test/functional/passwords_controller_test.rb +5 -0
- data/test/rails_root/test/functional/sessions_controller_test.rb +5 -0
- data/test/rails_root/test/functional/users_controller_test.rb +5 -0
- data/test/rails_root/test/test_helper.rb +27 -0
- data/test/rails_root/test/unit/user_mailer_test.rb +6 -0
- data/test/rails_root/test/unit/user_test.rb +5 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/COPYING +3 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/MIT-LICENSE +7 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/README +35 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/RELEASE +246 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/Rakefile +188 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/misc.rb +44 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/mocha.rb +26 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/stubba.rb +65 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/any_instance_method.rb +54 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/backtrace_filter.rb +17 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/cardinality.rb +95 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/central.rb +27 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/change_state_side_effect.rb +19 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/class_method.rb +86 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/configuration.rb +60 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/deprecation.rb +22 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/exception_raiser.rb +17 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation.rb +445 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation_error.rb +15 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation_list.rb +50 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/in_state_ordering_constraint.rb +19 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/inspect.rb +39 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/instance_method.rb +16 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/is_a.rb +9 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/logger.rb +15 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/metaclass.rb +7 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/method_matcher.rb +21 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/mock.rb +196 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/mockery.rb +181 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/module_method.rb +16 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/multiple_yields.rb +20 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/names.rb +53 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/no_yields.rb +11 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/object.rb +134 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/all_of.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/any_of.rb +47 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/any_parameters.rb +40 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/anything.rb +33 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/base.rb +15 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/equals.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_entries.rb +45 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_entry.rb +56 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_key.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_value.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/includes.rb +40 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/instance_of.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/is_a.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/kind_of.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/not.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/object.rb +9 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/optionally.rb +55 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/regexp_matches.rb +43 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/responds_with.rb +43 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/yaml_equivalent.rb +43 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers.rb +26 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameters_matcher.rb +37 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/pretty_parameters.rb +28 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/return_values.rb +31 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/sequence.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/single_return_value.rb +17 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/single_yield.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/standalone.rb +166 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/state_machine.rb +91 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/stubbing_error.rb +16 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/test_case_adapter.rb +103 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/unexpected_invocation.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/yield_parameters.rb +31 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha.rb +20 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha_standalone.rb +2 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/stubba.rb +4 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/acceptance_test_helper.rb +38 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_18914_test.rb +43 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_21465_test.rb +34 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_21563_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/expected_invocation_count_test.rb +196 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/failure_messages_test.rb +64 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocha_example_test.rb +98 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocha_test_result_test.rb +84 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mock_test.rb +100 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mock_with_initializer_block_test.rb +51 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocked_methods_dispatch_test.rb +78 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/optional_parameters_test.rb +70 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/parameter_matcher_test.rb +179 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/partial_mocks_test.rb +47 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/return_value_test.rb +52 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/sequence_test.rb +186 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/standalone_test.rb +139 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/states_test.rb +70 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_any_instance_method_test.rb +195 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_class_method_test.rb +203 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_everything_test.rb +56 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_instance_method_test.rb +165 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_module_method_test.rb +163 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_test.rb +52 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_example_test.rb +102 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_test.rb +15 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_test_result_test.rb +66 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_error_backtrace_test.rb +64 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_method_unnecessarily_test.rb +65 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +130 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_class_method_test.rb +155 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_instance_method_test.rb +145 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_any_instance_method_test.rb +130 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_class_method_test.rb +161 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_instance_method_test.rb +141 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_on_non_mock_object_test.rb +64 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/active_record_test_case.rb +36 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/deprecation_disabler.rb +15 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/execution_point.rb +36 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/method_definer.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/simple_counter.rb +13 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/test_helper.rb +11 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/test_runner.rb +33 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/any_instance_method_test.rb +126 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/array_inspect_test.rb +16 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/backtrace_filter_test.rb +19 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/cardinality_test.rb +56 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/central_test.rb +65 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/change_state_side_effect_test.rb +41 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/class_method_test.rb +237 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/date_time_inspect_test.rb +21 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/exception_raiser_test.rb +42 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/expectation_list_test.rb +57 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/expectation_test.rb +459 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/hash_inspect_test.rb +16 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/in_state_ordering_constraint_test.rb +43 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/metaclass_test.rb +22 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/method_matcher_test.rb +23 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/mock_test.rb +290 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/mockery_test.rb +149 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/multiple_yields_test.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/no_yields_test.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/object_inspect_test.rb +37 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/object_test.rb +82 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/all_of_test.rb +26 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/any_of_test.rb +26 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/anything_test.rb +21 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/equals_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_entries_test.rb +51 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_entry_test.rb +62 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_key_test.rb +36 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_value_test.rb +37 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/includes_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/instance_of_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/is_a_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/kind_of_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/not_test.rb +26 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/regexp_matches_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/responds_with_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/stub_matcher.rb +27 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/yaml_equivalent_test.rb +25 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameters_matcher_test.rb +121 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/return_values_test.rb +63 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/sequence_test.rb +104 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/single_return_value_test.rb +14 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/single_yield_test.rb +18 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/state_machine_test.rb +98 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/string_inspect_test.rb +11 -0
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/yield_parameters_test.rb +93 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/CONTRIBUTION_GUIDELINES.rdoc +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/MIT-LICENSE +22 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/README.rdoc +132 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/Rakefile +72 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/bin/convert_to_should_syntax +42 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/action_mailer/assertions.rb +39 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/action_mailer.rb +10 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record/assertions.rb +85 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record/macros.rb +715 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/assertions.rb +45 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/context.rb +306 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/formats/html.rb +201 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/formats/xml.rb +170 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/helpers.rb +64 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/macros.rb +316 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/resource_options.rb +236 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller.rb +30 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/helpers.rb +10 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/macros.rb +74 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/private_helpers.rb +22 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/proc_extensions.rb +14 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/rails.rb +19 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks/list_tests.rake +24 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks/yaml_to_shoulda.rake +28 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks.rb +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda.rb +17 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/rails/init.rb +1 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/README +36 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fail_macros.rb +34 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/addresses.yml +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/friendships.yml +0 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/posts.yml +5 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/products.yml +0 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/taggings.yml +0 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/tags.yml +9 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/users.yml +6 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/functional/posts_controller_test.rb +104 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/functional/users_controller_test.rb +38 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/context_test.rb +145 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb +63 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/helpers_test.rb +183 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb +34 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/should_test.rb +266 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/application.rb +25 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/posts_controller.rb +85 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/users_controller.rb +84 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/posts_helper.rb +2 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/users_helper.rb +2 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/address.rb +7 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/dog.rb +5 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/flea.rb +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/friendship.rb +4 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/post.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/product.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/tag.rb +8 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/tagging.rb +4 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb +28 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/posts.rhtml +17 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/users.rhtml +17 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/wide.html.erb +1 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/edit.rhtml +27 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/index.rhtml +25 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/new.rhtml +26 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/show.rhtml +18 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/edit.rhtml +22 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/index.rhtml +22 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/new.rhtml +21 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/show.rhtml +13 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/database.yml +4 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/environment.rb +14 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/environments/sqlite3.rb +0 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/initializers/new_rails_defaults.rb +15 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/initializers/shoulda.rb +8 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/routes.rb +6 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/001_create_users.rb +18 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/002_create_posts.rb +13 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/003_create_taggings.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/004_create_tags.rb +11 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/005_create_dogs.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/006_create_addresses.rb +14 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/007_create_fleas.rb +11 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/008_create_dogs_fleas.rb +12 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/009_create_products.rb +17 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/010_create_friendships.rb +14 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/schema.rb +0 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/log/sqlite3.log +1 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/404.html +30 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/422.html +30 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/500.html +30 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/script/console +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/script/generate +3 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/test_helper.rb +33 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/address_test.rb +10 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/dog_test.rb +7 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/flea_test.rb +6 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/friendship_test.rb +6 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/post_test.rb +15 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/product_test.rb +27 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/tag_test.rb +14 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/tagging_test.rb +6 -0
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/user_test.rb +52 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/MIT-LICENSE +20 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/README +34 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/init.rb +9 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/USAGE +18 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/factory_generator.rb +17 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/templates/factory.rb +5 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/templates/fixtures.yml +19 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/templates/migration.rb +16 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/templates/model.rb +2 -0
- data/test/rails_root/vendor/plugins/factory_girl_on_rails/rails_generators/factory/templates/unit_test.rb +7 -0
- metadata +486 -14
- data/clearance.gemspec +0 -50
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/has_entries'
|
4
|
+
require 'mocha/parameter_matchers/object'
|
5
|
+
require 'mocha/inspect'
|
6
|
+
|
7
|
+
class HasEntriesTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
include Mocha::ParameterMatchers
|
10
|
+
|
11
|
+
def test_should_match_hash_including_specified_entries
|
12
|
+
matcher = has_entries(:key_1 => 'value_1', :key_2 => 'value_2')
|
13
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2', :key_3 => 'value_3' }])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_not_match_hash_not_including_specified_entries
|
17
|
+
matcher = has_entries(:key_1 => 'value_2', :key_2 => 'value_2', :key_3 => 'value_3')
|
18
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_describe_matcher
|
22
|
+
matcher = has_entries(:key_1 => 'value_1', :key_2 => 'value_2')
|
23
|
+
description = matcher.mocha_inspect
|
24
|
+
matches = /has_entries\((.*)\)/.match(description)
|
25
|
+
assert_not_nil matches[0]
|
26
|
+
entries = eval(matches[1], binding, __FILE__, __LINE__)
|
27
|
+
assert_equal 'value_1', entries[:key_1]
|
28
|
+
assert_equal 'value_2', entries[:key_2]
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_match_hash_including_specified_entries_with_nested_key_matchers
|
32
|
+
matcher = has_entries(equals(:key_1) => 'value_1', equals(:key_2) => 'value_2')
|
33
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2', :key_3 => 'value_3' }])
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_should_not_match_hash_not_including_specified_entries_with_nested_key_matchers
|
37
|
+
matcher = has_entries(equals(:key_1) => 'value_2', equals(:key_2) => 'value_2', equals(:key_3) => 'value_3')
|
38
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_match_hash_including_specified_entries_with_nested_value_matchers
|
42
|
+
matcher = has_entries(:key_1 => equals('value_1'), :key_2 => equals('value_2'))
|
43
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2', :key_3 => 'value_3' }])
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_not_match_hash_not_including_specified_entries_with_nested_value_matchers
|
47
|
+
matcher = has_entries(:key_1 => equals('value_2'), :key_2 => equals('value_2'), :key_3 => equals('value_3'))
|
48
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/has_entry'
|
4
|
+
require 'mocha/parameter_matchers/object'
|
5
|
+
require 'mocha/parameter_matchers/equals'
|
6
|
+
require 'mocha/inspect'
|
7
|
+
|
8
|
+
class HasEntryTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
include Mocha::ParameterMatchers
|
11
|
+
|
12
|
+
def test_should_match_hash_including_specified_key_value_pair
|
13
|
+
matcher = has_entry(:key_1, 'value_1')
|
14
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_should_not_match_hash_not_including_specified_key_value_pair
|
18
|
+
matcher = has_entry(:key_1, 'value_2')
|
19
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_match_hash_including_specified_entry
|
23
|
+
matcher = has_entry(:key_1 => 'value_1')
|
24
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_not_match_hash_not_including_specified_entry
|
28
|
+
matcher = has_entry(:key_1 => 'value_2')
|
29
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_should_describe_matcher_with_key_value_pair
|
33
|
+
matcher = has_entry(:key_1, 'value_1')
|
34
|
+
assert_equal "has_entry(:key_1 => 'value_1')", matcher.mocha_inspect
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_should_describe_matcher_with_entry
|
38
|
+
matcher = has_entry(:key_1 => 'value_1')
|
39
|
+
assert_equal "has_entry(:key_1 => 'value_1')", matcher.mocha_inspect
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_match_hash_including_specified_entry_with_nested_key_matcher
|
43
|
+
matcher = has_entry(equals(:key_1) => 'value_1')
|
44
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_match_hash_including_specified_entry_with_nested_value_matcher
|
48
|
+
matcher = has_entry(:key_1 => equals('value_1'))
|
49
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_not_match_hash_not_including_specified_entry_with_nested_key_matcher
|
53
|
+
matcher = has_entry(equals(:key_1) => 'value_2')
|
54
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_should_not_match_hash_not_including_specified_entry_with_nested_value_matcher
|
58
|
+
matcher = has_entry(:key_1 => equals('value_2'))
|
59
|
+
assert !matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/has_key'
|
4
|
+
require 'mocha/parameter_matchers/object'
|
5
|
+
require 'mocha/inspect'
|
6
|
+
|
7
|
+
class HasKeyTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
include Mocha::ParameterMatchers
|
10
|
+
|
11
|
+
def test_should_match_hash_including_specified_key
|
12
|
+
matcher = has_key(:key_1)
|
13
|
+
assert matcher.matches?([{ :key_1 => 1, :key_2 => 2 }])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_not_match_hash_not_including_specified_key
|
17
|
+
matcher = has_key(:key_1)
|
18
|
+
assert !matcher.matches?([{ :key_2 => 2 }])
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_describe_matcher
|
22
|
+
matcher = has_key(:key)
|
23
|
+
assert_equal 'has_key(:key)', matcher.mocha_inspect
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_match_hash_including_specified_key_with_nested_key_matcher
|
27
|
+
matcher = has_key(equals(:key_1))
|
28
|
+
assert matcher.matches?([{ :key_1 => 1, :key_2 => 2 }])
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_not_match_hash_not_including_specified_key_with_nested_key_matcher
|
32
|
+
matcher = has_key(equals(:key_1))
|
33
|
+
assert !matcher.matches?([{ :key_2 => 2 }])
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/has_value'
|
4
|
+
require 'mocha/parameter_matchers/object'
|
5
|
+
require 'mocha/parameter_matchers/equals'
|
6
|
+
require 'mocha/inspect'
|
7
|
+
|
8
|
+
class HasValueTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
include Mocha::ParameterMatchers
|
11
|
+
|
12
|
+
def test_should_match_hash_including_specified_value
|
13
|
+
matcher = has_value('value_1')
|
14
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_should_not_match_hash_not_including_specified_value
|
18
|
+
matcher = has_value('value_1')
|
19
|
+
assert !matcher.matches?([{ :key_2 => 'value_2' }])
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_describe_matcher
|
23
|
+
matcher = has_value('value_1')
|
24
|
+
assert_equal "has_value('value_1')", matcher.mocha_inspect
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_match_hash_including_specified_value_with_nested_value_matcher
|
28
|
+
matcher = has_value(equals('value_1'))
|
29
|
+
assert matcher.matches?([{ :key_1 => 'value_1', :key_2 => 'value_2' }])
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_should_not_match_hash_not_including_specified_value_with_nested_value_matcher
|
33
|
+
matcher = has_value(equals('value_1'))
|
34
|
+
assert !matcher.matches?([{ :key_2 => 'value_2' }])
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/includes'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class IncludesTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_object_including_value
|
11
|
+
matcher = includes(:x)
|
12
|
+
assert matcher.matches?([[:x, :y, :z]])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_object_that_does_not_include_value
|
16
|
+
matcher = includes(:not_included)
|
17
|
+
assert !matcher.matches?([[:x, :y, :z]])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = includes(:x)
|
22
|
+
assert_equal "includes(:x)", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/instance_of'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class InstanceOfTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_object_that_is_an_instance_of_specified_class
|
11
|
+
matcher = instance_of(String)
|
12
|
+
assert matcher.matches?(['string'])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_object_that_is_not_an_instance_of_specified_class
|
16
|
+
matcher = instance_of(String)
|
17
|
+
assert !matcher.matches?([99])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = instance_of(String)
|
22
|
+
assert_equal "instance_of(String)", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/is_a'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class IsATest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_object_that_is_a_specified_class
|
11
|
+
matcher = is_a(Integer)
|
12
|
+
assert matcher.matches?([99])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_object_that_is_not_a_specified_class
|
16
|
+
matcher = is_a(Integer)
|
17
|
+
assert !matcher.matches?(['string'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = is_a(Integer)
|
22
|
+
assert_equal "is_a(Integer)", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/kind_of'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class KindOfTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_object_that_is_a_kind_of_specified_class
|
11
|
+
matcher = kind_of(Integer)
|
12
|
+
assert matcher.matches?([99])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_object_that_is_not_a_kind_of_specified_class
|
16
|
+
matcher = kind_of(Integer)
|
17
|
+
assert !matcher.matches?(['string'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = kind_of(Integer)
|
22
|
+
assert_equal "kind_of(Integer)", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/not'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
require 'stub_matcher'
|
6
|
+
|
7
|
+
class NotTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
include Mocha::ParameterMatchers
|
10
|
+
|
11
|
+
def test_should_match_if_matcher_does_not_match
|
12
|
+
matcher = Not(Stub::Matcher.new(false))
|
13
|
+
assert matcher.matches?(['any_old_value'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_not_match_if_matcher_does_match
|
17
|
+
matcher = Not(Stub::Matcher.new(true))
|
18
|
+
assert !matcher.matches?(['any_old_value'])
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_describe_matcher
|
22
|
+
matcher = Not(Stub::Matcher.new(true))
|
23
|
+
assert_equal 'Not(matcher(true))', matcher.mocha_inspect
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/regexp_matches_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/regexp_matches'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class RegexpMatchesTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_parameter_matching_regular_expression
|
11
|
+
matcher = regexp_matches(/oo/)
|
12
|
+
assert matcher.matches?(['foo'])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_parameter_not_matching_regular_expression
|
16
|
+
matcher = regexp_matches(/oo/)
|
17
|
+
assert !matcher.matches?(['bar'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = regexp_matches(/oo/)
|
22
|
+
assert_equal "regexp_matches(/oo/)", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/responds_with_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/responds_with'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class RespondsWithTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_parameter_responding_with_expected_value
|
11
|
+
matcher = responds_with(:upcase, 'FOO')
|
12
|
+
assert matcher.matches?(['foo'])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_parameter_responding_with_unexpected_value
|
16
|
+
matcher = responds_with(:upcase, 'FOO')
|
17
|
+
assert !matcher.matches?(['bar'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = responds_with(:foo, :bar)
|
22
|
+
assert_equal 'responds_with(:foo, :bar)', matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Stub
|
2
|
+
|
3
|
+
class Matcher
|
4
|
+
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
def initialize(matches)
|
8
|
+
@matches = matches
|
9
|
+
end
|
10
|
+
|
11
|
+
def matches?(available_parameters)
|
12
|
+
value = available_parameters.shift
|
13
|
+
@value = value
|
14
|
+
@matches
|
15
|
+
end
|
16
|
+
|
17
|
+
def mocha_inspect
|
18
|
+
"matcher(#{@matches})"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_matcher
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/yaml_equivalent_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/parameter_matchers/yaml_equivalent'
|
4
|
+
require 'mocha/inspect'
|
5
|
+
|
6
|
+
class YamlEquivalentTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
include Mocha::ParameterMatchers
|
9
|
+
|
10
|
+
def test_should_match_parameter_matching_yaml_representation_of_object
|
11
|
+
matcher = yaml_equivalent([1, 2, 3])
|
12
|
+
assert matcher.matches?(["--- \n- 1\n- 2\n- 3\n"])
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_not_match_parameter_matching_yaml_representation_of_object
|
16
|
+
matcher = yaml_equivalent([1, 2, 3])
|
17
|
+
assert !matcher.matches?(["--- \n- 4\n- 5\n"])
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_describe_matcher
|
21
|
+
matcher = yaml_equivalent([1, 2, 3])
|
22
|
+
assert_equal "yaml_equivalent([1, 2, 3])", matcher.mocha_inspect
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "test_helper")
|
2
|
+
require 'mocha/parameters_matcher'
|
3
|
+
|
4
|
+
class ParametersMatcherTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
include Mocha
|
7
|
+
|
8
|
+
def test_should_match_any_actual_parameters_if_no_expected_parameters_specified
|
9
|
+
parameters_matcher = ParametersMatcher.new
|
10
|
+
assert parameters_matcher.match?(actual_parameters = [1, 2, 3])
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_should_match_if_actual_parameters_are_same_as_expected_parameters
|
14
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, 6])
|
15
|
+
assert parameters_matcher.match?(actual_parameters = [4, 5, 6])
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_not_match_if_actual_parameters_are_different_from_expected_parameters
|
19
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, 6])
|
20
|
+
assert !parameters_matcher.match?(actual_parameters = [1, 2, 3])
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_not_match_if_there_are_less_actual_parameters_than_expected_parameters
|
24
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, 6])
|
25
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 5])
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_should_not_match_if_there_are_more_actual_parameters_than_expected_parameters
|
29
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5])
|
30
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 5, 6])
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_not_match_if_not_all_required_parameters_are_supplied
|
34
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
35
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
36
|
+
assert !parameters_matcher.match?(actual_parameters = [4])
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_should_match_if_all_required_parameters_match_and_no_optional_parameters_are_supplied
|
40
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
41
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
42
|
+
assert parameters_matcher.match?(actual_parameters = [4, 5])
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_should_match_if_all_required_and_optional_parameters_match_and_some_optional_parameters_are_supplied
|
46
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
47
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
48
|
+
assert parameters_matcher.match?(actual_parameters = [4, 5, 6])
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_should_match_if_all_required_and_optional_parameters_match_and_all_optional_parameters_are_supplied
|
52
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
53
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
54
|
+
assert parameters_matcher.match?(actual_parameters = [4, 5, 6, 7])
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_should_not_match_if_all_required_and_optional_parameters_match_but_too_many_optional_parameters_are_supplied
|
58
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
59
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
60
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 5, 6, 7, 8])
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_should_not_match_if_all_required_parameters_match_but_some_optional_parameters_do_not_match
|
64
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
65
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
66
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 5, 6, 0])
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_should_not_match_if_some_required_parameters_do_not_match_although_all_optional_parameters_do_match
|
70
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
71
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
72
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 0, 6])
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_should_not_match_if_all_required_parameters_match_but_no_optional_parameters_match
|
76
|
+
optionals = ParameterMatchers::Optionally.new(6, 7)
|
77
|
+
parameters_matcher = ParametersMatcher.new(expected_parameters = [4, 5, optionals])
|
78
|
+
assert !parameters_matcher.match?(actual_parameters = [4, 5, 0, 0])
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_should_match_if_actual_parameters_satisfy_matching_block
|
82
|
+
parameters_matcher = ParametersMatcher.new { |x, y| x + y == 3 }
|
83
|
+
assert parameters_matcher.match?(actual_parameters = [1, 2])
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_should_not_match_if_actual_parameters_do_not_satisfy_matching_block
|
87
|
+
parameters_matcher = ParametersMatcher.new { |x, y| x + y == 3 }
|
88
|
+
assert !parameters_matcher.match?(actual_parameters = [2, 3])
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_should_remove_outer_array_braces
|
92
|
+
params = [1, 2, [3, 4]]
|
93
|
+
parameters_matcher = ParametersMatcher.new(params)
|
94
|
+
assert_equal '(1, 2, [3, 4])', parameters_matcher.mocha_inspect
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_should_display_numeric_arguments_as_is
|
98
|
+
params = [1, 2, 3]
|
99
|
+
parameters_matcher = ParametersMatcher.new(params)
|
100
|
+
assert_equal '(1, 2, 3)', parameters_matcher.mocha_inspect
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_should_remove_curly_braces_if_hash_is_only_argument
|
104
|
+
params = [{:a => 1, :z => 2}]
|
105
|
+
parameters_matcher = ParametersMatcher.new(params)
|
106
|
+
assert_nil parameters_matcher.mocha_inspect.index('{')
|
107
|
+
assert_nil parameters_matcher.mocha_inspect.index('}')
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_should_not_remove_curly_braces_if_hash_is_not_the_only_argument
|
111
|
+
params = [1, {:a => 1}]
|
112
|
+
parameters_matcher = ParametersMatcher.new(params)
|
113
|
+
assert_equal '(1, {:a => 1})', parameters_matcher.mocha_inspect
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_should_indicate_that_matcher_will_match_any_actual_parameters
|
117
|
+
parameters_matcher = ParametersMatcher.new
|
118
|
+
assert_equal '(any_parameters)', parameters_matcher.mocha_inspect
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "test_helper")
|
2
|
+
|
3
|
+
require 'mocha/return_values'
|
4
|
+
|
5
|
+
class ReturnValuesTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include Mocha
|
8
|
+
|
9
|
+
def test_should_return_nil
|
10
|
+
values = ReturnValues.new
|
11
|
+
assert_nil values.next
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_keep_returning_nil
|
15
|
+
values = ReturnValues.new
|
16
|
+
values.next
|
17
|
+
assert_nil values.next
|
18
|
+
assert_nil values.next
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_return_evaluated_single_return_value
|
22
|
+
values = ReturnValues.new(SingleReturnValue.new('value'))
|
23
|
+
assert_equal 'value', values.next
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_keep_returning_evaluated_single_return_value
|
27
|
+
values = ReturnValues.new(SingleReturnValue.new('value'))
|
28
|
+
values.next
|
29
|
+
assert_equal 'value', values.next
|
30
|
+
assert_equal 'value', values.next
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_return_consecutive_evaluated_single_return_values
|
34
|
+
values = ReturnValues.new(SingleReturnValue.new('value_1'), SingleReturnValue.new('value_2'))
|
35
|
+
assert_equal 'value_1', values.next
|
36
|
+
assert_equal 'value_2', values.next
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_should_keep_returning_last_of_consecutive_evaluated_single_return_values
|
40
|
+
values = ReturnValues.new(SingleReturnValue.new('value_1'), SingleReturnValue.new('value_2'))
|
41
|
+
values.next
|
42
|
+
values.next
|
43
|
+
assert_equal 'value_2', values.next
|
44
|
+
assert_equal 'value_2', values.next
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_build_single_return_values_for_each_values
|
48
|
+
values = ReturnValues.build('value_1', 'value_2', 'value_3').values
|
49
|
+
assert_equal 'value_1', values[0].evaluate
|
50
|
+
assert_equal 'value_2', values[1].evaluate
|
51
|
+
assert_equal 'value_3', values[2].evaluate
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_should_combine_two_sets_of_return_values
|
55
|
+
values_1 = ReturnValues.build('value_1')
|
56
|
+
values_2 = ReturnValues.build('value_2a', 'value_2b')
|
57
|
+
values = (values_1 + values_2).values
|
58
|
+
assert_equal 'value_1', values[0].evaluate
|
59
|
+
assert_equal 'value_2a', values[1].evaluate
|
60
|
+
assert_equal 'value_2b', values[2].evaluate
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|