shoulda-matchers 2.7.0 → 2.8.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -3
- data/Appraisals +18 -0
- data/CONTRIBUTING.md +13 -29
- data/Gemfile +1 -4
- data/Gemfile.lock +2 -10
- data/NEWS.md +100 -14
- data/README.md +62 -58
- data/Rakefile +9 -16
- data/gemfiles/3.0.gemfile +11 -12
- data/gemfiles/3.0.gemfile.lock +15 -10
- data/gemfiles/3.1.gemfile +11 -12
- data/gemfiles/3.1.gemfile.lock +14 -10
- data/gemfiles/3.1_1.9.2.gemfile +12 -11
- data/gemfiles/3.1_1.9.2.gemfile.lock +14 -3
- data/gemfiles/3.2.gemfile +11 -12
- data/gemfiles/3.2.gemfile.lock +15 -10
- data/gemfiles/3.2_1.9.2.gemfile +12 -11
- data/gemfiles/3.2_1.9.2.gemfile.lock +14 -2
- data/gemfiles/4.0.0.gemfile +10 -12
- data/gemfiles/4.0.0.gemfile.lock +13 -10
- data/gemfiles/4.0.1.gemfile +10 -12
- data/gemfiles/4.0.1.gemfile.lock +13 -10
- data/gemfiles/4.1.gemfile +13 -15
- data/gemfiles/4.1.gemfile.lock +45 -50
- data/gemfiles/4.2.gemfile +36 -0
- data/gemfiles/4.2.gemfile.lock +245 -0
- data/lib/shoulda/matchers.rb +3 -1
- data/lib/shoulda/matchers/action_controller.rb +1 -1
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
- data/lib/shoulda/matchers/action_controller/route_params.rb +9 -4
- data/lib/shoulda/matchers/action_controller/{set_the_flash_matcher.rb → set_flash_matcher.rb} +34 -26
- data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +125 -69
- data/lib/shoulda/matchers/active_model.rb +1 -2
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +18 -5
- data/lib/shoulda/matchers/active_model/exception_message_finder.rb +2 -2
- data/lib/shoulda/matchers/active_model/helpers.rb +4 -4
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +10 -3
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +3 -1
- data/lib/shoulda/matchers/active_model/{ensure_length_of_matcher.rb → validate_length_of_matcher.rb} +30 -20
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +21 -0
- data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -2
- data/lib/shoulda/matchers/active_record.rb +2 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +96 -2
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +3 -3
- data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +22 -2
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +30 -4
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +19 -3
- data/lib/shoulda/matchers/active_record/uniqueness.rb +14 -0
- data/lib/shoulda/matchers/active_record/uniqueness/model.rb +45 -0
- data/lib/shoulda/matchers/active_record/uniqueness/namespace.rb +36 -0
- data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +50 -0
- data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +24 -0
- data/lib/shoulda/matchers/{active_model → active_record}/validate_uniqueness_of_matcher.rb +76 -16
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +117 -51
- data/lib/shoulda/matchers/independent/delegate_method_matcher/target_not_defined_error.rb +1 -1
- data/lib/shoulda/matchers/matcher_context.rb +35 -0
- data/lib/shoulda/matchers/rails_shim.rb +23 -0
- data/lib/shoulda/matchers/util.rb +28 -0
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/SUPPORTED_VERSIONS +1 -1
- data/spec/acceptance/active_model_integration_spec.rb +20 -0
- data/spec/acceptance/independent_matchers_spec.rb +64 -0
- data/spec/acceptance/rails_integration_spec.rb +142 -0
- data/spec/acceptance_spec_helper.rb +23 -0
- data/spec/support/acceptance/helpers.rb +29 -0
- data/spec/support/acceptance/helpers/active_model_helpers.rb +11 -0
- data/spec/support/acceptance/helpers/array_helpers.rb +13 -0
- data/spec/support/acceptance/helpers/base_helpers.rb +14 -0
- data/spec/support/acceptance/helpers/command_helpers.rb +51 -0
- data/spec/support/acceptance/helpers/file_helpers.rb +19 -0
- data/spec/support/acceptance/helpers/gem_helpers.rb +31 -0
- data/spec/support/acceptance/helpers/minitest_helpers.rb +19 -0
- data/spec/support/acceptance/helpers/pluralization_helpers.rb +13 -0
- data/spec/support/acceptance/helpers/rails_version_helpers.rb +11 -0
- data/spec/support/acceptance/helpers/rspec_helpers.rb +26 -0
- data/spec/support/acceptance/helpers/ruby_version_helpers.rb +9 -0
- data/spec/support/acceptance/helpers/step_helpers.rb +117 -0
- data/spec/support/acceptance/matchers/have_output.rb +31 -0
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +55 -0
- data/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +103 -0
- data/spec/support/tests/bundle.rb +94 -0
- data/spec/support/tests/command_runner.rb +214 -0
- data/spec/support/tests/filesystem.rb +77 -0
- data/spec/support/tests/version.rb +45 -0
- data/spec/support/unit/capture.rb +34 -0
- data/spec/support/unit/helpers/active_model_helpers.rb +25 -0
- data/spec/support/unit/helpers/active_model_versions.rb +20 -0
- data/spec/support/unit/helpers/active_resource_builder.rb +27 -0
- data/spec/support/unit/helpers/allow_value_matcher_helpers.rb +15 -0
- data/spec/support/unit/helpers/class_builder.rb +72 -0
- data/spec/support/unit/helpers/confirmation_matcher_helpers.rb +17 -0
- data/spec/support/unit/helpers/controller_builder.rb +91 -0
- data/spec/support/unit/helpers/i18n_faker.rb +15 -0
- data/spec/support/unit/helpers/mailer_builder.rb +12 -0
- data/spec/support/unit/helpers/model_builder.rb +102 -0
- data/spec/support/unit/helpers/rails_versions.rb +28 -0
- data/spec/support/unit/i18n.rb +7 -0
- data/spec/support/unit/matchers/deprecate.rb +60 -0
- data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +50 -0
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +50 -0
- data/spec/support/unit/matchers/print_warning_including.rb +59 -0
- data/spec/support/unit/rails_application.rb +110 -0
- data/spec/support/unit/record_builder_with_i18n_validation_message.rb +69 -0
- data/spec/support/unit/record_validating_confirmation_builder.rb +56 -0
- data/spec/support/unit/record_with_different_error_attribute_builder.rb +92 -0
- data/spec/support/{shared_examples → unit/shared_examples}/numerical_submatcher.rb +0 -2
- data/spec/support/{shared_examples → unit/shared_examples}/numerical_type_submatcher.rb +0 -2
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/callback_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/filter_param_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/redirect_to_matcher_spec.rb +3 -3
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/render_template_matcher_spec.rb +2 -4
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/render_with_layout_matcher_spec.rb +9 -6
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/rescue_from_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/respond_with_matcher_spec.rb +2 -2
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +126 -0
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/route_params_spec.rb +2 -2
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +167 -0
- data/spec/unit/shoulda/matchers/action_controller/set_session_matcher_spec.rb +294 -0
- data/spec/{shoulda → unit/shoulda}/matchers/action_controller/strong_parameters_matcher_spec.rb +19 -11
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/allow_value_matcher_spec.rb +49 -21
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/disallow_value_matcher_spec.rb +8 -4
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/exception_message_finder_spec.rb +4 -4
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/have_secure_password_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/helpers_spec.rb +7 -3
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_absence_of_matcher_spec.rb +3 -3
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_acceptance_of_matcher_spec.rb +2 -2
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +63 -0
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_exclusion_of_matcher_spec.rb +5 -4
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_inclusion_of_matcher_spec.rb +7 -14
- data/spec/{shoulda/matchers/active_model/ensure_length_of_matcher_spec.rb → unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb} +43 -23
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_numericality_of_matcher_spec.rb +3 -4
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_presence_of_matcher_spec.rb +3 -3
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_uniqueness_of_matcher_spec.rb +127 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_model/validation_message_finder_spec.rb +8 -6
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/association_matcher_spec.rb +217 -26
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/association_matchers/model_reflection_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/define_enum_for_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_db_column_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_db_index_matcher_spec.rb +8 -5
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_readonly_attributes_matcher_spec.rb +2 -2
- data/spec/{shoulda → unit/shoulda}/matchers/active_record/serialize_matcher_spec.rb +3 -3
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_collection_spec.rb +29 -7
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_implementation_registry_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_spec.rb +20 -10
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/object_double_spec.rb +1 -1
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/proxy_implementation_spec.rb +13 -6
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/stub_implementation_spec.rb +2 -2
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +77 -0
- data/spec/{shoulda → unit/shoulda}/matchers/doublespeak_spec.rb +11 -3
- data/spec/{shoulda → unit/shoulda}/matchers/independent/delegate_method_matcher/stubbed_target_spec.rb +1 -1
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +517 -0
- data/spec/unit_spec_helper.rb +66 -0
- data/spec/warnings_spy/partitioner.rb +10 -3
- data/spec/warnings_spy/reader.rb +9 -20
- data/spec/warnings_spy/reporter.rb +2 -1
- metadata +212 -149
- data/features/activemodel_integration.feature +0 -15
- data/features/rails_integration.feature +0 -160
- data/features/step_definitions/activemodel_steps.rb +0 -21
- data/features/step_definitions/rails_steps.rb +0 -227
- data/features/support/env.rb +0 -6
- data/spec/shoulda/matchers/action_controller/route_matcher_spec.rb +0 -70
- data/spec/shoulda/matchers/action_controller/set_session_matcher_spec.rb +0 -113
- data/spec/shoulda/matchers/action_controller/set_the_flash_matcher_spec.rb +0 -153
- data/spec/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +0 -47
- data/spec/shoulda/matchers/doublespeak/world_spec.rb +0 -70
- data/spec/shoulda/matchers/independent/delegate_method_matcher_spec.rb +0 -309
- data/spec/spec_helper.rb +0 -42
- data/spec/support/active_model_versions.rb +0 -13
- data/spec/support/active_resource_builder.rb +0 -29
- data/spec/support/activemodel_helpers.rb +0 -23
- data/spec/support/capture_helpers.rb +0 -19
- data/spec/support/class_builder.rb +0 -46
- data/spec/support/controller_builder.rb +0 -102
- data/spec/support/fail_with_message_including_matcher.rb +0 -44
- data/spec/support/fail_with_message_matcher.rb +0 -44
- data/spec/support/i18n_faker.rb +0 -10
- data/spec/support/mailer_builder.rb +0 -10
- data/spec/support/model_builder.rb +0 -81
- data/spec/support/rails_versions.rb +0 -26
- data/spec/support/test_application.rb +0 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee8c0b0e1f256d925dbe3f9a4605c50e6ba6f10
|
4
|
+
data.tar.gz: 57dd2a461fe108817bd4e0fa289eac15de7bdfb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f91eb0eb49ac9fa2db0b2905b54c3402a023c2ac15d41ec3f4e303f7eb9c15d220fcb32ce68b823dac8c2950e767d7959118222cea6c9db0fce77b80f513d463
|
7
|
+
data.tar.gz: 2a2ee684b5cba052bee3012048b59c4588b0da070e8fbeeac94a8913128d3dd02999558ba83b5cec85d0c28402f6cf7e13bf6a6634ca9c6dc8db5547606c4199
|
data/.travis.yml
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
install: "travis_retry bundle install"
|
1
|
+
language: ruby
|
4
2
|
|
5
3
|
rvm:
|
6
4
|
- 1.9.2
|
@@ -11,6 +9,10 @@ gemfile:
|
|
11
9
|
- gemfiles/3.1.gemfile
|
12
10
|
- gemfiles/3.2.gemfile
|
13
11
|
|
12
|
+
sudo: false
|
13
|
+
|
14
|
+
script: "bundle exec rake"
|
15
|
+
|
14
16
|
matrix:
|
15
17
|
allow_failures:
|
16
18
|
- rvm: rbx-19mode
|
@@ -34,6 +36,14 @@ matrix:
|
|
34
36
|
gemfile: gemfiles/4.0.1.gemfile
|
35
37
|
- rvm: 2.0.0
|
36
38
|
gemfile: gemfiles/4.1.gemfile
|
39
|
+
- rvm: 2.1.4
|
40
|
+
gemfile: gemfiles/3.2.gemfile
|
41
|
+
- rvm: 2.1.4
|
42
|
+
gemfile: gemfiles/4.0.0.gemfile
|
43
|
+
- rvm: 2.1.4
|
44
|
+
gemfile: gemfiles/4.0.1.gemfile
|
45
|
+
- rvm: 2.1.4
|
46
|
+
gemfile: gemfiles/4.1.gemfile
|
37
47
|
- rvm: rbx-19mode
|
38
48
|
gemfile: gemfiles/3.2.gemfile
|
39
49
|
- rvm: jruby-19mode
|
data/Appraisals
CHANGED
@@ -8,6 +8,8 @@ end
|
|
8
8
|
rails_3 = proc do
|
9
9
|
gem 'strong_parameters'
|
10
10
|
gem 'rspec-rails', '2.99.0'
|
11
|
+
gem 'minitest', '~> 4.0'
|
12
|
+
gem 'minitest-reporters'
|
11
13
|
end
|
12
14
|
|
13
15
|
rails_3_1 = proc do
|
@@ -19,6 +21,8 @@ rails_3_1 = proc do
|
|
19
21
|
gem 'coffee-rails', '~> 3.1.1'
|
20
22
|
gem 'uglifier', '>= 1.0.3'
|
21
23
|
gem 'rspec-rails', '2.99.0'
|
24
|
+
gem 'minitest', '~> 4.0'
|
25
|
+
gem 'minitest-reporters'
|
22
26
|
end
|
23
27
|
|
24
28
|
rails_3_2 = proc do
|
@@ -29,6 +33,8 @@ rails_3_2 = proc do
|
|
29
33
|
gem 'sass-rails', '~> 3.2.3'
|
30
34
|
gem 'coffee-rails', '~> 3.2.1'
|
31
35
|
gem 'uglifier', '>= 1.0.3'
|
36
|
+
gem 'minitest', '~> 4.0'
|
37
|
+
gem 'minitest-reporters'
|
32
38
|
end
|
33
39
|
|
34
40
|
rails_4 = proc do
|
@@ -42,6 +48,7 @@ rails_4 = proc do
|
|
42
48
|
gem 'rspec-rails', '~> 3.0.1'
|
43
49
|
# Test suite makes heavy use of attr_accessible
|
44
50
|
gem 'protected_attributes'
|
51
|
+
gem 'minitest-reporters'
|
45
52
|
end
|
46
53
|
|
47
54
|
#---
|
@@ -104,4 +111,15 @@ if Gem::Requirement.new('> 1.9.2').satisfied_by?(ruby_version)
|
|
104
111
|
gem 'protected_attributes', "~> 1.0.6"
|
105
112
|
gem 'spring'
|
106
113
|
end
|
114
|
+
|
115
|
+
appraise '4.2' do
|
116
|
+
instance_eval(&rails_4)
|
117
|
+
gem 'rails', '~> 4.2.0'
|
118
|
+
gem 'jbuilder', '~> 2.0'
|
119
|
+
gem 'sass-rails', '~> 5.0'
|
120
|
+
gem 'sdoc', '~> 0.4.0'
|
121
|
+
gem 'bcrypt', '~> 3.1.7'
|
122
|
+
gem 'protected_attributes', "~> 1.0.6"
|
123
|
+
gem 'spring'
|
124
|
+
end
|
107
125
|
end
|
data/CONTRIBUTING.md
CHANGED
@@ -1,41 +1,25 @@
|
|
1
|
-
We love
|
1
|
+
We love contributions from the community! Here's a quick guide to making a pull
|
2
|
+
request:
|
2
3
|
|
3
4
|
1. Fork the repo.
|
4
5
|
|
5
6
|
2. Run the tests. We only take pull requests with passing tests, and it's great
|
6
7
|
to know that you have a clean slate: `bundle && bundle exec rake`
|
7
8
|
|
8
|
-
3.
|
9
|
-
|
10
|
-
a test!
|
9
|
+
3. If you're adding functionality or fixing a bug, add a failing test for the
|
10
|
+
issue first.
|
11
11
|
|
12
12
|
4. Make the test pass.
|
13
13
|
|
14
|
-
5.
|
15
|
-
|
14
|
+
5. If you're adding a new feature, ensure that the documentation is up to date
|
15
|
+
(see the README for instructions on previewing documentation live).
|
16
16
|
|
17
|
-
6.
|
17
|
+
6. Finally, push to your fork and submit a pull request.
|
18
18
|
|
19
|
+
At this point you're waiting on us. We try to respond to issues and pull
|
20
|
+
requests within a few business days. We may suggest some changes to make to your
|
21
|
+
code to fit with our [code style] or the project style, or discuss alternate
|
22
|
+
ways of addressing the issue in question. When we're happy with everything,
|
23
|
+
we'll bring your changes into master. Now you're a contributor!
|
19
24
|
|
20
|
-
|
21
|
-
accept, pull requests within three business days (and, typically, one business
|
22
|
-
day). We may suggest some changes or improvements or alternatives.
|
23
|
-
|
24
|
-
Some things that will increase the chance that your pull request is accepted,
|
25
|
-
taken straight from the Ruby on Rails guide:
|
26
|
-
|
27
|
-
* Use Rails idioms and helpers
|
28
|
-
* Include tests that fail without your code, and pass with it
|
29
|
-
* Update the documentation, the surrounding one, examples elsewhere, guides,
|
30
|
-
whatever is affected by your contribution
|
31
|
-
|
32
|
-
Syntax:
|
33
|
-
|
34
|
-
* Two spaces, no tabs.
|
35
|
-
* No trailing whitespace. Blank lines should not have any space.
|
36
|
-
* Prefer &&/|| over and/or.
|
37
|
-
* MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
38
|
-
* a = b and not a=b.
|
39
|
-
* Follow the conventions you see used in the source already.
|
40
|
-
|
41
|
-
And in case we didn't emphasize it enough: we love tests!
|
25
|
+
[code style]: https://github.com/thoughtbot/guides/tree/master/style
|
data/Gemfile
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
gem 'appraisal', '~> 1.0.0.beta2'
|
3
|
+
gem 'appraisal', '~> 1.0'
|
6
4
|
gem 'aruba'
|
7
5
|
gem 'bourne', '~> 1.3'
|
8
6
|
gem 'bundler', '~> 1.1'
|
9
|
-
gem 'cucumber', '~> 1.1'
|
10
7
|
gem 'pry'
|
11
8
|
gem 'rails', '~> 3.0'
|
12
9
|
gem 'rake', '>= 0.9.2'
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
shoulda-matchers (2.7.0)
|
5
|
-
activesupport (>= 3.0.0)
|
6
|
-
|
7
1
|
GEM
|
8
2
|
remote: https://rubygems.org/
|
9
3
|
specs:
|
@@ -34,7 +28,7 @@ GEM
|
|
34
28
|
activesupport (3.2.16)
|
35
29
|
i18n (~> 0.6, >= 0.6.4)
|
36
30
|
multi_json (~> 1.0)
|
37
|
-
appraisal (1.0.
|
31
|
+
appraisal (1.0.2)
|
38
32
|
bundler
|
39
33
|
rake
|
40
34
|
thor (>= 0.14.0)
|
@@ -149,11 +143,10 @@ PLATFORMS
|
|
149
143
|
DEPENDENCIES
|
150
144
|
activerecord-jdbc-adapter
|
151
145
|
activerecord-jdbcsqlite3-adapter
|
152
|
-
appraisal (~> 1.0
|
146
|
+
appraisal (~> 1.0)
|
153
147
|
aruba
|
154
148
|
bourne (~> 1.3)
|
155
149
|
bundler (~> 1.1)
|
156
|
-
cucumber (~> 1.1)
|
157
150
|
jdbc-sqlite3
|
158
151
|
jruby-openssl
|
159
152
|
pry
|
@@ -163,7 +156,6 @@ DEPENDENCIES
|
|
163
156
|
redcarpet
|
164
157
|
rspec-rails (>= 2.99.0)
|
165
158
|
shoulda-context (~> 1.2.0)
|
166
|
-
shoulda-matchers!
|
167
159
|
sqlite3
|
168
160
|
therubyrhino
|
169
161
|
watchr
|
data/NEWS.md
CHANGED
@@ -1,4 +1,92 @@
|
|
1
|
-
#
|
1
|
+
# 2.8.0.rc1
|
2
|
+
|
3
|
+
### Deprecations
|
4
|
+
|
5
|
+
* `ensure_length_of` has been renamed to `validate_length_of`.
|
6
|
+
`ensure_length_of` is deprecated and will be removed in 3.0.0.
|
7
|
+
|
8
|
+
* `set_the_flash` has been renamed to `set_flash`. `set_the_flash` is
|
9
|
+
deprecated and will be removed in 3.0.0.
|
10
|
+
|
11
|
+
* `set_session(:foo)` is deprecated in favor of `set_session[:foo]`.
|
12
|
+
`set_session(:foo)` will be invalid syntax in 3.0.0.
|
13
|
+
|
14
|
+
* Using `should set_session[:key].to(nil)` to assert that that a value has not
|
15
|
+
been set is deprecated. Please use `should_not set_session[:key]` instead.
|
16
|
+
In 3.0.0, `should set_session[:key].to(nil)` will only pass if the value is
|
17
|
+
truly nil.
|
18
|
+
|
19
|
+
### Bug fixes
|
20
|
+
|
21
|
+
* Fix `delegate_method` so that it works again with shoulda-context. ([#591])
|
22
|
+
|
23
|
+
* Fix `validate_uniqueness_of` when used with `scoped_to` so that when one of
|
24
|
+
the scope attributes is a polymorphic `*_type` attribute and the model has
|
25
|
+
another validation on the same attribute, the matcher does not fail with an
|
26
|
+
error. ([#592])
|
27
|
+
|
28
|
+
* Fix `has_many` used with `through` so that when the association does not
|
29
|
+
exist, and the matcher fails, it does not raise an error when producing the
|
30
|
+
failure message. ([#588])
|
31
|
+
|
32
|
+
* Fix `have_and_belong_to_many` used with `join_table` so that it does not fail
|
33
|
+
when `foreign_key` and/or `association_foreign_key` was specified on the
|
34
|
+
association as a symbol instead of a string. ([#584])
|
35
|
+
|
36
|
+
* Fix `allow_value` when an i18n translation key is passed to `with_message` and
|
37
|
+
the `:against` option is used to specify an alternate attribute. A bug here
|
38
|
+
also happened to affect `validate_confirmation_of` when an i18n translation
|
39
|
+
key is passed to `with_message`. ([#593])
|
40
|
+
|
41
|
+
* Fix `class_name` qualifier for association matchers so that if the model being
|
42
|
+
referenced is namespaced, the matcher will correctly resolve the class before
|
43
|
+
checking it against the association's `class_name`. ([#537])
|
44
|
+
|
45
|
+
* Fix `validate_inclusion_of` used with `with_message` so that it fails if given
|
46
|
+
a message that does not match the message on the validation. ([#598])
|
47
|
+
|
48
|
+
* Fix `route` matcher so that when controller and action are specified in hash
|
49
|
+
notation (e.g. `posts#show`), route parameters such as `id` do not need to be
|
50
|
+
specified as a string but may be specified as a number as well. ([#602])
|
51
|
+
|
52
|
+
### Features
|
53
|
+
|
54
|
+
* Add ability to test `:primary_key` option on associations. ([#597])
|
55
|
+
|
56
|
+
* Add `allow_blank` qualifier to `validate_uniqueness_of` to complement
|
57
|
+
the `allow_blank` option. ([#543])
|
58
|
+
|
59
|
+
* Change `set_session` so that #[] and #to qualifiers are optional, similar to
|
60
|
+
`set_flash`. That is, you can now say `should set_session` to assert that any
|
61
|
+
flash value has been set, or `should set_session.to('value')` to assert that
|
62
|
+
any value in the session is 'value'.
|
63
|
+
|
64
|
+
* Change `set_session` so that its #to qualifier supports regexps, similar to
|
65
|
+
`set_flash`.
|
66
|
+
|
67
|
+
* Add `with_prefix` qualifier to `delegate_method` to correspond to the `prefix`
|
68
|
+
option for Rails's `delegate` macro. ([#622])
|
69
|
+
|
70
|
+
* Add support for Rails 4.2, especially fixing `serialize` matcher to remove
|
71
|
+
warning about `serialized_attributes` being deprecated. ([#627])
|
72
|
+
|
73
|
+
### Improvements
|
74
|
+
|
75
|
+
* Tweak `allow_value` failure message so that it reads a bit nicer when listing
|
76
|
+
existing errors.
|
77
|
+
|
78
|
+
[#591]: https://github.com/thoughtbot/shoulda-matchers/pull/591
|
79
|
+
[#592]: https://github.com/thoughtbot/shoulda-matchers/pull/592
|
80
|
+
[#588]: https://github.com/thoughtbot/shoulda-matchers/pull/588
|
81
|
+
[#584]: https://github.com/thoughtbot/shoulda-matchers/pull/584
|
82
|
+
[#593]: https://github.com/thoughtbot/shoulda-matchers/pull/593
|
83
|
+
[#597]: https://github.com/thoughtbot/shoulda-matchers/pull/597
|
84
|
+
[#537]: https://github.com/thoughtbot/shoulda-matchers/pull/537
|
85
|
+
[#598]: https://github.com/thoughtbot/shoulda-matchers/pull/598
|
86
|
+
[#602]: https://github.com/thoughtbot/shoulda-matchers/pull/602
|
87
|
+
[#543]: https://github.com/thoughtbot/shoulda-matchers/pull/543
|
88
|
+
[#622]: https://github.com/thoughtbot/shoulda-matchers/pull/622
|
89
|
+
[#627]: https://github.com/thoughtbot/shoulda-matchers/pull/627
|
2
90
|
|
3
91
|
# 2.7.0
|
4
92
|
|
@@ -37,6 +125,11 @@
|
|
37
125
|
* Fix `validate_absence_of`: it required that a string be passed as the
|
38
126
|
attribute name rather than a symbol (which is the usual and documented usage).
|
39
127
|
|
128
|
+
### Features
|
129
|
+
|
130
|
+
* Add new matcher `define_enum_for` to test usage of the `enum` macro introduced
|
131
|
+
in Rails 4.1.
|
132
|
+
|
40
133
|
### Improvements
|
41
134
|
|
42
135
|
* `have_and_belongs_to_many` now checks to make sure that the join table
|
@@ -46,11 +139,6 @@
|
|
46
139
|
* Reword failure message for `delegate_method` so that it's a little more
|
47
140
|
helpful.
|
48
141
|
|
49
|
-
### Features
|
50
|
-
|
51
|
-
* Add new matcher `define_enum_for` to test usage of the `enum` macro introduced
|
52
|
-
in Rails 4.1.
|
53
|
-
|
54
142
|
# 2.6.2
|
55
143
|
|
56
144
|
### Bug fixes
|
@@ -68,20 +156,12 @@
|
|
68
156
|
from `validate_uniqueness_of`, your best bet continues to be creating a record
|
69
157
|
manually and calling `validate_uniqueness_of` on that instead.
|
70
158
|
|
71
|
-
### Other changes
|
72
|
-
|
73
159
|
* The majority of warnings that the gem produced have been removed. The gem
|
74
160
|
still produces warnings under Ruby 1.9.3; we will address this in a future
|
75
161
|
release.
|
76
162
|
|
77
163
|
# 2.6.1
|
78
164
|
|
79
|
-
### Features
|
80
|
-
|
81
|
-
* Teach `with_message` qualifier on `allow_value` to accept a hash of i18n
|
82
|
-
interpolation values:
|
83
|
-
`allow_value('foo').for(:attr).with_message(:greater_than, values: { count: 20 })`.
|
84
|
-
|
85
165
|
### Bug fixes
|
86
166
|
|
87
167
|
* Revert changes to `validate_numericality_of` made in the last release, which
|
@@ -123,6 +203,12 @@
|
|
123
203
|
|
124
204
|
* Fix `validate_uniqueness_of` to work with Rails 4.1 enum columns.
|
125
205
|
|
206
|
+
### Features
|
207
|
+
|
208
|
+
* Teach `with_message` qualifier on `allow_value` to accept a hash of i18n
|
209
|
+
interpolation values:
|
210
|
+
`allow_value('foo').for(:attr).with_message(:greater_than, values: { count: 20 })`.
|
211
|
+
|
126
212
|
# 2.6.0
|
127
213
|
|
128
214
|
* The boolean argument to `have_db_index`'s `unique` option is now optional, for
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# shoulda-matchers [![Gem Version][
|
1
|
+
# shoulda-matchers [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge]
|
2
2
|
|
3
3
|
[Official Documentation][rubydocs]
|
4
4
|
|
@@ -10,71 +10,72 @@ complex, and error-prone.
|
|
10
10
|
|
11
11
|
* **[allow_mass_assignment_of](lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb)**
|
12
12
|
tests usage of Rails 3's `attr_accessible` and `attr_protected` macros.
|
13
|
-
* **[allow_value](lib/shoulda/matchers/active_model/allow_value_matcher.rb)**
|
14
|
-
the `validates_format_of` validation.
|
15
|
-
* **[
|
16
|
-
tests usage of `
|
17
|
-
* **[validate_exclusion_of](lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb)**
|
18
|
-
tests usage of `validates_exclusion_of`.
|
19
|
-
* **[ensure_length_of](lib/shoulda/matchers/active_model/ensure_length_of_matcher.rb)** tests usage
|
20
|
-
of `validates_length_of`.
|
21
|
-
* **[have_secure_password](lib/shoulda/matchers/active_model/have_secure_password_matcher.rb)** tests
|
22
|
-
usage of `has_secure_password`.
|
13
|
+
* **[allow_value](lib/shoulda/matchers/active_model/allow_value_matcher.rb)**
|
14
|
+
tests usage of the `validates_format_of` validation.
|
15
|
+
* **[have_secure_password](lib/shoulda/matchers/active_model/have_secure_password_matcher.rb)**
|
16
|
+
tests usage of `has_secure_password`.
|
23
17
|
* **[validate_confirmation_of](lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb)**
|
24
18
|
tests usage of `validates_confirmation_of`.
|
19
|
+
* **[validate_exclusion_of](lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb)**
|
20
|
+
tests usage of `validates_exclusion_of`.
|
21
|
+
* **[validate_inclusion_of](lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb)**
|
22
|
+
tests usage of `validates_inclusion_of`.
|
23
|
+
* **[validate_length_of](lib/shoulda/matchers/active_model/validate_length_of_matcher.rb)**
|
24
|
+
tests usage of `validates_length_of`.
|
25
25
|
* **[validate_numericality_of](lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb)**
|
26
26
|
tests usage of `validates_numericality_of`.
|
27
|
-
* **[validate_presence_of](lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb)**
|
28
|
-
usage of `validates_presence_of`.
|
29
|
-
* **[validate_uniqueness_of](lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb)** tests
|
30
|
-
usage of `validates_uniqueness_of`.
|
27
|
+
* **[validate_presence_of](lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb)**
|
28
|
+
tests usage of `validates_presence_of`.
|
31
29
|
|
32
30
|
### ActiveRecord Matchers
|
33
31
|
|
34
32
|
* **[accept_nested_attributes_for](lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb)**
|
35
33
|
tests usage of the `accepts_nested_attributes_for` macro.
|
36
|
-
* **[belong_to](lib/shoulda/matchers/active_record/association_matcher.rb)**
|
37
|
-
your `belongs_to` associations.
|
34
|
+
* **[belong_to](lib/shoulda/matchers/active_record/association_matcher.rb)**
|
35
|
+
tests your `belongs_to` associations.
|
38
36
|
* **[define_enum_for](lib/shoulda/matchers/active_record/define_enum_for_matcher.rb)**
|
39
37
|
tests usage of the `enum` macro.
|
40
|
-
* **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)** tests
|
41
|
-
your `has_many` associations.
|
42
|
-
* **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)** tests your
|
43
|
-
`has_one` associations.
|
44
38
|
* **[have_and_belong_to_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
|
45
39
|
tests your `has_and_belongs_to_many` associations.
|
46
|
-
* **[have_db_column](lib/shoulda/matchers/active_record/have_db_column_matcher.rb)**
|
47
|
-
the table that backs your model has a specific column.
|
48
|
-
* **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
|
49
|
-
table that backs your model has an index on a specific column.
|
40
|
+
* **[have_db_column](lib/shoulda/matchers/active_record/have_db_column_matcher.rb)**
|
41
|
+
tests that the table that backs your model has a specific column.
|
42
|
+
* **[have_db_index](lib/shoulda/matchers/active_record/have_db_index_matcher.rb)**
|
43
|
+
tests that the table that backs your model has an index on a specific column.
|
44
|
+
* **[have_many](lib/shoulda/matchers/active_record/association_matcher.rb)**
|
45
|
+
tests your `has_many` associations.
|
46
|
+
* **[have_one](lib/shoulda/matchers/active_record/association_matcher.rb)**
|
47
|
+
tests your `has_one` associations.
|
50
48
|
* **[have_readonly_attribute](lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb)**
|
51
49
|
tests usage of the `attr_readonly` macro.
|
52
|
-
* **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
|
53
|
-
`serialize` macro.
|
50
|
+
* **[serialize](lib/shoulda/matchers/active_record/serialize_matcher.rb)** tests
|
51
|
+
usage of the `serialize` macro.
|
52
|
+
* **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
|
53
|
+
tests usage of `validates_uniqueness_of`.
|
54
54
|
|
55
55
|
### ActionController Matchers
|
56
56
|
|
57
|
-
* **[filter_param](lib/shoulda/matchers/action_controller/filter_param_matcher.rb)**
|
58
|
-
parameter filtering configuration.
|
59
|
-
* **[redirect_to](lib/shoulda/matchers/action_controller/redirect_to_matcher.rb)**
|
60
|
-
an action redirects to a certain location.
|
61
|
-
* **[render_template](lib/shoulda/matchers/action_controller/render_template_matcher.rb)**
|
62
|
-
that an action renders a template.
|
63
|
-
* **[render_with_layout](lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb)**
|
64
|
-
that an action is
|
65
|
-
* **[rescue_from](lib/shoulda/matchers/action_controller/rescue_from_matcher.rb)**
|
66
|
-
of the `rescue_from` macro.
|
67
|
-
* **[respond_with](lib/shoulda/matchers/action_controller/respond_with_matcher.rb)**
|
68
|
-
an action responds with a certain status code.
|
69
|
-
* **[route](lib/shoulda/matchers/action_controller/route_matcher.rb)** tests
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
57
|
+
* **[filter_param](lib/shoulda/matchers/action_controller/filter_param_matcher.rb)**
|
58
|
+
tests parameter filtering configuration.
|
59
|
+
* **[redirect_to](lib/shoulda/matchers/action_controller/redirect_to_matcher.rb)**
|
60
|
+
tests that an action redirects to a certain location.
|
61
|
+
* **[render_template](lib/shoulda/matchers/action_controller/render_template_matcher.rb)**
|
62
|
+
tests that an action renders a template.
|
63
|
+
* **[render_with_layout](lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb)**
|
64
|
+
tests that an action is rendered with a certain layout.
|
65
|
+
* **[rescue_from](lib/shoulda/matchers/action_controller/rescue_from_matcher.rb)**
|
66
|
+
tests usage of the `rescue_from` macro.
|
67
|
+
* **[respond_with](lib/shoulda/matchers/action_controller/respond_with_matcher.rb)**
|
68
|
+
tests that an action responds with a certain status code.
|
69
|
+
* **[route](lib/shoulda/matchers/action_controller/route_matcher.rb)** tests
|
70
|
+
your routes.
|
71
|
+
* **[set_session](lib/shoulda/matchers/action_controller/set_session_matcher.rb)**
|
72
|
+
makes assertions on the `session` hash.
|
73
|
+
* **[set_flash](lib/shoulda/matchers/action_controller/set_flash_matcher.rb)**
|
74
|
+
makes assertions on the `flash` hash.
|
74
75
|
|
75
76
|
### Independent Matchers
|
76
77
|
|
77
|
-
* **[delegate_method](lib/shoulda/matchers/independent/
|
78
|
+
* **[delegate_method](lib/shoulda/matchers/independent/delegate_method_matcher.rb)**
|
78
79
|
tests that an object forwards messages to other, internal objects by way of
|
79
80
|
delegation.
|
80
81
|
|
@@ -100,10 +101,10 @@ require 'shoulda/matchers'
|
|
100
101
|
|
101
102
|
### Test::Unit
|
102
103
|
|
103
|
-
shoulda-matchers was originally a component of
|
104
|
-
|
105
|
-
|
106
|
-
your Gemfile instead:
|
104
|
+
shoulda-matchers was originally a component of [Shoulda][shoulda], a meta-gem
|
105
|
+
that also provides `should` and `context` syntax via
|
106
|
+
[shoulda-context][shoulda-context]. For this reason you'll want to include this
|
107
|
+
gem in your Gemfile instead:
|
107
108
|
|
108
109
|
```ruby
|
109
110
|
group :test do
|
@@ -117,14 +118,14 @@ Once it is loaded, shoulda-matchers automatically includes itself into your test
|
|
117
118
|
framework. It will mix in the appropriate matchers for ActiveRecord,
|
118
119
|
ActiveModel, and ActionController depending on the modules that are available at
|
119
120
|
runtime. For instance, in order to use the ActiveRecord matchers, ActiveRecord
|
120
|
-
must be
|
121
|
+
must be present beforehand.
|
121
122
|
|
122
|
-
If your application is
|
123
|
+
If your application is written against Rails, everything should "just work", as
|
123
124
|
shoulda-matchers will most likely be declared after Rails in your Gemfile. If
|
124
|
-
your application is
|
125
|
-
have a different setup, so you will want to ensure that you are
|
126
|
-
shoulda-matchers after the components of Rails you are using. For
|
127
|
-
if you wanted to use and test against ActiveModel, you'd say:
|
125
|
+
your application is written against another framework such as Sinatra or
|
126
|
+
Padrino, you may have a different setup, so you will want to ensure that you are
|
127
|
+
requiring shoulda-matchers after the components of Rails you are using. For
|
128
|
+
instance, if you wanted to use and test against ActiveModel, you'd say:
|
128
129
|
|
129
130
|
```ruby
|
130
131
|
gem 'activemodel'
|
@@ -168,10 +169,13 @@ shoulda-matchers is copyright © 2006-2014 thoughtbot, inc. It is free software,
|
|
168
169
|
and may be redistributed under the terms specified in the
|
169
170
|
[MIT-LICENSE](MIT-LICENSE) file.
|
170
171
|
|
171
|
-
[
|
172
|
-
[
|
173
|
-
[travis-badge]:
|
172
|
+
[version-badge]: http://img.shields.io/gem/v/shoulda-matchers.svg
|
173
|
+
[rubygems]: http://rubygems.org/gems/shoulda-matchers
|
174
|
+
[travis-badge]: http://img.shields.io/travis/thoughtbot/shoulda-matchers/master.svg
|
174
175
|
[travis]: http://travis-ci.org/thoughtbot/shoulda-matchers
|
176
|
+
[downloads-badge]: http://img.shields.io/gem/dtv/shoulda-matchers.svg
|
175
177
|
[rubydocs]: http://thoughtbot.github.io/shoulda-matchers
|
176
178
|
[community]: http://thoughtbot.com/community
|
177
179
|
[contributors]: https://github.com/thoughtbot/shoulda-matchers/contributors
|
180
|
+
[shoulda]: http://github.com/thoughtbot/shoulda
|
181
|
+
[shoulda-context]: http://github.com/thoughtbot/shoulda-context
|