thoughtbot-clearance 0.3.4 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.textile +8 -3
- data/Rakefile +21 -10
- data/TODO.textile +1 -3
- data/generators/clearance/clearance_generator.rb +3 -2
- data/generators/clearance/templates/app/models/clearance_mailer.rb +5 -0
- data/generators/clearance/templates/app/views/clearance_mailer/change_password.html.erb +6 -0
- data/generators/clearance/templates/app/views/clearance_mailer/confirmation.html.erb +1 -0
- data/generators/clearance/templates/test/unit/clearance_mailer_test.rb +6 -0
- data/lib/clearance/app/models/clearance_mailer.rb +33 -0
- data/lib/clearance/app/models/user.rb +3 -0
- data/lib/clearance/test/functional/users_controller_test.rb +3 -5
- data/lib/clearance/test/unit/clearance_mailer_test.rb +63 -0
- data/lib/clearance/test/unit/user_test.rb +3 -0
- metadata +11 -462
- data/test/rails_root/Capfile +0 -3
- data/test/rails_root/Rakefile +0 -10
- data/test/rails_root/app/controllers/application.rb +0 -5
- data/test/rails_root/app/controllers/confirmations_controller.rb +0 -3
- data/test/rails_root/app/controllers/passwords_controller.rb +0 -3
- data/test/rails_root/app/controllers/sessions_controller.rb +0 -3
- data/test/rails_root/app/controllers/users_controller.rb +0 -3
- data/test/rails_root/app/helpers/application_helper.rb +0 -5
- data/test/rails_root/app/helpers/confirmations_helper.rb +0 -2
- data/test/rails_root/app/helpers/passwords_helper.rb +0 -2
- data/test/rails_root/app/models/user.rb +0 -3
- data/test/rails_root/app/views/confirmations/new.html.erb +0 -6
- data/test/rails_root/app/views/layouts/_flashes.erb +0 -5
- data/test/rails_root/app/views/layouts/application.html.erb +0 -14
- data/test/rails_root/app/views/passwords/edit.html.erb +0 -23
- data/test/rails_root/app/views/passwords/new.html.erb +0 -15
- data/test/rails_root/app/views/sessions/new.html.erb +0 -26
- data/test/rails_root/app/views/users/_form.html.erb +0 -13
- data/test/rails_root/app/views/users/edit.html.erb +0 -4
- data/test/rails_root/app/views/users/new.html.erb +0 -4
- data/test/rails_root/config/boot.rb +0 -109
- data/test/rails_root/config/database.yml +0 -13
- data/test/rails_root/config/environment.rb +0 -16
- data/test/rails_root/config/environments/development.rb +0 -20
- data/test/rails_root/config/environments/test.rb +0 -24
- data/test/rails_root/config/initializers/clearance.rb +0 -8
- data/test/rails_root/config/initializers/inflections.rb +0 -10
- data/test/rails_root/config/initializers/mime_types.rb +0 -5
- data/test/rails_root/config/initializers/requires.rb +0 -13
- data/test/rails_root/config/initializers/time_formats.rb +0 -4
- data/test/rails_root/config/routes.rb +0 -16
- data/test/rails_root/db/migrate/001_create_users.rb +0 -18
- data/test/rails_root/doc/README_FOR_APP +0 -2
- data/test/rails_root/doc/README_FOR_TEMPLATE +0 -15
- data/test/rails_root/lib/tasks/bootstrap.rake +0 -16
- data/test/rails_root/lib/tasks/capistrano.rake +0 -96
- data/test/rails_root/lib/tasks/git_tasks.rake +0 -129
- data/test/rails_root/public/404.html +0 -30
- data/test/rails_root/public/422.html +0 -30
- data/test/rails_root/public/500.html +0 -30
- data/test/rails_root/public/dispatch.rb +0 -10
- 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 +0 -2
- data/test/rails_root/public/javascripts/builder.js +0 -136
- data/test/rails_root/public/javascripts/controls.js +0 -963
- data/test/rails_root/public/javascripts/dragdrop.js +0 -972
- data/test/rails_root/public/javascripts/effects.js +0 -1120
- data/test/rails_root/public/javascripts/prototype.js +0 -4225
- data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
- data/test/rails_root/public/javascripts/slider.js +0 -277
- data/test/rails_root/public/javascripts/sound.js +0 -60
- data/test/rails_root/public/robots.txt +0 -1
- data/test/rails_root/script/about +0 -3
- data/test/rails_root/script/breakpointer +0 -3
- data/test/rails_root/script/console +0 -3
- data/test/rails_root/script/create_project.rb +0 -52
- data/test/rails_root/script/dbconsole +0 -3
- data/test/rails_root/script/destroy +0 -3
- data/test/rails_root/script/generate +0 -3
- data/test/rails_root/script/performance/benchmarker +0 -3
- data/test/rails_root/script/performance/profiler +0 -3
- data/test/rails_root/script/performance/request +0 -3
- data/test/rails_root/script/plugin +0 -3
- data/test/rails_root/script/process/inspector +0 -3
- data/test/rails_root/script/process/reaper +0 -3
- data/test/rails_root/script/process/spawner +0 -3
- data/test/rails_root/script/runner +0 -3
- data/test/rails_root/script/server +0 -3
- data/test/rails_root/test/factories.rb +0 -9
- data/test/rails_root/test/functional/confirmations_controller_test.rb +0 -5
- data/test/rails_root/test/functional/passwords_controller_test.rb +0 -5
- data/test/rails_root/test/functional/sessions_controller_test.rb +0 -5
- data/test/rails_root/test/functional/users_controller_test.rb +0 -5
- data/test/rails_root/test/test_helper.rb +0 -21
- data/test/rails_root/test/unit/user_test.rb +0 -5
- data/test/rails_root/vendor/gems/mocha-0.9.1/COPYING +0 -3
- data/test/rails_root/vendor/gems/mocha-0.9.1/MIT-LICENSE +0 -7
- data/test/rails_root/vendor/gems/mocha-0.9.1/README +0 -35
- data/test/rails_root/vendor/gems/mocha-0.9.1/RELEASE +0 -246
- data/test/rails_root/vendor/gems/mocha-0.9.1/Rakefile +0 -188
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/misc.rb +0 -44
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/mocha.rb +0 -26
- data/test/rails_root/vendor/gems/mocha-0.9.1/examples/stubba.rb +0 -65
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/any_instance_method.rb +0 -54
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/backtrace_filter.rb +0 -17
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/cardinality.rb +0 -95
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/central.rb +0 -27
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/change_state_side_effect.rb +0 -19
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/class_method.rb +0 -86
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/configuration.rb +0 -60
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/deprecation.rb +0 -22
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/exception_raiser.rb +0 -17
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation.rb +0 -445
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation_error.rb +0 -15
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/expectation_list.rb +0 -50
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/in_state_ordering_constraint.rb +0 -19
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/inspect.rb +0 -39
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/instance_method.rb +0 -16
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/is_a.rb +0 -9
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/logger.rb +0 -15
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/metaclass.rb +0 -7
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/method_matcher.rb +0 -21
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/mock.rb +0 -196
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/mockery.rb +0 -181
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/module_method.rb +0 -16
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/multiple_yields.rb +0 -20
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/names.rb +0 -53
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/no_yields.rb +0 -11
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/object.rb +0 -134
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/all_of.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/any_of.rb +0 -47
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/any_parameters.rb +0 -40
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/anything.rb +0 -33
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/base.rb +0 -15
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/equals.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_entries.rb +0 -45
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_entry.rb +0 -56
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_key.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/has_value.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/includes.rb +0 -40
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/instance_of.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/is_a.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/kind_of.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/not.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/object.rb +0 -9
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/optionally.rb +0 -55
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/regexp_matches.rb +0 -43
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/responds_with.rb +0 -43
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers/yaml_equivalent.rb +0 -43
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameter_matchers.rb +0 -26
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/parameters_matcher.rb +0 -37
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/pretty_parameters.rb +0 -28
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/return_values.rb +0 -31
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/sequence.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/single_return_value.rb +0 -17
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/single_yield.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/standalone.rb +0 -166
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/state_machine.rb +0 -91
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/stubbing_error.rb +0 -16
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/test_case_adapter.rb +0 -103
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/unexpected_invocation.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha/yield_parameters.rb +0 -31
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha.rb +0 -20
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/mocha_standalone.rb +0 -2
- data/test/rails_root/vendor/gems/mocha-0.9.1/lib/stubba.rb +0 -4
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/acceptance_test_helper.rb +0 -38
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_18914_test.rb +0 -43
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_21465_test.rb +0 -34
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/bug_21563_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/expected_invocation_count_test.rb +0 -196
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/failure_messages_test.rb +0 -64
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocha_example_test.rb +0 -98
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocha_test_result_test.rb +0 -84
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mock_test.rb +0 -100
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mock_with_initializer_block_test.rb +0 -51
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/mocked_methods_dispatch_test.rb +0 -78
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/optional_parameters_test.rb +0 -70
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/parameter_matcher_test.rb +0 -179
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/partial_mocks_test.rb +0 -47
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/return_value_test.rb +0 -52
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/sequence_test.rb +0 -186
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/standalone_test.rb +0 -139
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/states_test.rb +0 -70
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_any_instance_method_test.rb +0 -195
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_class_method_test.rb +0 -203
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_everything_test.rb +0 -56
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_instance_method_test.rb +0 -165
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_module_method_test.rb +0 -163
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stub_test.rb +0 -52
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_example_test.rb +0 -102
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_test.rb +0 -15
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubba_test_result_test.rb +0 -66
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_error_backtrace_test.rb +0 -64
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -65
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -130
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -155
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -130
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_class_method_test.rb +0 -161
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -64
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/active_record_test_case.rb +0 -36
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/deprecation_disabler.rb +0 -15
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/execution_point.rb +0 -36
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/method_definer.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/simple_counter.rb +0 -13
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/test_helper.rb +0 -11
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/test_runner.rb +0 -33
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/any_instance_method_test.rb +0 -126
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/array_inspect_test.rb +0 -16
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/backtrace_filter_test.rb +0 -19
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/cardinality_test.rb +0 -56
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/central_test.rb +0 -65
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/change_state_side_effect_test.rb +0 -41
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/class_method_test.rb +0 -237
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/date_time_inspect_test.rb +0 -21
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/exception_raiser_test.rb +0 -42
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/expectation_list_test.rb +0 -57
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/expectation_test.rb +0 -459
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/hash_inspect_test.rb +0 -16
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/in_state_ordering_constraint_test.rb +0 -43
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/metaclass_test.rb +0 -22
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/method_matcher_test.rb +0 -23
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/mock_test.rb +0 -290
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/mockery_test.rb +0 -149
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/multiple_yields_test.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/no_yields_test.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/object_inspect_test.rb +0 -37
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/object_test.rb +0 -82
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/all_of_test.rb +0 -26
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/any_of_test.rb +0 -26
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/anything_test.rb +0 -21
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/equals_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_entries_test.rb +0 -51
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_entry_test.rb +0 -62
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_key_test.rb +0 -36
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/has_value_test.rb +0 -37
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/includes_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/instance_of_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/is_a_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/kind_of_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/not_test.rb +0 -26
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/regexp_matches_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/responds_with_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/stub_matcher.rb +0 -27
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -25
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/parameters_matcher_test.rb +0 -121
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/return_values_test.rb +0 -63
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/sequence_test.rb +0 -104
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/single_return_value_test.rb +0 -14
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/single_yield_test.rb +0 -18
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/state_machine_test.rb +0 -98
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/string_inspect_test.rb +0 -11
- data/test/rails_root/vendor/gems/mocha-0.9.1/test/unit/yield_parameters_test.rb +0 -93
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/CONTRIBUTION_GUIDELINES.rdoc +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/MIT-LICENSE +0 -22
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/README.rdoc +0 -132
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/Rakefile +0 -72
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/bin/convert_to_should_syntax +0 -42
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/action_mailer/assertions.rb +0 -39
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/action_mailer.rb +0 -10
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record/assertions.rb +0 -85
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record/macros.rb +0 -715
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/assertions.rb +0 -45
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/context.rb +0 -306
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/formats/html.rb +0 -201
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/formats/xml.rb +0 -170
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/helpers.rb +0 -64
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/macros.rb +0 -316
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller/resource_options.rb +0 -236
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/controller.rb +0 -30
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/helpers.rb +0 -10
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/macros.rb +0 -74
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/private_helpers.rb +0 -22
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/proc_extensions.rb +0 -14
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/rails.rb +0 -19
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks/list_tests.rake +0 -24
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks/yaml_to_shoulda.rake +0 -28
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/tasks.rb +0 -3
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda.rb +0 -17
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/rails/init.rb +0 -1
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/README +0 -36
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fail_macros.rb +0 -34
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/addresses.yml +0 -3
- 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 +0 -5
- 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 +0 -9
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/fixtures/users.yml +0 -6
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/functional/posts_controller_test.rb +0 -104
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/functional/users_controller_test.rb +0 -38
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/context_test.rb +0 -145
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb +0 -63
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/helpers_test.rb +0 -183
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb +0 -34
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/should_test.rb +0 -266
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/application.rb +0 -25
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/posts_controller.rb +0 -85
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/controllers/users_controller.rb +0 -84
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/application_helper.rb +0 -3
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/posts_helper.rb +0 -2
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/helpers/users_helper.rb +0 -2
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/address.rb +0 -7
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/dog.rb +0 -5
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/flea.rb +0 -3
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/friendship.rb +0 -4
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/post.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/product.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/tag.rb +0 -8
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/tagging.rb +0 -4
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb +0 -28
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/posts.rhtml +0 -17
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/users.rhtml +0 -17
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/layouts/wide.html.erb +0 -1
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/edit.rhtml +0 -27
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/index.rhtml +0 -25
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/new.rhtml +0 -26
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/posts/show.rhtml +0 -18
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/edit.rhtml +0 -22
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/index.rhtml +0 -22
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/new.rhtml +0 -21
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/views/users/show.rhtml +0 -13
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/boot.rb +0 -109
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/database.yml +0 -4
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/environment.rb +0 -14
- 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 +0 -15
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/initializers/shoulda.rb +0 -8
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/config/routes.rb +0 -6
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/001_create_users.rb +0 -18
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/002_create_posts.rb +0 -13
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/003_create_taggings.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/004_create_tags.rb +0 -11
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/005_create_dogs.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/006_create_addresses.rb +0 -14
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/007_create_fleas.rb +0 -11
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/008_create_dogs_fleas.rb +0 -12
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/009_create_products.rb +0 -17
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/db/migrate/010_create_friendships.rb +0 -14
- 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 +0 -1
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/404.html +0 -30
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/422.html +0 -30
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/public/500.html +0 -30
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/script/console +0 -3
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/script/generate +0 -3
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/test_helper.rb +0 -33
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/address_test.rb +0 -10
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/dog_test.rb +0 -7
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/flea_test.rb +0 -6
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/friendship_test.rb +0 -6
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/post_test.rb +0 -15
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/product_test.rb +0 -27
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/tag_test.rb +0 -14
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/tagging_test.rb +0 -6
- data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/unit/user_test.rb +0 -52
data/test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/lib/shoulda/active_record/macros.rb
DELETED
@@ -1,715 +0,0 @@
|
|
1
|
-
module ThoughtBot # :nodoc:
|
2
|
-
module Shoulda # :nodoc:
|
3
|
-
module ActiveRecord # :nodoc:
|
4
|
-
module MacroHelpers # :nodoc:
|
5
|
-
# Helper method that determines the default error message used by Active
|
6
|
-
# Record. Works for both existing Rails 2.1 and Rails 2.2 with the newly
|
7
|
-
# introduced I18n module used for localization.
|
8
|
-
#
|
9
|
-
# default_error_message(:blank)
|
10
|
-
# default_error_message(:too_short, :count => 5)
|
11
|
-
# default_error_message(:too_long, :count => 60)
|
12
|
-
def default_error_message(key, values = {})
|
13
|
-
if Object.const_defined?(:I18n) # Rails >= 2.2
|
14
|
-
I18n.translate("activerecord.errors.messages.#{key}", values)
|
15
|
-
else # Rails <= 2.1.x
|
16
|
-
::ActiveRecord::Errors.default_error_messages[key] % values[:count]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# = Macro test helpers for your active record models
|
22
|
-
#
|
23
|
-
# These helpers will test most of the validations and associations for your ActiveRecord models.
|
24
|
-
#
|
25
|
-
# class UserTest < Test::Unit::TestCase
|
26
|
-
# should_require_attributes :name, :phone_number
|
27
|
-
# should_not_allow_values_for :phone_number, "abcd", "1234"
|
28
|
-
# should_allow_values_for :phone_number, "(123) 456-7890"
|
29
|
-
#
|
30
|
-
# should_protect_attributes :password
|
31
|
-
#
|
32
|
-
# should_have_one :profile
|
33
|
-
# should_have_many :dogs
|
34
|
-
# should_have_many :messes, :through => :dogs
|
35
|
-
# should_belong_to :lover
|
36
|
-
# end
|
37
|
-
#
|
38
|
-
# For all of these helpers, the last parameter may be a hash of options.
|
39
|
-
#
|
40
|
-
module Macros
|
41
|
-
include MacroHelpers
|
42
|
-
|
43
|
-
# <b>DEPRECATED:</b> Use <tt>fixtures :all</tt> instead
|
44
|
-
#
|
45
|
-
# Loads all fixture files (<tt>test/fixtures/*.yml</tt>)
|
46
|
-
def load_all_fixtures
|
47
|
-
warn "[DEPRECATION] load_all_fixtures is deprecated. Use `fixtures :all` instead."
|
48
|
-
fixtures :all
|
49
|
-
end
|
50
|
-
|
51
|
-
# Ensures that the model cannot be saved if one of the attributes listed is not present.
|
52
|
-
#
|
53
|
-
# If an instance variable has been created in the setup named after the
|
54
|
-
# model being tested, then this method will use that. Otherwise, it will
|
55
|
-
# create a new instance to test against.
|
56
|
-
#
|
57
|
-
# Options:
|
58
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
59
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.blank')</tt>
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# should_require_attributes :name, :phone_number
|
63
|
-
#
|
64
|
-
def should_require_attributes(*attributes)
|
65
|
-
message = get_options!(attributes, :message)
|
66
|
-
message ||= default_error_message(:blank)
|
67
|
-
klass = model_class
|
68
|
-
|
69
|
-
attributes.each do |attribute|
|
70
|
-
should "require #{attribute} to be set" do
|
71
|
-
assert_bad_value(klass, attribute, nil, message)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Ensures that the model cannot be saved if one of the attributes listed is not unique.
|
77
|
-
# Requires an existing record
|
78
|
-
#
|
79
|
-
# Options:
|
80
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
81
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.taken')</tt>
|
82
|
-
# * <tt>:scoped_to</tt> - field(s) to scope the uniqueness to.
|
83
|
-
#
|
84
|
-
# Examples:
|
85
|
-
# should_require_unique_attributes :keyword, :username
|
86
|
-
# should_require_unique_attributes :name, :message => "O NOES! SOMEONE STOELED YER NAME!"
|
87
|
-
# should_require_unique_attributes :email, :scoped_to => :name
|
88
|
-
# should_require_unique_attributes :address, :scoped_to => [:first_name, :last_name]
|
89
|
-
#
|
90
|
-
def should_require_unique_attributes(*attributes)
|
91
|
-
message, scope = get_options!(attributes, :message, :scoped_to)
|
92
|
-
scope = [*scope].compact
|
93
|
-
message ||= default_error_message(:taken)
|
94
|
-
|
95
|
-
klass = model_class
|
96
|
-
attributes.each do |attribute|
|
97
|
-
attribute = attribute.to_sym
|
98
|
-
should "require unique value for #{attribute}#{" scoped to #{scope.join(', ')}" unless scope.blank?}" do
|
99
|
-
assert existing = klass.find(:first), "Can't find first #{klass}"
|
100
|
-
object = klass.new
|
101
|
-
existing_value = existing.send(attribute)
|
102
|
-
|
103
|
-
if !scope.blank?
|
104
|
-
scope.each do |s|
|
105
|
-
assert_respond_to object, :"#{s}=", "#{klass.name} doesn't seem to have a #{s} attribute."
|
106
|
-
object.send("#{s}=", existing.send(s))
|
107
|
-
end
|
108
|
-
end
|
109
|
-
assert_bad_value(object, attribute, existing_value, message)
|
110
|
-
|
111
|
-
# Now test that the object is valid when changing the scoped attribute
|
112
|
-
# TODO: There is a chance that we could change the scoped field
|
113
|
-
# to a value that's already taken. An alternative implementation
|
114
|
-
# could actually find all values for scope and create a unique
|
115
|
-
# one.
|
116
|
-
if !scope.blank?
|
117
|
-
scope.each do |s|
|
118
|
-
# Assume the scope is a foreign key if the field is nil
|
119
|
-
object.send("#{s}=", existing.send(s).nil? ? 1 : existing.send(s).next)
|
120
|
-
assert_good_value(object, attribute, existing_value, message)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
# Ensures that the attribute cannot be set on mass update.
|
128
|
-
#
|
129
|
-
# should_protect_attributes :password, :admin_flag
|
130
|
-
#
|
131
|
-
def should_protect_attributes(*attributes)
|
132
|
-
get_options!(attributes)
|
133
|
-
klass = model_class
|
134
|
-
|
135
|
-
attributes.each do |attribute|
|
136
|
-
attribute = attribute.to_sym
|
137
|
-
should "protect #{attribute} from mass updates" do
|
138
|
-
protected = klass.protected_attributes || []
|
139
|
-
accessible = klass.accessible_attributes || []
|
140
|
-
|
141
|
-
assert protected.include?(attribute.to_s) ||
|
142
|
-
(!accessible.empty? && !accessible.include?(attribute.to_s)),
|
143
|
-
(accessible.empty? ?
|
144
|
-
"#{klass} is protecting #{protected.to_a.to_sentence}, but not #{attribute}." :
|
145
|
-
"#{klass} has made #{attribute} accessible")
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Ensures that the attribute cannot be changed once the record has been created.
|
151
|
-
#
|
152
|
-
# should_have_readonly_attributes :password, :admin_flag
|
153
|
-
#
|
154
|
-
def should_have_readonly_attributes(*attributes)
|
155
|
-
get_options!(attributes)
|
156
|
-
klass = model_class
|
157
|
-
|
158
|
-
attributes.each do |attribute|
|
159
|
-
attribute = attribute.to_sym
|
160
|
-
should "make #{attribute} read-only" do
|
161
|
-
readonly = klass.readonly_attributes || []
|
162
|
-
|
163
|
-
assert readonly.include?(attribute.to_s),
|
164
|
-
(readonly.empty? ?
|
165
|
-
"#{klass} attribute #{attribute} is not read-only" :
|
166
|
-
"#{klass} is making #{readonly.to_a.to_sentence} read-only, but not #{attribute}.")
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
# Ensures that the attribute cannot be set to the given values
|
172
|
-
#
|
173
|
-
# If an instance variable has been created in the setup named after the
|
174
|
-
# model being tested, then this method will use that. Otherwise, it will
|
175
|
-
# create a new instance to test against.
|
176
|
-
#
|
177
|
-
# Options:
|
178
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
179
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.invalid')</tt>
|
180
|
-
#
|
181
|
-
# Example:
|
182
|
-
# should_not_allow_values_for :isbn, "bad 1", "bad 2"
|
183
|
-
#
|
184
|
-
def should_not_allow_values_for(attribute, *bad_values)
|
185
|
-
message = get_options!(bad_values, :message)
|
186
|
-
message ||= default_error_message(:invalid)
|
187
|
-
klass = model_class
|
188
|
-
bad_values.each do |v|
|
189
|
-
should "not allow #{attribute} to be set to #{v.inspect}" do
|
190
|
-
assert_bad_value(klass, attribute, v, message)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
# Ensures that the attribute can be set to the given values.
|
196
|
-
#
|
197
|
-
# If an instance variable has been created in the setup named after the
|
198
|
-
# model being tested, then this method will use that. Otherwise, it will
|
199
|
-
# create a new instance to test against.
|
200
|
-
#
|
201
|
-
# Example:
|
202
|
-
# should_allow_values_for :isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0"
|
203
|
-
#
|
204
|
-
def should_allow_values_for(attribute, *good_values)
|
205
|
-
get_options!(good_values)
|
206
|
-
klass = model_class
|
207
|
-
good_values.each do |v|
|
208
|
-
should "allow #{attribute} to be set to #{v.inspect}" do
|
209
|
-
assert_good_value(klass, attribute, v)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
# Ensures that the length of the attribute is in the given range
|
215
|
-
#
|
216
|
-
# If an instance variable has been created in the setup named after the
|
217
|
-
# model being tested, then this method will use that. Otherwise, it will
|
218
|
-
# create a new instance to test against.
|
219
|
-
#
|
220
|
-
# Options:
|
221
|
-
# * <tt>:short_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
222
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.too_short') % range.first</tt>
|
223
|
-
# * <tt>:long_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
224
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.too_long') % range.last</tt>
|
225
|
-
#
|
226
|
-
# Example:
|
227
|
-
# should_ensure_length_in_range :password, (6..20)
|
228
|
-
#
|
229
|
-
def should_ensure_length_in_range(attribute, range, opts = {})
|
230
|
-
short_message, long_message = get_options!([opts], :short_message, :long_message)
|
231
|
-
short_message ||= default_error_message(:too_short, :count => range.first)
|
232
|
-
long_message ||= default_error_message(:too_long, :count => range.last)
|
233
|
-
|
234
|
-
klass = model_class
|
235
|
-
min_length = range.first
|
236
|
-
max_length = range.last
|
237
|
-
same_length = (min_length == max_length)
|
238
|
-
|
239
|
-
if min_length > 0
|
240
|
-
should "not allow #{attribute} to be less than #{min_length} chars long" do
|
241
|
-
min_value = "x" * (min_length - 1)
|
242
|
-
assert_bad_value(klass, attribute, min_value, short_message)
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
if min_length > 0
|
247
|
-
should "allow #{attribute} to be exactly #{min_length} chars long" do
|
248
|
-
min_value = "x" * min_length
|
249
|
-
assert_good_value(klass, attribute, min_value, short_message)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
should "not allow #{attribute} to be more than #{max_length} chars long" do
|
254
|
-
max_value = "x" * (max_length + 1)
|
255
|
-
assert_bad_value(klass, attribute, max_value, long_message)
|
256
|
-
end
|
257
|
-
|
258
|
-
unless same_length
|
259
|
-
should "allow #{attribute} to be exactly #{max_length} chars long" do
|
260
|
-
max_value = "x" * max_length
|
261
|
-
assert_good_value(klass, attribute, max_value, long_message)
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
# Ensures that the length of the attribute is at least a certain length
|
267
|
-
#
|
268
|
-
# If an instance variable has been created in the setup named after the
|
269
|
-
# model being tested, then this method will use that. Otherwise, it will
|
270
|
-
# create a new instance to test against.
|
271
|
-
#
|
272
|
-
# Options:
|
273
|
-
# * <tt>:short_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
274
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.too_short') % min_length</tt>
|
275
|
-
#
|
276
|
-
# Example:
|
277
|
-
# should_ensure_length_at_least :name, 3
|
278
|
-
#
|
279
|
-
def should_ensure_length_at_least(attribute, min_length, opts = {})
|
280
|
-
short_message = get_options!([opts], :short_message)
|
281
|
-
short_message ||= default_error_message(:too_short, :count => min_length)
|
282
|
-
|
283
|
-
klass = model_class
|
284
|
-
|
285
|
-
if min_length > 0
|
286
|
-
min_value = "x" * (min_length - 1)
|
287
|
-
should "not allow #{attribute} to be less than #{min_length} chars long" do
|
288
|
-
assert_bad_value(klass, attribute, min_value, short_message)
|
289
|
-
end
|
290
|
-
end
|
291
|
-
should "allow #{attribute} to be at least #{min_length} chars long" do
|
292
|
-
valid_value = "x" * (min_length)
|
293
|
-
assert_good_value(klass, attribute, valid_value, short_message)
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
# Ensures that the length of the attribute is exactly a certain length
|
298
|
-
#
|
299
|
-
# If an instance variable has been created in the setup named after the
|
300
|
-
# model being tested, then this method will use that. Otherwise, it will
|
301
|
-
# create a new instance to test against.
|
302
|
-
#
|
303
|
-
# Options:
|
304
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
305
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.wrong_length') % length</tt>
|
306
|
-
#
|
307
|
-
# Example:
|
308
|
-
# should_ensure_length_is :ssn, 9
|
309
|
-
#
|
310
|
-
def should_ensure_length_is(attribute, length, opts = {})
|
311
|
-
message = get_options!([opts], :message)
|
312
|
-
message ||= default_error_message(:wrong_length, :count => length)
|
313
|
-
|
314
|
-
klass = model_class
|
315
|
-
|
316
|
-
should "not allow #{attribute} to be less than #{length} chars long" do
|
317
|
-
min_value = "x" * (length - 1)
|
318
|
-
assert_bad_value(klass, attribute, min_value, message)
|
319
|
-
end
|
320
|
-
|
321
|
-
should "not allow #{attribute} to be greater than #{length} chars long" do
|
322
|
-
max_value = "x" * (length + 1)
|
323
|
-
assert_bad_value(klass, attribute, max_value, message)
|
324
|
-
end
|
325
|
-
|
326
|
-
should "allow #{attribute} to be #{length} chars long" do
|
327
|
-
valid_value = "x" * (length)
|
328
|
-
assert_good_value(klass, attribute, valid_value, message)
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
# Ensure that the attribute is in the range specified
|
333
|
-
#
|
334
|
-
# If an instance variable has been created in the setup named after the
|
335
|
-
# model being tested, then this method will use that. Otherwise, it will
|
336
|
-
# create a new instance to test against.
|
337
|
-
#
|
338
|
-
# Options:
|
339
|
-
# * <tt>:low_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
340
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.inclusion')</tt>
|
341
|
-
# * <tt>:high_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
342
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.inclusion')</tt>
|
343
|
-
#
|
344
|
-
# Example:
|
345
|
-
# should_ensure_value_in_range :age, (0..100)
|
346
|
-
#
|
347
|
-
def should_ensure_value_in_range(attribute, range, opts = {})
|
348
|
-
low_message, high_message = get_options!([opts], :low_message, :high_message)
|
349
|
-
low_message ||= default_error_message(:inclusion)
|
350
|
-
high_message ||= default_error_message(:inclusion)
|
351
|
-
|
352
|
-
klass = model_class
|
353
|
-
min = range.first
|
354
|
-
max = range.last
|
355
|
-
|
356
|
-
should "not allow #{attribute} to be less than #{min}" do
|
357
|
-
v = min - 1
|
358
|
-
assert_bad_value(klass, attribute, v, low_message)
|
359
|
-
end
|
360
|
-
|
361
|
-
should "allow #{attribute} to be #{min}" do
|
362
|
-
v = min
|
363
|
-
assert_good_value(klass, attribute, v, low_message)
|
364
|
-
end
|
365
|
-
|
366
|
-
should "not allow #{attribute} to be more than #{max}" do
|
367
|
-
v = max + 1
|
368
|
-
assert_bad_value(klass, attribute, v, high_message)
|
369
|
-
end
|
370
|
-
|
371
|
-
should "allow #{attribute} to be #{max}" do
|
372
|
-
v = max
|
373
|
-
assert_good_value(klass, attribute, v, high_message)
|
374
|
-
end
|
375
|
-
end
|
376
|
-
|
377
|
-
# Ensure that the attribute is numeric
|
378
|
-
#
|
379
|
-
# If an instance variable has been created in the setup named after the
|
380
|
-
# model being tested, then this method will use that. Otherwise, it will
|
381
|
-
# create a new instance to test against.
|
382
|
-
#
|
383
|
-
# Options:
|
384
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
385
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.not_a_number')</tt>
|
386
|
-
#
|
387
|
-
# Example:
|
388
|
-
# should_only_allow_numeric_values_for :age
|
389
|
-
#
|
390
|
-
def should_only_allow_numeric_values_for(*attributes)
|
391
|
-
message = get_options!(attributes, :message)
|
392
|
-
message ||= default_error_message(:not_a_number)
|
393
|
-
klass = model_class
|
394
|
-
attributes.each do |attribute|
|
395
|
-
attribute = attribute.to_sym
|
396
|
-
should "only allow numeric values for #{attribute}" do
|
397
|
-
assert_bad_value(klass, attribute, "abcd", message)
|
398
|
-
end
|
399
|
-
end
|
400
|
-
end
|
401
|
-
|
402
|
-
# Ensures that the has_many relationship exists. Will also test that the
|
403
|
-
# associated table has the required columns. Works with polymorphic
|
404
|
-
# associations.
|
405
|
-
#
|
406
|
-
# Options:
|
407
|
-
# * <tt>:through</tt> - association name for <tt>has_many :through</tt>
|
408
|
-
# * <tt>:dependent</tt> - tests that the association makes use of the dependent option.
|
409
|
-
#
|
410
|
-
# Example:
|
411
|
-
# should_have_many :friends
|
412
|
-
# should_have_many :enemies, :through => :friends
|
413
|
-
# should_have_many :enemies, :dependent => :destroy
|
414
|
-
#
|
415
|
-
def should_have_many(*associations)
|
416
|
-
through, dependent = get_options!(associations, :through, :dependent)
|
417
|
-
klass = model_class
|
418
|
-
associations.each do |association|
|
419
|
-
name = "have many #{association}"
|
420
|
-
name += " through #{through}" if through
|
421
|
-
name += " dependent => #{dependent}" if dependent
|
422
|
-
should name do
|
423
|
-
reflection = klass.reflect_on_association(association)
|
424
|
-
assert reflection, "#{klass.name} does not have any relationship to #{association}"
|
425
|
-
assert_equal :has_many, reflection.macro
|
426
|
-
|
427
|
-
if through
|
428
|
-
through_reflection = klass.reflect_on_association(through)
|
429
|
-
assert through_reflection, "#{klass.name} does not have any relationship to #{through}"
|
430
|
-
assert_equal(through, reflection.options[:through])
|
431
|
-
end
|
432
|
-
|
433
|
-
if dependent
|
434
|
-
assert_equal dependent.to_s,
|
435
|
-
reflection.options[:dependent].to_s,
|
436
|
-
"#{association} should have #{dependent} dependency"
|
437
|
-
end
|
438
|
-
|
439
|
-
# Check for the existence of the foreign key on the other table
|
440
|
-
unless reflection.options[:through]
|
441
|
-
if reflection.options[:foreign_key]
|
442
|
-
fk = reflection.options[:foreign_key]
|
443
|
-
elsif reflection.options[:as]
|
444
|
-
fk = reflection.options[:as].to_s.foreign_key
|
445
|
-
else
|
446
|
-
fk = reflection.primary_key_name
|
447
|
-
end
|
448
|
-
|
449
|
-
associated_klass_name = (reflection.options[:class_name] || association.to_s.classify)
|
450
|
-
associated_klass = associated_klass_name.constantize
|
451
|
-
|
452
|
-
assert associated_klass.column_names.include?(fk.to_s),
|
453
|
-
"#{associated_klass.name} does not have a #{fk} foreign key."
|
454
|
-
end
|
455
|
-
end
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
# Ensure that the has_one relationship exists. Will also test that the
|
460
|
-
# associated table has the required columns. Works with polymorphic
|
461
|
-
# associations.
|
462
|
-
#
|
463
|
-
# Options:
|
464
|
-
# * <tt>:dependent</tt> - tests that the association makes use of the dependent option.
|
465
|
-
#
|
466
|
-
# Example:
|
467
|
-
# should_have_one :god # unless hindu
|
468
|
-
#
|
469
|
-
def should_have_one(*associations)
|
470
|
-
dependent = get_options!(associations, :dependent)
|
471
|
-
klass = model_class
|
472
|
-
associations.each do |association|
|
473
|
-
name = "have one #{association}"
|
474
|
-
name += " dependent => #{dependent}" if dependent
|
475
|
-
should name do
|
476
|
-
reflection = klass.reflect_on_association(association)
|
477
|
-
assert reflection, "#{klass.name} does not have any relationship to #{association}"
|
478
|
-
assert_equal :has_one, reflection.macro
|
479
|
-
|
480
|
-
associated_klass = (reflection.options[:class_name] || association.to_s.camelize).constantize
|
481
|
-
|
482
|
-
if reflection.options[:foreign_key]
|
483
|
-
fk = reflection.options[:foreign_key]
|
484
|
-
elsif reflection.options[:as]
|
485
|
-
fk = reflection.options[:as].to_s.foreign_key
|
486
|
-
fk_type = fk.gsub(/_id$/, '_type')
|
487
|
-
assert associated_klass.column_names.include?(fk_type),
|
488
|
-
"#{associated_klass.name} does not have a #{fk_type} column."
|
489
|
-
else
|
490
|
-
fk = klass.name.foreign_key
|
491
|
-
end
|
492
|
-
assert associated_klass.column_names.include?(fk.to_s),
|
493
|
-
"#{associated_klass.name} does not have a #{fk} foreign key."
|
494
|
-
|
495
|
-
if dependent
|
496
|
-
assert_equal dependent.to_s,
|
497
|
-
reflection.options[:dependent].to_s,
|
498
|
-
"#{association} should have #{dependent} dependency"
|
499
|
-
end
|
500
|
-
end
|
501
|
-
end
|
502
|
-
end
|
503
|
-
|
504
|
-
# Ensures that the has_and_belongs_to_many relationship exists, and that the join
|
505
|
-
# table is in place.
|
506
|
-
#
|
507
|
-
# should_have_and_belong_to_many :posts, :cars
|
508
|
-
#
|
509
|
-
def should_have_and_belong_to_many(*associations)
|
510
|
-
get_options!(associations)
|
511
|
-
klass = model_class
|
512
|
-
|
513
|
-
associations.each do |association|
|
514
|
-
should "should have and belong to many #{association}" do
|
515
|
-
reflection = klass.reflect_on_association(association)
|
516
|
-
assert reflection, "#{klass.name} does not have any relationship to #{association}"
|
517
|
-
assert_equal :has_and_belongs_to_many, reflection.macro
|
518
|
-
table = reflection.options[:join_table]
|
519
|
-
assert ::ActiveRecord::Base.connection.tables.include?(table), "table #{table} doesn't exist"
|
520
|
-
end
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
# Ensure that the belongs_to relationship exists.
|
525
|
-
#
|
526
|
-
# should_belong_to :parent
|
527
|
-
#
|
528
|
-
def should_belong_to(*associations)
|
529
|
-
get_options!(associations)
|
530
|
-
klass = model_class
|
531
|
-
associations.each do |association|
|
532
|
-
should "belong_to #{association}" do
|
533
|
-
reflection = klass.reflect_on_association(association)
|
534
|
-
assert reflection, "#{klass.name} does not have any relationship to #{association}"
|
535
|
-
assert_equal :belongs_to, reflection.macro
|
536
|
-
|
537
|
-
unless reflection.options[:polymorphic]
|
538
|
-
associated_klass = (reflection.options[:class_name] || association.to_s.camelize).constantize
|
539
|
-
fk = reflection.options[:foreign_key] || reflection.primary_key_name
|
540
|
-
assert klass.column_names.include?(fk.to_s), "#{klass.name} does not have a #{fk} foreign key."
|
541
|
-
end
|
542
|
-
end
|
543
|
-
end
|
544
|
-
end
|
545
|
-
|
546
|
-
# Ensure that the given class methods are defined on the model.
|
547
|
-
#
|
548
|
-
# should_have_class_methods :find, :destroy
|
549
|
-
#
|
550
|
-
def should_have_class_methods(*methods)
|
551
|
-
get_options!(methods)
|
552
|
-
klass = model_class
|
553
|
-
methods.each do |method|
|
554
|
-
should "respond to class method ##{method}" do
|
555
|
-
assert_respond_to klass, method, "#{klass.name} does not have class method #{method}"
|
556
|
-
end
|
557
|
-
end
|
558
|
-
end
|
559
|
-
|
560
|
-
# Ensure that the given instance methods are defined on the model.
|
561
|
-
#
|
562
|
-
# should_have_instance_methods :email, :name, :name=
|
563
|
-
#
|
564
|
-
def should_have_instance_methods(*methods)
|
565
|
-
get_options!(methods)
|
566
|
-
klass = model_class
|
567
|
-
methods.each do |method|
|
568
|
-
should "respond to instance method ##{method}" do
|
569
|
-
assert_respond_to klass.new, method, "#{klass.name} does not have instance method #{method}"
|
570
|
-
end
|
571
|
-
end
|
572
|
-
end
|
573
|
-
|
574
|
-
# Ensure that the given columns are defined on the models backing SQL table.
|
575
|
-
#
|
576
|
-
# should_have_db_columns :id, :email, :name, :created_at
|
577
|
-
#
|
578
|
-
def should_have_db_columns(*columns)
|
579
|
-
column_type = get_options!(columns, :type)
|
580
|
-
klass = model_class
|
581
|
-
columns.each do |name|
|
582
|
-
test_name = "have column #{name}"
|
583
|
-
test_name += " of type #{column_type}" if column_type
|
584
|
-
should test_name do
|
585
|
-
column = klass.columns.detect {|c| c.name == name.to_s }
|
586
|
-
assert column, "#{klass.name} does not have column #{name}"
|
587
|
-
end
|
588
|
-
end
|
589
|
-
end
|
590
|
-
|
591
|
-
# Ensure that the given column is defined on the models backing SQL table. The options are the same as
|
592
|
-
# the instance variables defined on the column definition: :precision, :limit, :default, :null,
|
593
|
-
# :primary, :type, :scale, and :sql_type.
|
594
|
-
#
|
595
|
-
# should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
|
596
|
-
# :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)'
|
597
|
-
#
|
598
|
-
def should_have_db_column(name, opts = {})
|
599
|
-
klass = model_class
|
600
|
-
test_name = "have column named :#{name}"
|
601
|
-
test_name += " with options " + opts.inspect unless opts.empty?
|
602
|
-
should test_name do
|
603
|
-
column = klass.columns.detect {|c| c.name == name.to_s }
|
604
|
-
assert column, "#{klass.name} does not have column #{name}"
|
605
|
-
opts.each do |k, v|
|
606
|
-
assert_equal column.instance_variable_get("@#{k}").to_s, v.to_s, ":#{name} column on table for #{klass} does not match option :#{k}"
|
607
|
-
end
|
608
|
-
end
|
609
|
-
end
|
610
|
-
|
611
|
-
# Ensures that there are DB indices on the given columns or tuples of columns.
|
612
|
-
# Also aliased to should_have_index for readability
|
613
|
-
#
|
614
|
-
# should_have_indices :email, :name, [:commentable_type, :commentable_id]
|
615
|
-
# should_have_index :age
|
616
|
-
#
|
617
|
-
def should_have_indices(*columns)
|
618
|
-
table = model_class.table_name
|
619
|
-
indices = ::ActiveRecord::Base.connection.indexes(table).map(&:columns)
|
620
|
-
|
621
|
-
columns.each do |column|
|
622
|
-
should "have index on #{table} for #{column.inspect}" do
|
623
|
-
columns = [column].flatten.map(&:to_s)
|
624
|
-
assert_contains(indices, columns)
|
625
|
-
end
|
626
|
-
end
|
627
|
-
end
|
628
|
-
|
629
|
-
alias_method :should_have_index, :should_have_indices
|
630
|
-
|
631
|
-
# Ensures that the model cannot be saved if one of the attributes listed is not accepted.
|
632
|
-
#
|
633
|
-
# If an instance variable has been created in the setup named after the
|
634
|
-
# model being tested, then this method will use that. Otherwise, it will
|
635
|
-
# create a new instance to test against.
|
636
|
-
#
|
637
|
-
# Options:
|
638
|
-
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
|
639
|
-
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.accepted')</tt>
|
640
|
-
#
|
641
|
-
# Example:
|
642
|
-
# should_require_acceptance_of :eula
|
643
|
-
#
|
644
|
-
def should_require_acceptance_of(*attributes)
|
645
|
-
message = get_options!(attributes, :message)
|
646
|
-
message ||= default_error_message(:accepted)
|
647
|
-
klass = model_class
|
648
|
-
|
649
|
-
attributes.each do |attribute|
|
650
|
-
should "require #{attribute} to be accepted" do
|
651
|
-
assert_bad_value(klass, attribute, false, message)
|
652
|
-
end
|
653
|
-
end
|
654
|
-
end
|
655
|
-
|
656
|
-
# Ensures that the model has a method named scope_name that returns a NamedScope object with the
|
657
|
-
# proxy options set to the options you supply. scope_name can be either a symbol, or a method
|
658
|
-
# call which will be evaled against the model. The eval'd method call has access to all the same
|
659
|
-
# instance variables that a should statement would.
|
660
|
-
#
|
661
|
-
# Options: Any of the options that the named scope would pass on to find.
|
662
|
-
#
|
663
|
-
# Example:
|
664
|
-
#
|
665
|
-
# should_have_named_scope :visible, :conditions => {:visible => true}
|
666
|
-
#
|
667
|
-
# Passes for
|
668
|
-
#
|
669
|
-
# named_scope :visible, :conditions => {:visible => true}
|
670
|
-
#
|
671
|
-
# Or for
|
672
|
-
#
|
673
|
-
# def self.visible
|
674
|
-
# scoped(:conditions => {:visible => true})
|
675
|
-
# end
|
676
|
-
#
|
677
|
-
# You can test lambdas or methods that return ActiveRecord#scoped calls:
|
678
|
-
#
|
679
|
-
# should_have_named_scope 'recent(5)', :limit => 5
|
680
|
-
# should_have_named_scope 'recent(1)', :limit => 1
|
681
|
-
#
|
682
|
-
# Passes for
|
683
|
-
# named_scope :recent, lambda {|c| {:limit => c}}
|
684
|
-
#
|
685
|
-
# Or for
|
686
|
-
#
|
687
|
-
# def self.recent(c)
|
688
|
-
# scoped(:limit => c)
|
689
|
-
# end
|
690
|
-
#
|
691
|
-
def should_have_named_scope(scope_call, *args)
|
692
|
-
klass = model_class
|
693
|
-
scope_opts = args.extract_options!
|
694
|
-
scope_call = scope_call.to_s
|
695
|
-
|
696
|
-
context scope_call do
|
697
|
-
setup do
|
698
|
-
@scope = eval("#{klass}.#{scope_call}")
|
699
|
-
end
|
700
|
-
|
701
|
-
should "return a scope object" do
|
702
|
-
assert_equal ::ActiveRecord::NamedScope::Scope, @scope.class
|
703
|
-
end
|
704
|
-
|
705
|
-
unless scope_opts.empty?
|
706
|
-
should "scope itself to #{scope_opts.inspect}" do
|
707
|
-
assert_equal scope_opts, @scope.proxy_options
|
708
|
-
end
|
709
|
-
end
|
710
|
-
end
|
711
|
-
end
|
712
|
-
end
|
713
|
-
end
|
714
|
-
end
|
715
|
-
end
|