shoulda-matchers 4.0.0.rc1 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +72 -40
- data/lib/shoulda/matchers/action_controller.rb +2 -0
- data/lib/shoulda/matchers/active_model.rb +2 -3
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +1 -0
- data/lib/shoulda/matchers/active_record.rb +2 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +34 -0
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +27 -4
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +27 -4
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/independent.rb +2 -1
- data/lib/shoulda/matchers/rails_shim.rb +5 -9
- data/lib/shoulda/matchers/version.rb +1 -1
- data/lib/shoulda/matchers/warn.rb +1 -0
- data/shoulda-matchers.gemspec +11 -3
- metadata +13 -340
- data/.gitignore +0 -12
- data/.hound.yml +0 -3
- data/.hound/ruby.yml +0 -1062
- data/.python-version +0 -1
- data/.rubocop.yml +0 -15
- data/.travis.yml +0 -21
- data/.yardopts +0 -10
- data/Appraisals +0 -105
- data/CONTRIBUTING.md +0 -172
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -59
- data/MAINTAINING.md +0 -250
- data/NEWS.md +0 -1235
- data/Rakefile +0 -46
- data/bin/setup +0 -190
- data/custom_plan.rb +0 -104
- data/doc_config/gh-pages/index.html.erb +0 -9
- data/doc_config/yard/setup.rb +0 -22
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -5967
- data/doc_config/yard/templates/default/fulldoc/html/css/full_list.css +0 -12
- data/doc_config/yard/templates/default/fulldoc/html/css/global.css +0 -66
- data/doc_config/yard/templates/default/fulldoc/html/css/solarized.css +0 -69
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +0 -312
- data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -26
- data/doc_config/yard/templates/default/fulldoc/html/full_list_class.erb +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/full_list_method.erb +0 -8
- data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -281
- data/doc_config/yard/templates/default/fulldoc/html/js/full_list.js +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/js/jquery.stickyheaders.js +0 -289
- data/doc_config/yard/templates/default/fulldoc/html/js/underscore.min.js +0 -6
- data/doc_config/yard/templates/default/fulldoc/html/setup.rb +0 -35
- data/doc_config/yard/templates/default/layout/html/breadcrumb.erb +0 -14
- data/doc_config/yard/templates/default/layout/html/fonts.erb +0 -1
- data/doc_config/yard/templates/default/layout/html/footer.erb +0 -6
- data/doc_config/yard/templates/default/layout/html/layout.erb +0 -23
- data/doc_config/yard/templates/default/layout/html/search.erb +0 -13
- data/doc_config/yard/templates/default/layout/html/setup.rb +0 -40
- data/doc_config/yard/templates/default/method_details/html/source.erb +0 -10
- data/doc_config/yard/templates/default/module/html/box_info.erb +0 -31
- data/gemfiles/4.2.gemfile +0 -39
- data/gemfiles/4.2.gemfile.lock +0 -246
- data/gemfiles/5.0.gemfile +0 -37
- data/gemfiles/5.0.gemfile.lock +0 -238
- data/gemfiles/5.1.gemfile +0 -38
- data/gemfiles/5.1.gemfile.lock +0 -254
- data/gemfiles/5.2.gemfile +0 -40
- data/gemfiles/5.2.gemfile.lock +0 -273
- data/script/install_gems_in_all_appraisals +0 -16
- data/script/run_all_tests +0 -16
- data/script/supported_ruby_versions +0 -7
- data/script/update_gem_in_all_appraisals +0 -17
- data/script/update_gems_in_all_appraisals +0 -16
- data/spec/acceptance/active_model_integration_spec.rb +0 -23
- data/spec/acceptance/independent_matchers_spec.rb +0 -125
- data/spec/acceptance/multiple_libraries_integration_spec.rb +0 -55
- data/spec/acceptance/rails_integration_spec.rb +0 -156
- data/spec/acceptance_spec_helper.rb +0 -23
- data/spec/doublespeak_spec_helper.rb +0 -2
- data/spec/report_warnings.rb +0 -7
- data/spec/spec_helper.rb +0 -20
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +0 -133
- data/spec/support/acceptance/helpers.rb +0 -33
- data/spec/support/acceptance/helpers/active_model_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/array_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/base_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/command_helpers.rb +0 -68
- data/spec/support/acceptance/helpers/file_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/gem_helpers.rb +0 -31
- data/spec/support/acceptance/helpers/minitest_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/n_unit_helpers.rb +0 -25
- data/spec/support/acceptance/helpers/pluralization_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/rails_migration_helpers.rb +0 -21
- data/spec/support/acceptance/helpers/rails_version_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +0 -24
- data/spec/support/acceptance/helpers/ruby_version_helpers.rb +0 -9
- data/spec/support/acceptance/helpers/step_helpers.rb +0 -127
- data/spec/support/acceptance/matchers/have_output.rb +0 -31
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +0 -55
- data/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +0 -103
- data/spec/support/tests/bundle.rb +0 -94
- data/spec/support/tests/command_runner.rb +0 -230
- data/spec/support/tests/current_bundle.rb +0 -55
- data/spec/support/tests/database.rb +0 -28
- data/spec/support/tests/database_adapters/postgresql.rb +0 -25
- data/spec/support/tests/database_adapters/sqlite3.rb +0 -26
- data/spec/support/tests/database_configuration.rb +0 -33
- data/spec/support/tests/database_configuration_registry.rb +0 -28
- data/spec/support/tests/filesystem.rb +0 -100
- data/spec/support/tests/version.rb +0 -45
- data/spec/support/unit/active_record/create_table.rb +0 -54
- data/spec/support/unit/attribute.rb +0 -45
- data/spec/support/unit/capture.rb +0 -46
- data/spec/support/unit/change_value.rb +0 -111
- data/spec/support/unit/create_model_arguments/basic.rb +0 -135
- data/spec/support/unit/create_model_arguments/has_many.rb +0 -15
- data/spec/support/unit/create_model_arguments/uniqueness_matcher.rb +0 -74
- data/spec/support/unit/helpers/action_pack_versions.rb +0 -22
- data/spec/support/unit/helpers/active_model_helpers.rb +0 -27
- data/spec/support/unit/helpers/active_model_versions.rb +0 -32
- data/spec/support/unit/helpers/active_record_versions.rb +0 -44
- data/spec/support/unit/helpers/active_resource_builder.rb +0 -27
- data/spec/support/unit/helpers/allow_value_matcher_helpers.rb +0 -15
- data/spec/support/unit/helpers/class_builder.rb +0 -90
- data/spec/support/unit/helpers/column_type_helpers.rb +0 -26
- data/spec/support/unit/helpers/confirmation_matcher_helpers.rb +0 -17
- data/spec/support/unit/helpers/controller_builder.rb +0 -63
- data/spec/support/unit/helpers/database_helpers.rb +0 -20
- data/spec/support/unit/helpers/i18n_faker.rb +0 -15
- data/spec/support/unit/helpers/mailer_builder.rb +0 -12
- data/spec/support/unit/helpers/message_helpers.rb +0 -19
- data/spec/support/unit/helpers/model_builder.rb +0 -114
- data/spec/support/unit/helpers/rails_versions.rb +0 -42
- data/spec/support/unit/helpers/validation_matcher_scenario_helpers.rb +0 -44
- data/spec/support/unit/i18n.rb +0 -7
- data/spec/support/unit/load_environment.rb +0 -12
- data/spec/support/unit/matchers/deprecate.rb +0 -60
- data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +0 -51
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +0 -64
- data/spec/support/unit/matchers/print_warning_including.rb +0 -67
- data/spec/support/unit/model_creation_strategies/active_model.rb +0 -111
- data/spec/support/unit/model_creation_strategies/active_record.rb +0 -77
- data/spec/support/unit/model_creators.rb +0 -19
- data/spec/support/unit/model_creators/active_model.rb +0 -39
- data/spec/support/unit/model_creators/active_record.rb +0 -42
- data/spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb +0 -95
- data/spec/support/unit/model_creators/active_record/has_many.rb +0 -67
- data/spec/support/unit/model_creators/active_record/uniqueness_matcher.rb +0 -42
- data/spec/support/unit/model_creators/basic.rb +0 -102
- data/spec/support/unit/rails_application.rb +0 -151
- data/spec/support/unit/record_builder_with_i18n_validation_message.rb +0 -69
- data/spec/support/unit/record_validating_confirmation_builder.rb +0 -54
- data/spec/support/unit/record_with_different_error_attribute_builder.rb +0 -92
- data/spec/support/unit/shared_examples/ignoring_interference_by_writer.rb +0 -79
- data/spec/support/unit/shared_examples/numerical_submatcher.rb +0 -17
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +0 -360
- data/spec/support/unit/validation_matcher_scenario.rb +0 -60
- data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/action_controller/filter_param_matcher_spec.rb +0 -28
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +0 -629
- data/spec/unit/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +0 -42
- data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +0 -76
- data/spec/unit/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +0 -62
- data/spec/unit/shoulda/matchers/action_controller/rescue_from_matcher_spec.rb +0 -90
- data/spec/unit/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +0 -31
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +0 -330
- data/spec/unit/shoulda/matchers/action_controller/route_params_spec.rb +0 -30
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +0 -67
- data/spec/unit/shoulda/matchers/action_controller/set_session_matcher_spec.rb +0 -17
- data/spec/unit/shoulda/matchers/action_controller/set_session_or_flash_matcher_spec.rb +0 -562
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +0 -117
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +0 -829
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb +0 -20
- data/spec/unit/shoulda/matchers/active_model/helpers_spec.rb +0 -162
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +0 -290
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +0 -109
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +0 -172
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +0 -264
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +0 -1049
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +0 -335
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +0 -1865
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +0 -406
- data/spec/unit/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +0 -107
- data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +0 -1672
- data/spec/unit/shoulda/matchers/active_record/association_matchers/model_reflection_spec.rb +0 -251
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +0 -690
- data/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +0 -111
- data/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +0 -85
- data/spec/unit/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb +0 -41
- data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +0 -169
- data/spec/unit/shoulda/matchers/active_record/serialize_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +0 -1682
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +0 -190
- data/spec/unit/shoulda/matchers/doublespeak/double_implementation_registry_spec.rb +0 -21
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +0 -271
- data/spec/unit/shoulda/matchers/doublespeak/object_double_spec.rb +0 -77
- data/spec/unit/shoulda/matchers/doublespeak/proxy_implementation_spec.rb +0 -72
- data/spec/unit/shoulda/matchers/doublespeak/stub_implementation_spec.rb +0 -101
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +0 -78
- data/spec/unit/shoulda/matchers/doublespeak_spec.rb +0 -27
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher/stubbed_target_spec.rb +0 -43
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +0 -650
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +0 -406
- data/spec/unit/shoulda/matchers/util/word_wrap_spec.rb +0 -252
- data/spec/unit_spec_helper.rb +0 -54
- data/spec/warnings_spy.rb +0 -64
- data/spec/warnings_spy/filesystem.rb +0 -45
- data/spec/warnings_spy/partitioner.rb +0 -36
- data/spec/warnings_spy/reader.rb +0 -53
- data/spec/warnings_spy/reporter.rb +0 -88
- data/tasks/documentation.rb +0 -199
- data/zeus.json +0 -11
data/NEWS.md
DELETED
@@ -1,1235 +0,0 @@
|
|
1
|
-
# 4.0.0 (unreleased)
|
2
|
-
|
3
|
-
This release mainly brings the gem up to date with modern versions of Ruby and
|
4
|
-
Rails and drops support for older, unsupported versions. The compatibility list
|
5
|
-
is now:
|
6
|
-
|
7
|
-
* **Ruby:** 2.5.1, 2.4.4, 2.3.7, 2.2.8
|
8
|
-
* **Rails:** 5.2.1, 5.1.6, 5.0.6, 4.2.9
|
9
|
-
|
10
|
-
### Backward-incompatible changes
|
11
|
-
|
12
|
-
* Drop support for Rails 4.0 and 4.1 as well as Ruby 2.0 and 2.1, since they've
|
13
|
-
been end-of-lifed. The gem now supports Ruby 2.2+ and Rails 4.2+.
|
14
|
-
|
15
|
-
* `use_before_filter`, `use_after_filter`, and `use_around_filter` are no longer
|
16
|
-
usable when using shoulda-matchers under Rails 5.x, as the corresponding
|
17
|
-
controller callbacks don't exist there.
|
18
|
-
|
19
|
-
* *PR: [#1054]*
|
20
|
-
|
21
|
-
### Deprecations
|
22
|
-
|
23
|
-
* `define_enum_for`: `with` is deprecated in favor of `with_values`. This is to
|
24
|
-
prevent confusion with `with_prefix` and `with_suffix`, which are new.
|
25
|
-
|
26
|
-
* *PR: [#1077]*
|
27
|
-
|
28
|
-
### Bug fixes
|
29
|
-
|
30
|
-
* Fix association matchers when used under Rails 5.x so that they make use of
|
31
|
-
`ActiveRecord::Base.connection.data_sources` instead of
|
32
|
-
`ActiveRecord::Base.connection.tables`, which was deprecated.
|
33
|
-
|
34
|
-
* *Commit: [61c3654]*
|
35
|
-
* *PR: [#943]*
|
36
|
-
* *Original issue: [#933]*
|
37
|
-
|
38
|
-
* Fix the `serialize` matcher so that it works with Rails 5.x.
|
39
|
-
|
40
|
-
* *Commit: [df04f87]*
|
41
|
-
* *PR: [#965]*
|
42
|
-
* *Original issue: [#913]*
|
43
|
-
|
44
|
-
* Fix our custom mocking library Doublespeak, which is used by
|
45
|
-
`delegate_method`, so that it does not produce a warning under Ruby 2.4.
|
46
|
-
|
47
|
-
* *Commit: [8d7dcb8]*
|
48
|
-
* *PR: [#1038]*
|
49
|
-
* *Original issue: [#1006]*
|
50
|
-
|
51
|
-
* Fix the `permit` matcher so that it uses the correct method signature to call
|
52
|
-
the controller action with params in order to prevent a warning under Rails
|
53
|
-
5.x.
|
54
|
-
|
55
|
-
* *Commit: [ce9624b]*
|
56
|
-
* *PRs: [#989], [#964], [#917]*
|
57
|
-
* *Original issue: [#867]*
|
58
|
-
|
59
|
-
* Fix the `define_enum_for` matcher so that it once more allows string columns
|
60
|
-
to be used as enum attributes.
|
61
|
-
|
62
|
-
* *Commit: [5650aae]*
|
63
|
-
* *PR: [#1063]*
|
64
|
-
* *Original issue: [#912]*
|
65
|
-
|
66
|
-
* Fix `validate_uniqueness_of` when used under Rails 4.2 so that when the
|
67
|
-
attribute you're testing is a boolean column, it will no longer emit a
|
68
|
-
warning.
|
69
|
-
|
70
|
-
* *PR: [#1073]*
|
71
|
-
* *Original issue: [#949]*
|
72
|
-
|
73
|
-
* Fix `validate_inclusion_of` so that if it fails, it will no longer blow up
|
74
|
-
with the error "undefined method \`attribute_setter' for nil:NilClass".
|
75
|
-
|
76
|
-
* *Original issue: [#904]*
|
77
|
-
|
78
|
-
* Add negative versions of all validation matchers (i.e. implement
|
79
|
-
`does_not_match?` for them) to prevent them from blowing up with
|
80
|
-
"undefined method \`attribute_setter' for nil:NilClass".
|
81
|
-
|
82
|
-
* *Original issue: [#904]*
|
83
|
-
|
84
|
-
### Features
|
85
|
-
|
86
|
-
* Add `required` and `optional` qualifiers to `belong_to` and `have_one`
|
87
|
-
matchers. (When using the `belong_to` matcher under Rails 5+, `required` is
|
88
|
-
assumed unless overridden.)
|
89
|
-
|
90
|
-
* *Commit: [3af3d9f]*
|
91
|
-
* *Original PR: [#956]*
|
92
|
-
* *Original issues: [#870], [#861]*
|
93
|
-
|
94
|
-
* Add `allow_nil` qualifier to `delegate_method`.
|
95
|
-
|
96
|
-
* *Commit: [d49cfca]*
|
97
|
-
* *Original PR: [#798]*
|
98
|
-
|
99
|
-
* Add `allow_nil` qualifier to `validate_length_of`.
|
100
|
-
|
101
|
-
* *Original PR: [#724]*
|
102
|
-
|
103
|
-
* Add a `port` option to the `route` matcher to allow testing a route that has
|
104
|
-
a constraint on it such that only a specific port may be used to access that
|
105
|
-
route.
|
106
|
-
|
107
|
-
* *PRs: [#1074], [#1075]*
|
108
|
-
* *Original issue: [#954]*
|
109
|
-
|
110
|
-
* Add `with_prefix` and `with_suffix` to `define_enum_for` to allow testing
|
111
|
-
the `enum` macro with corresponding `prefix` and `suffix` options (Rails 5
|
112
|
-
only).
|
113
|
-
|
114
|
-
* *PR: [#1077]
|
115
|
-
* *Original issue: [#961]
|
116
|
-
|
117
|
-
* Add `index_errors` option to `has_many` (Rails 5 only).
|
118
|
-
|
119
|
-
* *Commit: [795ca68]*
|
120
|
-
* *PR: [#1089]*
|
121
|
-
|
122
|
-
[a6d09aa]: https://github.com/thoughtbot/shoulda-matchers/commit/a6d09aa5de0d546367e7b3d7177dfde6c66f7f05
|
123
|
-
[#943]: https://github.com/thoughtbot/shoulda-matchers/pulls/943
|
124
|
-
[#933]: https://github.com/thoughtbot/shoulda-matchers/issues/933
|
125
|
-
[df04f87]: https://github.com/thoughtbot/shoulda-matchers/commit/df04f8704abc3754c63c488433dac8c30573da6b
|
126
|
-
[#965]: https://github.com/thoughtbot/shoulda-matchers/pulls/965
|
127
|
-
[#913]: https://github.com/thoughtbot/shoulda-matchers/issues/913
|
128
|
-
[8d7dcb8]: https://github.com/thoughtbot/shoulda-matchers/commit/8d7dcb88c3bae8315e4107a39ae17fe19a4b6786
|
129
|
-
[#1038]: https://github.com/thoughtbot/shoulda-matchers/pulls/1038
|
130
|
-
[#1006]: httpce9624b3c5a08b9134150e228440c771d95782b7s://github.com/thoughtbot/shoulda-matchers/issues/1006
|
131
|
-
[ce9624b]: https://github.com/thoughtbot/shoulda-matchers/commit/ce9624b3c5a08b9134150e228440c771d95782b7
|
132
|
-
[#989]: https://github.com/thoughtbot/shoulda-matchers/pulls/989
|
133
|
-
[#964]: https://github.com/thoughtbot/shoulda-matchers/pulls/964
|
134
|
-
[#917]: https://github.com/thoughtbot/shoulda-matchers/pulls/917
|
135
|
-
[#867]: https://github.com/thoughtbot/shoulda-matchers/issues/867
|
136
|
-
[#1054]: https://github.com/thoughtbot/shoulda-matchers/pulls/1054
|
137
|
-
[5650aae]: https://github.com/thoughtbot/shoulda-matchers/commit/5650aae35de85aeabd75bc544324fda33ce1a092
|
138
|
-
[#1063]: https://github.com/thoughtbot/shoulda-matchers/pulls/1063
|
139
|
-
[#912]: https://github.com/thoughtbot/shoulda-matchers/issues/912
|
140
|
-
[#1073]: https://github.com/thoughtbot/shoulda-matchers/pulls/1073
|
141
|
-
[#949]: https://github.com/thoughtbot/shoulda-matchers/issues/949
|
142
|
-
[d49cfca]: https://github.com/thoughtbot/shoulda-matchers/commit/d49cfcae1b294e12a05e06a5612cb8ebb22a7df1
|
143
|
-
[#798]: https://github.com/thoughtbot/shoulda-matchers/pulls/798
|
144
|
-
[#724]: https://github.com/thoughtbot/shoulda-matchers/issues/724
|
145
|
-
[d49cfca]: https://github.com/thoughtbot/shoulda-matchers/commit/d49cfcae1b294e12a05e06a5612cb8ebb22a7df1
|
146
|
-
[3af3d9f]: https://github.com/thoughtbot/shoulda-matchers/commit/3af3d9f7abb768c063759941724ccae48c7b76d6
|
147
|
-
[#956]: https://github.com/thoughtbot/shoulda-matchers/pulls/956
|
148
|
-
[#870]: https://github.com/thoughtbot/shoulda-matchers/issues/870
|
149
|
-
[#861]: https://github.com/thoughtbot/shoulda-matchers/issues/861
|
150
|
-
[#954]: https://github.com/thoughtbot/shoulda-matchers/issues/954
|
151
|
-
[#1074]: https://github.com/thoughtbot/shoulda-matchers/pulls/1074
|
152
|
-
[#1075]: https://github.com/thoughtbot/shoulda-matchers/pulls/1075
|
153
|
-
[#1077]: https://github.com/thoughtbot/shoulda-matchers/pulls/1077
|
154
|
-
[#961]: https://github.com/thoughtbot/shoulda-matchers/issues/961
|
155
|
-
[795ca68]: https://github.com/thoughtbot/shoulda-matchers/commit/795ca688bff08590dbd2ab6f2b51ea415e0c7473
|
156
|
-
[#1089]: https://github.com/thoughtbot/shoulda-matchers/pulls/1089
|
157
|
-
[#904]: https://github.com/thoughtbot/shoulda-matchers/issues/904
|
158
|
-
|
159
|
-
### Improvements
|
160
|
-
|
161
|
-
* Replace usage of Fixnum with Integer to prevent Ruby 2.4 from emitting
|
162
|
-
deprecation warnings.
|
163
|
-
|
164
|
-
* *Commits: [61c3654], [03a1d21]*
|
165
|
-
* *PRs: [#1040], [#1031], [#1009]*
|
166
|
-
* *Original issue: [#1001]*
|
167
|
-
|
168
|
-
[61c3654]: https://github.com/thoughtbot/shoulda-matchers/commit/61c365416a09c5cffd7fcb774a07de4abf8e9afd
|
169
|
-
[03a1d21]: https://github.com/thoughtbot/shoulda-matchers/commit/03a1d213805a44a0aec99857e01cab8524aa0c05
|
170
|
-
[#1040]: https://github.com/thoughtbot/shoulda-matchers/pulls/1040
|
171
|
-
[#1031]: https://github.com/thoughtbot/shoulda-matchers/pulls/1031
|
172
|
-
[#1009]: https://github.com/thoughtbot/shoulda-matchers/pulls/1009
|
173
|
-
[#1001]: https://github.com/thoughtbot/shoulda-matchers/issues/1001
|
174
|
-
|
175
|
-
# 3.1.2
|
176
|
-
|
177
|
-
### Deprecations
|
178
|
-
|
179
|
-
* This is the **last version** that supports Rails 4.0 and 4.1 and Ruby 2.0 and
|
180
|
-
2.1.
|
181
|
-
|
182
|
-
### Bug fixes
|
183
|
-
|
184
|
-
* When the `permit` matcher was used without `#on`, the controller did not use
|
185
|
-
`params#require`, the params object was duplicated, and the matcher did not
|
186
|
-
recognize the `#permit` call inside the controller. This behavior happened
|
187
|
-
because the matcher overwrote double registries with the same parameter hash
|
188
|
-
whenever ActionController::Parameters was instantiated.
|
189
|
-
|
190
|
-
* *Commit: [44c019]*
|
191
|
-
* *Issue: [#899]*
|
192
|
-
* *Pull request: [#902]*
|
193
|
-
|
194
|
-
[44c019]: https://github.com/thoughtbot/shoulda-matchers/commit/44c0198830921650af3b4a56f5d72aaae2168480
|
195
|
-
[#899]: https://github.com/thoughtbot/shoulda-matchers/issues/899
|
196
|
-
[#902]: https://github.com/thoughtbot/shoulda-matchers/pulls/902
|
197
|
-
|
198
|
-
# 3.1.1
|
199
|
-
|
200
|
-
### Bug fixes
|
201
|
-
|
202
|
-
* Some matchers make use of ActiveSupport's `in?` method, but do not include the
|
203
|
-
file where this is defined in ActiveSupport. This causes problems with
|
204
|
-
projects using shoulda-matchers that do not include all of ActiveSupport by
|
205
|
-
default. To fix this, replace `in?` with Ruby's builtin `include?`.
|
206
|
-
|
207
|
-
* *Pull request: [#879]*
|
208
|
-
|
209
|
-
* `validate_uniqueness_of` works by creating a record if it doesn't exist, and
|
210
|
-
then testing against a new record with various attributes set that are equal
|
211
|
-
to (or different than) corresponding attributes in the existing record. In
|
212
|
-
3.1.0 a change was made whereby when the uniqueness matcher is given a new
|
213
|
-
record and creates an existing record out of it, it ensures that the record is
|
214
|
-
valid before continuing on. This created a problem because if the subject,
|
215
|
-
before it was saved, was empty and therefore in an invalid state, it could not
|
216
|
-
effectively be saved. While ideally this should be enforced, doing so would be
|
217
|
-
a backward-incompatible change, so this behavior has been rolled back.
|
218
|
-
([#880], [#884], [#885])
|
219
|
-
|
220
|
-
* *Commit: [45de869]*
|
221
|
-
* *Issues: [#880], [#884], [#885]*
|
222
|
-
|
223
|
-
* Fix an issue with `validate_uniqueness_of` + `scoped_to` when used against a
|
224
|
-
model where the attribute has multiple uniqueness validations and each
|
225
|
-
validation has a different set of scopes. In this case, a test written for the
|
226
|
-
first validation (and its scopes) would pass, but tests for the other
|
227
|
-
validations (and their scopes) would not, as the matcher only considered the
|
228
|
-
first set of scopes as the *actual* set of scopes.
|
229
|
-
|
230
|
-
* *Commit: [28bd9a1]*
|
231
|
-
* *Issues: [#830]*
|
232
|
-
|
233
|
-
### Improvements
|
234
|
-
|
235
|
-
* Update `validate_uniqueness_of` so that if an existing record fails to be
|
236
|
-
created because a column is non-nullable and was not filled in, raise an
|
237
|
-
ExistingRecordInvalid exception with details on how to fix the test.
|
238
|
-
|
239
|
-
* *Commit: [78ccfc5]*
|
240
|
-
|
241
|
-
[#879]: https://github.com/thoughtbot/shoulda-matchers/issues/879
|
242
|
-
[45de869]: https://github.com/thoughtbot/shoulda-matchers/commit/45de8698487d57f559c5bf35818d1c1ee82b0e77
|
243
|
-
[#880]: https://github.com/thoughtbot/shoulda-matchers/issues/880
|
244
|
-
[#884]: https://github.com/thoughtbot/shoulda-matchers/issues/884
|
245
|
-
[#885]: https://github.com/thoughtbot/shoulda-matchers/issues/885
|
246
|
-
[78ccfc5]: https://github.com/thoughtbot/shoulda-matchers/commit/78ccfc50b52fa686c109d614df66744b0da65380
|
247
|
-
[28bd9a1]: https://github.com/thoughtbot/shoulda-matchers/commit/28bd9a10c71af4d541b692d6204163c394ebd33c
|
248
|
-
[#830]: https://github.com/thoughtbot/shoulda-matchers/issues/830
|
249
|
-
|
250
|
-
# 3.1.0
|
251
|
-
|
252
|
-
### Bug fixes
|
253
|
-
|
254
|
-
* Update `validate_numericality_of` so that submatchers are applied lazily
|
255
|
-
instead of immediately. Previously, qualifiers were order-dependent, meaning
|
256
|
-
that if you used `strict` before you used, say, `odd`, then `strict` wouldn't
|
257
|
-
actually apply to `odd`. Now the order that you specify qualifiers doesn't
|
258
|
-
matter.
|
259
|
-
|
260
|
-
* *Source: [6c67a5e]*
|
261
|
-
|
262
|
-
* Fix `allow_value` so that it does not raise an AttributeChangedValueError
|
263
|
-
(formerly CouldNotSetAttributeError) when used against an attribute that is an
|
264
|
-
enum in an ActiveRecord model.
|
265
|
-
|
266
|
-
* *Source: [9e8603e]*
|
267
|
-
|
268
|
-
* Add a `ignoring_interference_by_writer` qualifier to all matchers, not just
|
269
|
-
`allow_value`. *This is enabled by default, which means that you should never
|
270
|
-
get a CouldNotSetAttributeError again.* (You may get some more information if
|
271
|
-
a test fails, however.)
|
272
|
-
|
273
|
-
* *Source: [1189934], [5532f43]*
|
274
|
-
* *Fixes: [#786], [#799], [#801], [#804], [#817], [#841], [#849], [#872],
|
275
|
-
[#873], and [#874]*
|
276
|
-
|
277
|
-
* Fix `validate_numericality_of` so that it does not blow up when used against
|
278
|
-
a virtual attribute defined in an ActiveRecord model (that is, an attribute
|
279
|
-
that is not present in the database but is defined using `attr_accessor`).
|
280
|
-
|
281
|
-
* *Source: [#822]*
|
282
|
-
|
283
|
-
* Update `validate_numericality_of` so that it no longer raises an
|
284
|
-
IneffectiveTestError if used against a numeric column.
|
285
|
-
|
286
|
-
* *Source: [5ed0362]*
|
287
|
-
* *Fixes: [#832]*
|
288
|
-
|
289
|
-
[6c67a5e]: https://github.com/thoughtbot/shoulda-matchers/commit/6c67a5eb0df265d3a565aa7d1a7e2b645051eb5a
|
290
|
-
[9e8603e]: https://github.com/thoughtbot/shoulda-matchers/commit/9e8603eb745bfa2a5aea6dfef85adf680d447151
|
291
|
-
[1189934]: https://github.com/thoughtbot/shoulda-matchers/commit/118993480604d39c73687d069f7af3726f3e3f3e
|
292
|
-
[5532f43]: https://github.com/thoughtbot/shoulda-matchers/commit/5532f4359aa332b10de7d46f876eaffd4a95b5b6
|
293
|
-
[#786]: https://github.com/thoughtbot/shoulda-matchers/issues/786
|
294
|
-
[#799]: https://github.com/thoughtbot/shoulda-matchers/issues/799
|
295
|
-
[#801]: https://github.com/thoughtbot/shoulda-matchers/issues/801
|
296
|
-
[#804]: https://github.com/thoughtbot/shoulda-matchers/issues/804
|
297
|
-
[#817]: https://github.com/thoughtbot/shoulda-matchers/issues/817
|
298
|
-
[#841]: https://github.com/thoughtbot/shoulda-matchers/issues/841
|
299
|
-
[#849]: https://github.com/thoughtbot/shoulda-matchers/issues/849
|
300
|
-
[#872]: https://github.com/thoughtbot/shoulda-matchers/issues/872
|
301
|
-
[#873]: https://github.com/thoughtbot/shoulda-matchers/issues/873
|
302
|
-
[#874]: https://github.com/thoughtbot/shoulda-matchers/issues/874
|
303
|
-
[#822]: https://github.com/thoughtbot/shoulda-matchers/pull/822
|
304
|
-
[5ed0362]: https://github.com/thoughtbot/shoulda-matchers/commit/5ed03624197314865ff5463e473e5e84bb91d9ea
|
305
|
-
[#832]: https://github.com/thoughtbot/shoulda-matchers/issues/832
|
306
|
-
|
307
|
-
### Features
|
308
|
-
|
309
|
-
* Add a new qualifier, `ignoring_case_sensitivity`, to `validate_uniqueness_of`.
|
310
|
-
This provides a way to test uniqueness of an attribute whose case is
|
311
|
-
normalized, either in a custom writer method for that attribute, or in a
|
312
|
-
custom `before_validation` callback.
|
313
|
-
|
314
|
-
* *Source: [#840]*
|
315
|
-
* *Fixes: [#836]*
|
316
|
-
|
317
|
-
[#840]: https://github.com/thoughtbot/shoulda-matchers/pull/840
|
318
|
-
[#836]: https://github.com/thoughtbot/shoulda-matchers/issues/836
|
319
|
-
|
320
|
-
### Improvements
|
321
|
-
|
322
|
-
* Improve failure messages and descriptions of all matchers across the board so
|
323
|
-
that it is easier to understand what the matcher was doing when it failed.
|
324
|
-
(You'll see a huge difference in the output of the numericality and uniqueness
|
325
|
-
matchers in particular.)
|
326
|
-
|
327
|
-
* Matchers now raise an error if any attributes that the matcher is attempting
|
328
|
-
to set do not exist on the model.
|
329
|
-
|
330
|
-
* *Source: [2962112]*
|
331
|
-
|
332
|
-
* Update `validate_numericality_of` so that it doesn't always run all of the
|
333
|
-
submatchers, but stops on the first one that fails. Since failure messages
|
334
|
-
now contain information as to what value the matcher set on the attribute when
|
335
|
-
it failed, this change guarantees that the correct value will be shown.
|
336
|
-
|
337
|
-
* *Source: [8e24a6e]*
|
338
|
-
|
339
|
-
* Continue to detect if attributes change incoming values, but now instead of
|
340
|
-
immediately seeing a CouldNotSetAttributeError, you will only be informed
|
341
|
-
about it if the test you've written fails.
|
342
|
-
|
343
|
-
* *Source: [1189934]*
|
344
|
-
|
345
|
-
* Add an additional check to `define_enum_for` to ensure that the column that
|
346
|
-
underlies the enum attribute you're testing is an integer column.
|
347
|
-
|
348
|
-
* *Source: [68dd70a]*
|
349
|
-
|
350
|
-
* Add a test for `validate_numericality_of` so that it officially supports money
|
351
|
-
columns.
|
352
|
-
|
353
|
-
* *Source: [a559713]*
|
354
|
-
* *Refs: [#841]*
|
355
|
-
|
356
|
-
[2962112]: https://github.com/thoughtbot/shoulda-matchers/commit/296211211497e624dde87adae68b385ad4cdae3a
|
357
|
-
[8e24a6e]: https://github.com/thoughtbot/shoulda-matchers/commit/8e24a6e9b2b147f2c51fb03aa02543f213acab34
|
358
|
-
[68dd70a]: https://github.com/thoughtbot/shoulda-matchers/commit/68dd70a23d8997a490683adcd2108a4a5cadf8ba
|
359
|
-
[a559713]: https://github.com/thoughtbot/shoulda-matchers/commit/a559713f96303414551c0bc1767fb11eb19bcc5d
|
360
|
-
|
361
|
-
# 3.0.1
|
362
|
-
|
363
|
-
### Bug fixes
|
364
|
-
|
365
|
-
* Fix `validate_inclusion_of` + `in_array` when used against a date or datetime
|
366
|
-
column/attribute so that it does not raise a CouldNotSetAttributeError.
|
367
|
-
([#783], [8fa97b4])
|
368
|
-
|
369
|
-
* Fix `validate_numericality_of` when used against a numeric column so that it
|
370
|
-
no longer raises a CouldNotSetAttributeError if the matcher has been qualified
|
371
|
-
in any way (`only_integer`, `greater_than`, `odd`, etc.). ([#784], [#812])
|
372
|
-
|
373
|
-
### Improvements
|
374
|
-
|
375
|
-
* `validate_uniqueness_of` now raises a NonCaseSwappableValueError if the value
|
376
|
-
the matcher is using to test uniqueness cannot be case-swapped -- in other
|
377
|
-
words, if it doesn't contain any alpha characters. When this is the case, the
|
378
|
-
matcher cannot work effectively. ([#789], [ada9bd3])
|
379
|
-
|
380
|
-
[#783]: https://github.com/thoughtbot/shoulda-matchers/pull/783
|
381
|
-
[8fa97b4]: https://github.com/thoughtbot/shoulda-matchers/commit/8fa97b4ff33b57ce16dfb96be1ec892502f2aa9e
|
382
|
-
[#784]: https://github.com/thoughtbot/shoulda-matchers/pull/784
|
383
|
-
[#789]: https://github.com/thoughtbot/shoulda-matchers/pull/789
|
384
|
-
[ada9bd3]: https://github.com/thoughtbot/shoulda-matchers/commit/ada9bd3a1b9f2bb9fa74d0dfe1f8f7080314298c
|
385
|
-
[#812]: https://github.com/thoughtbot/shoulda-matchers/pull/812
|
386
|
-
|
387
|
-
# 3.0.0
|
388
|
-
|
389
|
-
### Backward-incompatible changes
|
390
|
-
|
391
|
-
* We've dropped support for Rails 3.x, Ruby 1.9.2, and Ruby 1.9.3, and RSpec 2.
|
392
|
-
All of these have been end-of-lifed. ([a4045a1], [b7fe87a], [32c0e62])
|
393
|
-
|
394
|
-
* The gem no longer detects the test framework you're using or mixes itself into
|
395
|
-
that framework automatically. [History][no-auto-integration-1] has
|
396
|
-
[shown][no-auto-integration-2] that performing any kind of detection is prone
|
397
|
-
to bugs and more complicated than it should be.
|
398
|
-
|
399
|
-
Here are the updated instructions:
|
400
|
-
|
401
|
-
* You no longer need to say `require: false` in your Gemfile; you can
|
402
|
-
include the gem as normal.
|
403
|
-
* You'll need to add the following somewhere in your `rails_helper` (for
|
404
|
-
RSpec) or `test_helper` (for Minitest / Test::Unit):
|
405
|
-
|
406
|
-
``` ruby
|
407
|
-
Shoulda::Matchers.configure do |config|
|
408
|
-
config.integrate do |with|
|
409
|
-
# Choose a test framework:
|
410
|
-
with.test_framework :rspec
|
411
|
-
with.test_framework :minitest
|
412
|
-
with.test_framework :minitest_4
|
413
|
-
with.test_framework :test_unit
|
414
|
-
|
415
|
-
# Choose one or more libraries:
|
416
|
-
with.library :active_record
|
417
|
-
with.library :active_model
|
418
|
-
with.library :action_controller
|
419
|
-
# Or, choose the following (which implies all of the above):
|
420
|
-
with.library :rails
|
421
|
-
end
|
422
|
-
end
|
423
|
-
```
|
424
|
-
|
425
|
-
([1900071])
|
426
|
-
|
427
|
-
* Previously, under RSpec, all of the matchers were mixed into all of the
|
428
|
-
example groups. This created a problem because some gems, such as
|
429
|
-
[active_model_serializers-matchers], provide matchers that share the same
|
430
|
-
name as some of our own matchers. Now, matchers are only mixed into whichever
|
431
|
-
example group they belong to:
|
432
|
-
|
433
|
-
* ActiveModel and ActiveRecord matchers are available only in model example
|
434
|
-
groups.
|
435
|
-
* ActionController matchers are available only in controller example groups.
|
436
|
-
* The `route` matcher is available only in routing example groups.
|
437
|
-
|
438
|
-
([af98a23], [8cf449b])
|
439
|
-
|
440
|
-
* There are two changes to `allow_value`:
|
441
|
-
|
442
|
-
* The negative form of `allow_value` has been changed so that instead of
|
443
|
-
asserting that any of the given values is an invalid value (allowing good
|
444
|
-
values to pass through), assert that *all* values are invalid values
|
445
|
-
(allowing good values not to pass through). This means that this test which
|
446
|
-
formerly passed will now fail:
|
447
|
-
|
448
|
-
``` ruby
|
449
|
-
expect(record).not_to allow_value('good value', *bad_values)
|
450
|
-
```
|
451
|
-
|
452
|
-
([19ce8a6])
|
453
|
-
|
454
|
-
* `allow_value` now raises a CouldNotSetAttributeError if in setting the
|
455
|
-
attribute, the value of the attribute from reading the attribute back is
|
456
|
-
different from the one used to set it.
|
457
|
-
|
458
|
-
This would happen if the writer method for that attribute has custom logic
|
459
|
-
to ignore certain incoming values or change them in any way. Here are three
|
460
|
-
examples we've seen:
|
461
|
-
|
462
|
-
* You're attempting to assert that an attribute should not allow nil, yet
|
463
|
-
the attribute's writer method contains a conditional to do nothing if
|
464
|
-
the attribute is set to nil:
|
465
|
-
|
466
|
-
``` ruby
|
467
|
-
class Foo
|
468
|
-
include ActiveModel::Model
|
469
|
-
|
470
|
-
attr_reader :bar
|
471
|
-
|
472
|
-
def bar=(value)
|
473
|
-
return if value.nil?
|
474
|
-
@bar = value
|
475
|
-
end
|
476
|
-
end
|
477
|
-
|
478
|
-
describe Foo do
|
479
|
-
it do
|
480
|
-
foo = Foo.new
|
481
|
-
foo.bar = "baz"
|
482
|
-
# This will raise a CouldNotSetAttributeError since `foo.bar` is now "123"
|
483
|
-
expect(foo).not_to allow_value(nil).for(:bar)
|
484
|
-
end
|
485
|
-
end
|
486
|
-
```
|
487
|
-
|
488
|
-
* You're attempting to assert that an numeric attribute should not allow a
|
489
|
-
string that contains non-numeric characters, yet the writer method for
|
490
|
-
that attribute strips out non-numeric characters:
|
491
|
-
|
492
|
-
``` ruby
|
493
|
-
class Foo
|
494
|
-
include ActiveModel::Model
|
495
|
-
|
496
|
-
attr_reader :bar
|
497
|
-
|
498
|
-
def bar=(value)
|
499
|
-
@bar = value.gsub(/\D+/, '')
|
500
|
-
end
|
501
|
-
end
|
502
|
-
|
503
|
-
describe Foo do
|
504
|
-
it do
|
505
|
-
foo = Foo.new
|
506
|
-
# This will raise a CouldNotSetAttributeError since `foo.bar` is now "123"
|
507
|
-
expect(foo).not_to allow_value("abc123").for(:bar)
|
508
|
-
end
|
509
|
-
end
|
510
|
-
```
|
511
|
-
|
512
|
-
* You're passing a value to `allow_value` that the model typecasts into
|
513
|
-
another value:
|
514
|
-
|
515
|
-
``` ruby
|
516
|
-
describe Foo do
|
517
|
-
# Assume that `attr` is a string
|
518
|
-
# This will raise a CouldNotSetAttributeError since `attr` typecasts `[]` to `"[]"`
|
519
|
-
it { should_not allow_value([]).for(:attr) }
|
520
|
-
end
|
521
|
-
```
|
522
|
-
|
523
|
-
With all of these failing examples, why are we making this change? We want
|
524
|
-
to guard you (as the developer) from writing a test that you think acts one
|
525
|
-
way but actually acts a different way, as this could lead to a confusing
|
526
|
-
false positive or negative.
|
527
|
-
|
528
|
-
If you understand the problem and wish to override this behavior so that
|
529
|
-
you do not get a CouldNotSetAttributeError, you can add the
|
530
|
-
`ignoring_interference_by_writer` qualifier like so. Note that this will not
|
531
|
-
always cause the test to pass.
|
532
|
-
|
533
|
-
``` ruby
|
534
|
-
it { should_not allow_value([]).for(:attr).ignoring_interference_by_writer }
|
535
|
-
```
|
536
|
-
|
537
|
-
([9d9dc4e])
|
538
|
-
|
539
|
-
* `validate_uniqueness_of` is now properly case-sensitive by default, to match
|
540
|
-
the default behavior of the validation itself. This is a backward-incompatible
|
541
|
-
change because this test which incorrectly passed before will now fail:
|
542
|
-
|
543
|
-
``` ruby
|
544
|
-
class Product < ActiveRecord::Base
|
545
|
-
validates_uniqueness_of :name, case_sensitive: false
|
546
|
-
end
|
547
|
-
|
548
|
-
describe Product do
|
549
|
-
it { is_expected.to validate_uniqueness_of(:name) }
|
550
|
-
end
|
551
|
-
```
|
552
|
-
|
553
|
-
([57a1922])
|
554
|
-
|
555
|
-
* `ensure_inclusion_of`, `ensure_exclusion_of`, and `ensure_length_of` have been
|
556
|
-
removed in favor of their `validate_*` counterparts. ([55c8d09])
|
557
|
-
|
558
|
-
* `set_the_flash` and `set_session` have been changed to more closely align with
|
559
|
-
each other:
|
560
|
-
* `set_the_flash` has been removed in favor of `set_flash`. ([801f2c7])
|
561
|
-
* `set_session('foo')` is no longer valid syntax, please use
|
562
|
-
`set_session['foo']` instead. ([535fe05])
|
563
|
-
* `set_session['key'].to(nil)` will no longer pass when the key in question
|
564
|
-
has not been set yet. ([535fe05])
|
565
|
-
|
566
|
-
* Change `set_flash` so that `set_flash[:foo].now` is no longer valid syntax.
|
567
|
-
You'll want to use `set_flash.now[:foo]` instead. This was changed in order to
|
568
|
-
more closely align with how `flash.now` works when used in a controller.
|
569
|
-
([#755], [#752])
|
570
|
-
|
571
|
-
* Change behavior of `validate_uniqueness_of` when the matcher is not
|
572
|
-
qualified with any scopes, but your validation is. Previously the following
|
573
|
-
test would pass when it now fails:
|
574
|
-
|
575
|
-
``` ruby
|
576
|
-
class Post < ActiveRecord::Base
|
577
|
-
validate :slug, uniqueness: { scope: :user_id }
|
578
|
-
end
|
579
|
-
|
580
|
-
describe Post do
|
581
|
-
it { should validate_uniqueness_of(:slug) }
|
582
|
-
end
|
583
|
-
```
|
584
|
-
|
585
|
-
([6ac7b81])
|
586
|
-
|
587
|
-
[active_model_serializers-matchers]: https://github.com/adambarber/active_model_serializers-matchers
|
588
|
-
[no-auto-integration-1]: https://github.com/freerange/mocha/commit/049080c673ee3f76e76adc1e1a6122c7869f1648
|
589
|
-
[no-auto-integration-2]: https://github.com/rr/rr/issues/29
|
590
|
-
[1900071]: https://github.com/thoughtbot/shoulda-matchers/commit/190007155e0676aae84d08d8ed8eed3beebc3a06
|
591
|
-
[b7fe87a]: https://github.com/thoughtbot/shoulda-matchers/commit/b7fe87ae915f6b1f99d64e847fea536ad0f78024
|
592
|
-
[a4045a1]: https://github.com/thoughtbot/shoulda-matchers/commit/a4045a1f9bc454e618a7c55960942eb030f02fdd
|
593
|
-
[57a1922]: https://github.com/thoughtbot/shoulda-matchers/commit/57a19228b6a85f12ba7a79a26dae5869c1499c6d
|
594
|
-
[19ce8a6]: https://github.com/thoughtbot/shoulda-matchers/commit/19c38a642a2ae1316ef12540a0185cd026901e74
|
595
|
-
[eaaa2d8]: https://github.com/thoughtbot/shoulda-matchers/commit/eaaa2d83e5cd31a3ca0a1aaa65441ea1a4fffa49
|
596
|
-
[55c8d09]: https://github.com/thoughtbot/shoulda-matchers/commit/55c8d09bf2af886540924efa83c3b518d926a770
|
597
|
-
[801f2c7]: https://github.com/thoughtbot/shoulda-matchers/commit/801f2c7c1eab3b2053244485c9800f850959cfef
|
598
|
-
[535fe05]: https://github.com/thoughtbot/shoulda-matchers/commit/535fe05be8686fdafd8b22f2ed5c4192bd565d50
|
599
|
-
[6ac7b81]: https://github.com/thoughtbot/shoulda-matchers/commit/6ac7b8158cfba3b518eb3da3c24345e4473b416f
|
600
|
-
[#755]: https://github.com/thoughtbot/shoulda-matchers/pull/755
|
601
|
-
[#752]: https://github.com/thoughtbot/shoulda-matchers/pull/752
|
602
|
-
[9d9dc4e]: https://github.com/thoughtbot/shoulda-matchers/commit/9d9dc4e6b9cf2c19df66a1b4ba432ad8d3e5dded
|
603
|
-
[32c0e62]: https://github.com/thoughtbot/shoulda-matchers/commit/32c0e62596b87e37a301f87bbe21cfcc77750552
|
604
|
-
[af98a23]: https://github.com/thoughtbot/shoulda-matchers/commit/af98a23091551fb40aded5a8d4f9e5be926f53a9
|
605
|
-
[8cf449b]: https://github.com/thoughtbot/shoulda-matchers/commit/8cf449b4ca37d0d7446d2cabbfa5a1582358256d
|
606
|
-
|
607
|
-
### Bug fixes
|
608
|
-
|
609
|
-
* So far the tests for the gem have been running against only SQLite. Now they
|
610
|
-
run against PostgreSQL, too. As a result we were able to fix some
|
611
|
-
Postgres-related bugs, specifically around `validate_uniqueness_of`:
|
612
|
-
|
613
|
-
* When scoped to a UUID column that ends in an "f", the matcher is able to
|
614
|
-
generate a proper "next" value without erroring. ([#402], [#587], [#662])
|
615
|
-
|
616
|
-
* Support scopes that are PostgreSQL array columns. Please note that this is
|
617
|
-
only supported for Rails 4.2 and greater, as versions before this cannot
|
618
|
-
handle array columns correctly, particularly in conjunction with the
|
619
|
-
uniqueness validator. ([#554])
|
620
|
-
|
621
|
-
* Fix so that when scoped to a text column and the scope is set to nil before
|
622
|
-
running it through the matcher, the matcher does not fail. ([#521], [#607])
|
623
|
-
|
624
|
-
* Fix `define_enum_for` so that it actually tests that the attribute is present
|
625
|
-
in the list of defined enums, as you could fool it by merely defining a class
|
626
|
-
method that was the pluralized version of the attribute name. In the same
|
627
|
-
vein, passing a pluralized version of the attribute name to `define_enum_for`
|
628
|
-
would erroneously pass, and now it fails. ([#641])
|
629
|
-
|
630
|
-
* Fix `permit` so that it does not break the functionality of
|
631
|
-
ActionController::Parameters#require. ([#648], [#675])
|
632
|
-
|
633
|
-
* Fix `validate_uniqueness_of` + `scoped_to` so that it does not raise an error
|
634
|
-
if a record exists where the scoped attribute is nil. ([#677])
|
635
|
-
|
636
|
-
* Fix `route` matcher so if your route includes a default `format`, you can
|
637
|
-
specify this as a symbol or string. ([#693])
|
638
|
-
|
639
|
-
* Fix `validate_uniqueness_of` so that it allows you to test against scoped
|
640
|
-
attributes that are boolean columns. ([#457], [#694])
|
641
|
-
|
642
|
-
* Fix failure message for `validate_numericality_of` as it sometimes didn't
|
643
|
-
provide the reason for failure. ([#699])
|
644
|
-
|
645
|
-
* Fix `shoulda/matchers/independent` so that it can be required
|
646
|
-
independently, without having to require all of the gem. ([#746], [e0a0200])
|
647
|
-
|
648
|
-
### Features
|
649
|
-
|
650
|
-
* Add `on` qualifier to `permit`. This allows you to make an assertion that
|
651
|
-
a restriction was placed on a slice of the `params` hash and not the entire
|
652
|
-
`params` hash. Although we don't require you to use this qualifier, we do
|
653
|
-
recommend it, as it's a more precise check. ([#675])
|
654
|
-
|
655
|
-
* Add `strict` qualifier to `validate_numericality_of`. ([#620])
|
656
|
-
|
657
|
-
* Add `on` qualifier to `validate_numericality_of`. ([9748869]; h/t [#356],
|
658
|
-
[#358])
|
659
|
-
|
660
|
-
* Add `join_table` qualifier to `have_and_belong_to_many`. ([#556])
|
661
|
-
|
662
|
-
* `allow_values` is now an alias for `allow_value`. This makes more sense when
|
663
|
-
checking against multiple values:
|
664
|
-
|
665
|
-
``` ruby
|
666
|
-
it { should allow_values('this', 'and', 'that') }
|
667
|
-
```
|
668
|
-
|
669
|
-
([#692])
|
670
|
-
|
671
|
-
[9748869]: https://github.com/thoughtbot/shoulda-matchers/commit/97488690910520ed8e1f2e164b1982eff5ef1f19
|
672
|
-
[#402]: https://github.com/thoughtbot/shoulda-matchers/pull/402
|
673
|
-
[#587]: https://github.com/thoughtbot/shoulda-matchers/pull/587
|
674
|
-
[#662]: https://github.com/thoughtbot/shoulda-matchers/pull/662
|
675
|
-
[#554]: https://github.com/thoughtbot/shoulda-matchers/pull/554
|
676
|
-
[#641]: https://github.com/thoughtbot/shoulda-matchers/pull/641
|
677
|
-
[#521]: https://github.com/thoughtbot/shoulda-matchers/pull/521
|
678
|
-
[#607]: https://github.com/thoughtbot/shoulda-matchers/pull/607
|
679
|
-
[#648]: https://github.com/thoughtbot/shoulda-matchers/pull/648
|
680
|
-
[#675]: https://github.com/thoughtbot/shoulda-matchers/pull/675
|
681
|
-
[#677]: https://github.com/thoughtbot/shoulda-matchers/pull/677
|
682
|
-
[#620]: https://github.com/thoughtbot/shoulda-matchers/pull/620
|
683
|
-
[#693]: https://github.com/thoughtbot/shoulda-matchers/pull/693
|
684
|
-
[#356]: https://github.com/thoughtbot/shoulda-matchers/pull/356
|
685
|
-
[#358]: https://github.com/thoughtbot/shoulda-matchers/pull/358
|
686
|
-
[#556]: https://github.com/thoughtbot/shoulda-matchers/pull/556
|
687
|
-
[#457]: https://github.com/thoughtbot/shoulda-matchers/pull/457
|
688
|
-
[#694]: https://github.com/thoughtbot/shoulda-matchers/pull/694
|
689
|
-
[#692]: https://github.com/thoughtbot/shoulda-matchers/pull/692
|
690
|
-
[#699]: https://github.com/thoughtbot/shoulda-matchers/pull/699
|
691
|
-
[#746]: https://github.com/thoughtbot/shoulda-matchers/pull/746
|
692
|
-
[e0a0200]: https://github.com/thoughtbot/shoulda-matchers/commit/e0a0200fe47157c161fb206043540804bdad664e
|
693
|
-
|
694
|
-
# 2.8.0
|
695
|
-
|
696
|
-
### Deprecations
|
697
|
-
|
698
|
-
* `ensure_length_of` has been renamed to `validate_length_of`.
|
699
|
-
`ensure_length_of` is deprecated and will be removed in 3.0.0.
|
700
|
-
|
701
|
-
* `set_the_flash` has been renamed to `set_flash`. `set_the_flash` is
|
702
|
-
deprecated and will be removed in 3.0.0.
|
703
|
-
|
704
|
-
* `set_session(:foo)` is deprecated in favor of `set_session[:foo]`.
|
705
|
-
`set_session(:foo)` will be invalid syntax in 3.0.0.
|
706
|
-
|
707
|
-
* Using `should set_session[:key].to(nil)` to assert that that a value has not
|
708
|
-
been set is deprecated. Please use `should_not set_session[:key]` instead.
|
709
|
-
In 3.0.0, `should set_session[:key].to(nil)` will only pass if the value is
|
710
|
-
truly nil.
|
711
|
-
|
712
|
-
### Bug fixes
|
713
|
-
|
714
|
-
* Fix `delegate_method` so that it works again with shoulda-context. ([#591])
|
715
|
-
|
716
|
-
* Fix `validate_uniqueness_of` when used with `scoped_to` so that when one of
|
717
|
-
the scope attributes is a polymorphic `*_type` attribute and the model has
|
718
|
-
another validation on the same attribute, the matcher does not fail with an
|
719
|
-
error. ([#592])
|
720
|
-
|
721
|
-
* Fix `has_many` used with `through` so that when the association does not
|
722
|
-
exist, and the matcher fails, it does not raise an error when producing the
|
723
|
-
failure message. ([#588])
|
724
|
-
|
725
|
-
* Fix `have_and_belong_to_many` used with `join_table` so that it does not fail
|
726
|
-
when `foreign_key` and/or `association_foreign_key` was specified on the
|
727
|
-
association as a symbol instead of a string. ([#584])
|
728
|
-
|
729
|
-
* Fix `allow_value` when an i18n translation key is passed to `with_message` and
|
730
|
-
the `:against` option is used to specify an alternate attribute. A bug here
|
731
|
-
also happened to affect `validate_confirmation_of` when an i18n translation
|
732
|
-
key is passed to `with_message`. ([#593])
|
733
|
-
|
734
|
-
* Fix `class_name` qualifier for association matchers so that if the model being
|
735
|
-
referenced is namespaced, the matcher will correctly resolve the class before
|
736
|
-
checking it against the association's `class_name`. ([#537])
|
737
|
-
|
738
|
-
* Fix `validate_inclusion_of` used with `with_message` so that it fails if given
|
739
|
-
a message that does not match the message on the validation. ([#598])
|
740
|
-
|
741
|
-
* Fix `route` matcher so that when controller and action are specified in hash
|
742
|
-
notation (e.g. `posts#show`), route parameters such as `id` do not need to be
|
743
|
-
specified as a string but may be specified as a number as well. ([#602])
|
744
|
-
|
745
|
-
### Features
|
746
|
-
|
747
|
-
* Add ability to test `:primary_key` option on associations. ([#597])
|
748
|
-
|
749
|
-
* Add `allow_blank` qualifier to `validate_uniqueness_of` to complement
|
750
|
-
the `allow_blank` option. ([#543])
|
751
|
-
|
752
|
-
* Change `set_session` so that #[] and #to qualifiers are optional, similar to
|
753
|
-
`set_flash`. That is, you can now say `should set_session` to assert that any
|
754
|
-
flash value has been set, or `should set_session.to('value')` to assert that
|
755
|
-
any value in the session is 'value'.
|
756
|
-
|
757
|
-
* Change `set_session` so that its #to qualifier supports regexps, similar to
|
758
|
-
`set_flash`.
|
759
|
-
|
760
|
-
* Add `with_prefix` qualifier to `delegate_method` to correspond to the `prefix`
|
761
|
-
option for Rails's `delegate` macro. ([#622])
|
762
|
-
|
763
|
-
* Add support for Rails 4.2, especially fixing `serialize` matcher to remove
|
764
|
-
warning about `serialized_attributes` being deprecated. ([#627])
|
765
|
-
|
766
|
-
* Update `dependent` qualifier on association matchers to support `:destroy`,
|
767
|
-
`:delete`, `:nullify`, `:restrict`, `:restrict_with_exception`, and
|
768
|
-
`:restrict_with_error`. You can also pass `true` or `false` to assert that
|
769
|
-
the association has (or has not) been declared with *any* dependent option.
|
770
|
-
([#631])
|
771
|
-
|
772
|
-
### Improvements
|
773
|
-
|
774
|
-
* Tweak `allow_value` failure message so that it reads a bit nicer when listing
|
775
|
-
existing errors.
|
776
|
-
|
777
|
-
[#591]: https://github.com/thoughtbot/shoulda-matchers/pull/591
|
778
|
-
[#592]: https://github.com/thoughtbot/shoulda-matchers/pull/592
|
779
|
-
[#588]: https://github.com/thoughtbot/shoulda-matchers/pull/588
|
780
|
-
[#584]: https://github.com/thoughtbot/shoulda-matchers/pull/584
|
781
|
-
[#593]: https://github.com/thoughtbot/shoulda-matchers/pull/593
|
782
|
-
[#597]: https://github.com/thoughtbot/shoulda-matchers/pull/597
|
783
|
-
[#537]: https://github.com/thoughtbot/shoulda-matchers/pull/537
|
784
|
-
[#598]: https://github.com/thoughtbot/shoulda-matchers/pull/598
|
785
|
-
[#602]: https://github.com/thoughtbot/shoulda-matchers/pull/602
|
786
|
-
[#543]: https://github.com/thoughtbot/shoulda-matchers/pull/543
|
787
|
-
[#622]: https://github.com/thoughtbot/shoulda-matchers/pull/622
|
788
|
-
[#627]: https://github.com/thoughtbot/shoulda-matchers/pull/627
|
789
|
-
[#631]: https://github.com/thoughtbot/shoulda-matchers/pull/631
|
790
|
-
|
791
|
-
# 2.7.0
|
792
|
-
|
793
|
-
### Deprecations
|
794
|
-
|
795
|
-
* `ensure_inclusion_of` has been renamed to `validate_inclusion_of`.
|
796
|
-
`ensure_inclusion_of` is deprecated and will be removed in 3.0.0.
|
797
|
-
|
798
|
-
* `ensure_exclusion_of` has been renamed to `validate_exclusion_of`.
|
799
|
-
`ensure_exclusion_of` is deprecated and will be removed in 3.0.0.
|
800
|
-
|
801
|
-
### Bug fixes
|
802
|
-
|
803
|
-
* Fix `delegate_method` so that it does not raise an error if the method that
|
804
|
-
returns the delegate object is private.
|
805
|
-
|
806
|
-
* Warn when `ensure_inclusion_of` is chained with `.in_array([false, true])`
|
807
|
-
as well as with `.in_array([true, false])`.
|
808
|
-
|
809
|
-
* Fix `set_session` so that the `to` qualifier if given nil checks that the
|
810
|
-
session variable in question was set to nil (previously this actually did
|
811
|
-
nothing).
|
812
|
-
|
813
|
-
* Fix `filter_param` so that it works when `config.filter_parameters` contains
|
814
|
-
regexes.
|
815
|
-
|
816
|
-
* Fix `delegate_method` so that it can be required independent of Active
|
817
|
-
Support.
|
818
|
-
|
819
|
-
* Fix `validate_uniqueness_of`. When used against an unpersisted record whose
|
820
|
-
model contained a non-nullable column other than the one being validated, the
|
821
|
-
matcher would break. Even if the test set that column to a value beforehand,
|
822
|
-
the record had to be persisted in order for the matcher to work. Now this is
|
823
|
-
no longer the case and the record can remain unpersisted.
|
824
|
-
|
825
|
-
* Fix `validate_absence_of`: it required that a string be passed as the
|
826
|
-
attribute name rather than a symbol (which is the usual and documented usage).
|
827
|
-
|
828
|
-
### Features
|
829
|
-
|
830
|
-
* Add new matcher `define_enum_for` to test usage of the `enum` macro introduced
|
831
|
-
in Rails 4.1.
|
832
|
-
|
833
|
-
### Improvements
|
834
|
-
|
835
|
-
* `have_and_belongs_to_many` now checks to make sure that the join table
|
836
|
-
contains the correct columns for the left- and right-hand side of the
|
837
|
-
association.
|
838
|
-
|
839
|
-
* Reword failure message for `delegate_method` so that it's a little more
|
840
|
-
helpful.
|
841
|
-
|
842
|
-
# 2.6.2
|
843
|
-
|
844
|
-
### Bug fixes
|
845
|
-
|
846
|
-
* If you have a Rails >= 4.1 project and you are running tests using Spring,
|
847
|
-
matchers that depend on assertions within Rails' testing layer (e.g.
|
848
|
-
`render_template` and `route`) will no longer fail.
|
849
|
-
|
850
|
-
* Fix `permit` so that it can be used more than once in the same test.
|
851
|
-
|
852
|
-
* Revert change to `validate_uniqueness_of` made in 2.6.0 so that it no longer
|
853
|
-
provides default values for non-primary, non-nullable columns. This approach
|
854
|
-
was causing test failures because it makes the assumption that none of these
|
855
|
-
columns allow only specific values, which is not true. If you get an error
|
856
|
-
from `validate_uniqueness_of`, your best bet continues to be creating a record
|
857
|
-
manually and calling `validate_uniqueness_of` on that instead.
|
858
|
-
|
859
|
-
* The majority of warnings that the gem produced have been removed. The gem
|
860
|
-
still produces warnings under Ruby 1.9.3; we will address this in a future
|
861
|
-
release.
|
862
|
-
|
863
|
-
# 2.6.1
|
864
|
-
|
865
|
-
### Bug fixes
|
866
|
-
|
867
|
-
* Revert changes to `validate_numericality_of` made in the last release, which
|
868
|
-
made it so that comparison qualifiers specified on the validation are tested
|
869
|
-
using a very small decimal number offset rather than a whole number by
|
870
|
-
default, except if the matcher was qualified with `only_integer`. This means
|
871
|
-
that prior to 2.6.0, if your validation specified `only_integer` and you did
|
872
|
-
not, then after 2.6.0 that test would fail. This is now fixed.
|
873
|
-
|
874
|
-
* Fix regression in previous release where ActiveRecord matchers would not be
|
875
|
-
included when ActiveRecord wasn't defined (i.e. if you were using ActiveModel
|
876
|
-
only).
|
877
|
-
|
878
|
-
* Revert the behavior of `allow_value` changed in 2.6.0 (it will no longer raise
|
879
|
-
CouldNotClearAttribute). This was originally done as a part of a fix for
|
880
|
-
`validate_presence_of` when used in conjunction with `has_secure_password`.
|
881
|
-
That fix has been updated so that it does not affect `allow_value`.
|
882
|
-
|
883
|
-
* Fix callback matchers and correct test coverage.
|
884
|
-
|
885
|
-
* Fix `permit` so that it does not interfere with different usages of `params`
|
886
|
-
in your controller action. Specifically, this will not raise an error:
|
887
|
-
`params.fetch(:foo, {}).permit(:bar, :baz)` (the `permit` will have no
|
888
|
-
problems recognizing that :bar and :baz are permitted params).
|
889
|
-
|
890
|
-
* Fix `permit` on Rails 4.1 to use PATCH by default for #update instead of PUT.
|
891
|
-
Previously you had to specify this manually.
|
892
|
-
|
893
|
-
* Fix `permit` so that it track multiple calls to #permit in your controller
|
894
|
-
action. Previously only the last usage of #permit would be considered in
|
895
|
-
determining whether the matcher matched.
|
896
|
-
|
897
|
-
* Fix `permit` so that if the route for your action requires params (such as id)
|
898
|
-
then you can now specify those params:
|
899
|
-
`permit(:first_name, :last_name).for(:update, params: { id: 42 })`.
|
900
|
-
|
901
|
-
* Fix `delegate_method` so that it does not stub the target method forever,
|
902
|
-
returning it to its original implementation after the match ends.
|
903
|
-
|
904
|
-
* Fix `validate_uniqueness_of` to work with Rails 4.1 enum columns.
|
905
|
-
|
906
|
-
### Features
|
907
|
-
|
908
|
-
* Teach `with_message` qualifier on `allow_value` to accept a hash of i18n
|
909
|
-
interpolation values:
|
910
|
-
`allow_value('foo').for(:attr).with_message(:greater_than, values: { count: 20 })`.
|
911
|
-
|
912
|
-
# 2.6.0
|
913
|
-
|
914
|
-
* The boolean argument to `have_db_index`'s `unique` option is now optional, for
|
915
|
-
consistency with other matchers.
|
916
|
-
|
917
|
-
* Association matchers now test that the model being referred to (either
|
918
|
-
implicitly or explicitly, using `:class_name`) actually exists.
|
919
|
-
|
920
|
-
* Add ability to test `:autosave` option on associations.
|
921
|
-
|
922
|
-
* Fix `validate_uniqueness_of(...).allow_nil` so that it can be used against an
|
923
|
-
non-password attribute which is in a model that `has_secure_password`. Doing
|
924
|
-
so previously would result in a "Password digest missing on new record" error.
|
925
|
-
|
926
|
-
* Fix description for `validate_numericality_of` so that if the matcher fails,
|
927
|
-
the error message reported does not say the matcher accepts integer values if
|
928
|
-
you didn't specify that.
|
929
|
-
|
930
|
-
* Fix `ensure_inclusion_of` so that you can use it against a boolean column
|
931
|
-
(and pass boolean values to `in_array`). There are two caveats:
|
932
|
-
|
933
|
-
* You should not test that your attribute allows both true and false
|
934
|
-
(`.in_array([true, false]`); there's no way to test that it doesn't accept
|
935
|
-
anything other than that.
|
936
|
-
* You cannot test that your attribute allows nil (`.in_array([nil])`) if
|
937
|
-
the column does not allow null values.
|
938
|
-
|
939
|
-
* Change `validate_uniqueness_of(...)` so that it provides default values for
|
940
|
-
non-nullable attributes.
|
941
|
-
|
942
|
-
* Running `rake` now installs Appraisals before running the test suite.
|
943
|
-
(Additionally, we now manage Appraisals using the `appraisal` executable in
|
944
|
-
Appraisal 1.0.0.)
|
945
|
-
|
946
|
-
* Add `allow_nil` option to `validate_numericality_of` so that you can validate
|
947
|
-
that numeric values are validated only if a value is supplied.
|
948
|
-
|
949
|
-
* Fix `validate_numericality_of` so that test fails when the value with
|
950
|
-
`greater_than`, `greater_than_or_equal_to`, `less_than`, `less_than_or_equal_
|
951
|
-
to` or `equal_to` is not appropriate.
|
952
|
-
|
953
|
-
* Change `validate_presence_of` under Rails 4 so that if you are using it with a
|
954
|
-
user whose model `has_secure_password` and whose password is set to a value,
|
955
|
-
you will be instructed to use a user whose password is blank instead. The
|
956
|
-
reason for this change is due to the fact that Rails 4's version of
|
957
|
-
`has_secure_password` defines #password= such that `nil` will be ignored,
|
958
|
-
which interferes with how `validate_presence_of` works.
|
959
|
-
|
960
|
-
* Add ability to test `belongs_to` associations defined with `:inverse_of`.
|
961
|
-
|
962
|
-
* Add back matchers that were removed in 2.0.0: `permit`, for testing strong
|
963
|
-
parameters, and `delegate_method`, for testing delegation.
|
964
|
-
|
965
|
-
* Add new matchers for testing controller filters: `before_filter`,
|
966
|
-
`after_filter`, and `around_filter` (aliased to `before_action`,
|
967
|
-
`after_action` and `around_action` for Rails 4).
|
968
|
-
|
969
|
-
* Fix `rescue_from` matcher so that it does not raise an error when testing
|
970
|
-
a method handler which has been marked as protected or private.
|
971
|
-
|
972
|
-
* Fix compatibility issues with Rails 4.1:
|
973
|
-
* `set_the_flash` and `have_and_belongs_to_many` no longer raise errors
|
974
|
-
* Minitest no longer prints warnings whenever shoulda-matchers is required
|
975
|
-
|
976
|
-
# v 2.5.0
|
977
|
-
|
978
|
-
* Fix Rails/Test::Unit integration to ensure that the test case classes we are
|
979
|
-
re-opening actually exist.
|
980
|
-
|
981
|
-
* Fix `ensure_length_of` so that it uses the right message to validate when
|
982
|
-
`is_equal_to` is specified in conjunction with a custom message.
|
983
|
-
|
984
|
-
* The `route` matcher now accepts specifying a controller/action pair as a
|
985
|
-
string instead of only a hash (e.g. `route(...).to('posts#index')` instead of
|
986
|
-
`route(...).to(controller: 'posts', action: 'index')`).
|
987
|
-
|
988
|
-
* The `ensure_inclusion_of` matcher now works with a decimal column.
|
989
|
-
|
990
|
-
* Under Rails 3, if you had an association matcher chained with the
|
991
|
-
the `order` submatcher -- e.g. `should have_many(:foos).order(:bar)` -- and
|
992
|
-
your association had an `:include` on it, using the matcher would raise an
|
993
|
-
error. This has been fixed.
|
994
|
-
|
995
|
-
* Fix `validate_uniqueness_of` so it doesn't fail if the attribute under
|
996
|
-
test has a limit of fewer than 16 characters.
|
997
|
-
|
998
|
-
* You can now test that your `has_many :through` or `has_one :through`
|
999
|
-
associations are defined with a `:source` option.
|
1000
|
-
|
1001
|
-
* Add new matcher `validates_absence_of`.
|
1002
|
-
|
1003
|
-
* Update matchers so that they use `failure_message` and
|
1004
|
-
`failure_message_when_negated` to define error messages. These are new methods
|
1005
|
-
in the upcoming RSpec 3 release which replace `failure_message_for_should` and
|
1006
|
-
`failure_message_for_should_not`. We've kept backward compatibility so all of
|
1007
|
-
your existing tests should still work -- this is just to make sure when RSpec
|
1008
|
-
3 is released you don't get a bunch of warnings.
|
1009
|
-
|
1010
|
-
# v 2.4.0
|
1011
|
-
|
1012
|
-
* Fix a bug with the `validate_numericality_of` matcher that would not allow the
|
1013
|
-
`with_message` option on certain submatchers.
|
1014
|
-
|
1015
|
-
* Fix a regression with context-dependent validations in ActiveResource
|
1016
|
-
|
1017
|
-
* shoulda-matchers is now fully compatible with Rails 4.
|
1018
|
-
|
1019
|
-
* When not using RSpec, shoulda-matchers is now auto-included into
|
1020
|
-
ActiveSupport::TestCase instead of Test::Unit::TestCase (in Rails 4
|
1021
|
-
the former no longer inherits from the latter).
|
1022
|
-
|
1023
|
-
# v 2.3.0
|
1024
|
-
|
1025
|
-
* Fix a bug in `ensure_inclusion_of` that would cause issues with using
|
1026
|
-
`in_array` with an integer value.
|
1027
|
-
|
1028
|
-
* Add support for PostgreSQL UUID columns to `validates_uniqueness_of` (#334).
|
1029
|
-
|
1030
|
-
* Fix `validates_numericality_of` so that `is_equal_to` submatcher works
|
1031
|
-
correctly (#326).
|
1032
|
-
|
1033
|
-
* Fix context support for validation matchers and disallowed values (#313).
|
1034
|
-
|
1035
|
-
* Add a `counter_cache` submatcher for `belongs_to` associations (#311).
|
1036
|
-
|
1037
|
-
* Add a `rescue_from` matcher for Rails controllers which checks that the
|
1038
|
-
correct ActiveSupport call has been made and that the handlers exist without
|
1039
|
-
actually throwing an exception (#287).
|
1040
|
-
|
1041
|
-
* Changed the scope of AssociationMatcher methods from protected to private.
|
1042
|
-
|
1043
|
-
* Extracted `#order`, `#through`, and `#dependent` from AssociationMatcher as
|
1044
|
-
their own submatchers.
|
1045
|
-
|
1046
|
-
# v 2.2.0
|
1047
|
-
|
1048
|
-
* Fix `have_and_belong_to_many` matcher issue for Rails 4.
|
1049
|
-
|
1050
|
-
* Fix `validate_uniqueness_of.scoped_to` issue when the scoped field is already
|
1051
|
-
taken (#207).
|
1052
|
-
|
1053
|
-
* Add comparison submatchers to `validate_numericality_of` to correspond to the
|
1054
|
-
comparison options you can give to `validates_numericality_of` (#244).
|
1055
|
-
|
1056
|
-
# v 2.1.0
|
1057
|
-
|
1058
|
-
* Add missing `failure_message_for_should_not` implementations to
|
1059
|
-
`validate_numericality_of` and its submatchers
|
1060
|
-
|
1061
|
-
* Support validation contexts for testing validations `on: :create` and when
|
1062
|
-
using custom contexts like `model.valid?(:my_context)`.
|
1063
|
-
|
1064
|
-
* Fix a bug in validations with autosaved models.
|
1065
|
-
|
1066
|
-
* Fix maximum value detection for the `ensure_inclusion_of` and
|
1067
|
-
`ensure_exclusion_of` matchers.
|
1068
|
-
|
1069
|
-
* Add `:odd` and `:even` options to the `validate_numericality_of` matcher.
|
1070
|
-
|
1071
|
-
* Add `:touch` option to AssociationMatcher.
|
1072
|
-
|
1073
|
-
* Ruby 2.0.0 is now officially supported.
|
1074
|
-
|
1075
|
-
* Fix the issue where using `%{attribute}` or `%{model}` in I18n translations
|
1076
|
-
raised exceptions.
|
1077
|
-
|
1078
|
-
* Support datetime columns in `validate_uniqueness_of.scoped_to`.
|
1079
|
-
|
1080
|
-
* Add `allow_nil` option to the `validate_uniqueness_of` matcher.
|
1081
|
-
|
1082
|
-
# v 2.0.0
|
1083
|
-
* Remove the following matchers:
|
1084
|
-
* `assign_to`
|
1085
|
-
* `respond_with_content_type`
|
1086
|
-
* `query_the_database`
|
1087
|
-
* `validate_format_of`
|
1088
|
-
* `have_sent_email`
|
1089
|
-
* `permit` (strong parameters matcher)
|
1090
|
-
* `delegate_method`
|
1091
|
-
|
1092
|
-
* For more information about 2.0 changes, see:
|
1093
|
-
http://robots.thoughtbot.com/post/47031676783/shoulda-matchers-2-0.
|
1094
|
-
|
1095
|
-
# v 1.5.6
|
1096
|
-
* Revert previous change in AllowValueMatcher that added a check for a
|
1097
|
-
properly-set attribute.
|
1098
|
-
|
1099
|
-
# v 1.5.5
|
1100
|
-
* AllowValueMatcher checks that the right value is used for attempts at
|
1101
|
-
setting the attribute with it.
|
1102
|
-
* Please note that previously-passing tests might now fail. It is likely that
|
1103
|
-
it's not a bug, but please make sure that the code you're testing is written
|
1104
|
-
properly before submitting an issue.
|
1105
|
-
|
1106
|
-
* Use DisallowValueMatcher for `disallows_value_of` method.
|
1107
|
-
|
1108
|
-
* Assert `class_name` value on real class name for AssociationMatcher.
|
1109
|
-
|
1110
|
-
* Correct the variable used for `validate_confirmation_of` matcher description.
|
1111
|
-
|
1112
|
-
# v 1.5.4
|
1113
|
-
* Properly-released version of 1.5.3.
|
1114
|
-
|
1115
|
-
# v 1.5.3 - yanked due to mis-release
|
1116
|
-
* Alleviate the need to add `rspec` gem to your app.
|
1117
|
-
|
1118
|
-
# v 1.5.1
|
1119
|
-
* Bump version dependency of Bourne to allow for Mocha upgrade.
|
1120
|
-
|
1121
|
-
* Should fix incompatibility with MiniTest.
|
1122
|
-
|
1123
|
-
# v 1.5.0
|
1124
|
-
* Deprecate the following matchers:
|
1125
|
-
* `assign_to`
|
1126
|
-
* `respond_with_content_type`
|
1127
|
-
* `query_the_database`
|
1128
|
-
* `validate_format_of`
|
1129
|
-
* `have_sent_email`
|
1130
|
-
* `permit` (strong parameters matcher)
|
1131
|
-
* `delegate_method`
|
1132
|
-
|
1133
|
-
* Use RSpec's native `configure.include` syntax for including matchers into
|
1134
|
-
RSpec (#204).
|
1135
|
-
|
1136
|
-
* Do not force MiniTest loading when test-unit is available (this was fixed
|
1137
|
-
before 1.3.0 then reverted in 1.3.0).
|
1138
|
-
|
1139
|
-
# v1.4.2
|
1140
|
-
* Add a new `delegate_method` matcher.
|
1141
|
-
|
1142
|
-
# v1.4.1
|
1143
|
-
* Fix an issue when used with Test::Unit on the allow value matcher.
|
1144
|
-
|
1145
|
-
* Fix an issue with using `ensure_inclusion_of(:attr)` given an array of true or false values.
|
1146
|
-
|
1147
|
-
# v1.4.0
|
1148
|
-
|
1149
|
-
* Add `strict` option to validation matchers.
|
1150
|
-
|
1151
|
-
* Verify that arguments to `set_the_flash` matcher are valid.
|
1152
|
-
|
1153
|
-
* Fix issue in ValidateUniquenessMatcher that could cause an error on postgres.
|
1154
|
-
|
1155
|
-
* You can now pass an array to `ensure_exclusion_of` using `in_array`.
|
1156
|
-
|
1157
|
-
* Allow testing of `:foreign_key` option for `has_one` relationships using the association matcher.
|
1158
|
-
|
1159
|
-
* Fix bug where `ensure_length_of` would pass if the given string was too long.
|
1160
|
-
|
1161
|
-
* `allow_blank` will now allow values such as: ' ', '\n', and '\r'.
|
1162
|
-
|
1163
|
-
* Test outside values for `ensure_inclusion_of` when given an array.
|
1164
|
-
|
1165
|
-
* Fix the output of the `set_the_flash` matcher.
|
1166
|
-
|
1167
|
-
# v1.3.0
|
1168
|
-
|
1169
|
-
* `validate_format_of` will accept `allow_blank(bool)` and `allow_nil(bool)`.
|
1170
|
-
|
1171
|
-
* Prefer Test::Unit to MiniTest when loading integrations so that RubyMine is
|
1172
|
-
happy (#88).
|
1173
|
-
|
1174
|
-
* `validates_uniqueness_of` will now create a record if one does not exist.
|
1175
|
-
Previously, users were required to create a record in the database before
|
1176
|
-
using this matcher.
|
1177
|
-
|
1178
|
-
* Fix an edge case when where the matchers weren't loaded into Test::Unit when
|
1179
|
-
mixing RSpec and Test::Unit tests and also loading both the 'rspec-rails' gem
|
1180
|
-
and 'shoulda-matchers' gem from the same Gemfile group, namely [:test,
|
1181
|
-
:development].
|
1182
|
-
|
1183
|
-
* `controller.should_not render_partial` now correctly matches `render partial: "partial"`.
|
1184
|
-
|
1185
|
-
# v1.2.0
|
1186
|
-
|
1187
|
-
* `ensure_inclusion_of` now has an `in_array` parameter:
|
1188
|
-
`ensure_inclusion_of(:attr).in_array(['foo', 'bar'])`. It cannot be used with
|
1189
|
-
the `.in_range` option. (vpereira)
|
1190
|
-
|
1191
|
-
* `ensure_in_inclusion_of` with `in_array` will accept `allow_blank(bool)` and `allow_nil(false)`
|
1192
|
-
|
1193
|
-
* Test against Rails 3.2.
|
1194
|
-
|
1195
|
-
* Fix `ensure_length_of` to use all possible I18n error messages.
|
1196
|
-
|
1197
|
-
* `have_db_index.unique(nil)` used to function exactly the same as
|
1198
|
-
`have_db_index` with no unique option. It now functions the same as
|
1199
|
-
`have_db_index.unique(false)`.
|
1200
|
-
|
1201
|
-
* In 1.1.0, `have_sent_email` checked all emails to ensure they matched. It now
|
1202
|
-
checks that only one email matches, which restores 1.0.0 behavior.
|
1203
|
-
|
1204
|
-
# v1.1.0
|
1205
|
-
|
1206
|
-
* Add `only_integer` option to `validate_numericality_of`:
|
1207
|
-
`should validate_numericality_of(:attribute).only_integer`
|
1208
|
-
|
1209
|
-
* Add a `query_the_database` matcher:
|
1210
|
-
|
1211
|
-
`it { should query_the_database(4.times).when_calling(:complicated_method) }`
|
1212
|
-
`it { should query_the_database(4.times).or_less.when_calling(:complicated_method) }`
|
1213
|
-
`it { should_not query_the_database.when_calling(:complicated_method) }`
|
1214
|
-
|
1215
|
-
* Database columns are now correctly checked for primality. E.G., this works
|
1216
|
-
now: `it { should have_db_column(:id).with_options(:primary => true) }`
|
1217
|
-
|
1218
|
-
* The flash matcher can check specific flash keys using [], like so:
|
1219
|
-
`it { should set_the_flash[:alert].to("Password doesn't match") }`
|
1220
|
-
|
1221
|
-
* The `have_sent_email` matcher can check `reply_to`:
|
1222
|
-
` it { should have_sent_email.reply_to([user, other]) }`
|
1223
|
-
|
1224
|
-
* Add `validates_confirmation_of` matcher:
|
1225
|
-
`it { should validate_confirmation_of(:password) }`
|
1226
|
-
|
1227
|
-
* Add `serialize` matcher:
|
1228
|
-
`it { should serialize(:details).as(Hash).as_instance_of(Hash) }`
|
1229
|
-
|
1230
|
-
* shoulda-matchers checks for all possible I18n keys, instead of just
|
1231
|
-
e.g. `activerecord.errors.messages.blank`
|
1232
|
-
|
1233
|
-
* Add `accept_nested_attributes` matcher
|
1234
|
-
|
1235
|
-
* Our very first dependency: ActiveSupport >= 3.0.0
|