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.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -3
  3. data/Appraisals +18 -0
  4. data/CONTRIBUTING.md +13 -29
  5. data/Gemfile +1 -4
  6. data/Gemfile.lock +2 -10
  7. data/NEWS.md +100 -14
  8. data/README.md +62 -58
  9. data/Rakefile +9 -16
  10. data/gemfiles/3.0.gemfile +11 -12
  11. data/gemfiles/3.0.gemfile.lock +15 -10
  12. data/gemfiles/3.1.gemfile +11 -12
  13. data/gemfiles/3.1.gemfile.lock +14 -10
  14. data/gemfiles/3.1_1.9.2.gemfile +12 -11
  15. data/gemfiles/3.1_1.9.2.gemfile.lock +14 -3
  16. data/gemfiles/3.2.gemfile +11 -12
  17. data/gemfiles/3.2.gemfile.lock +15 -10
  18. data/gemfiles/3.2_1.9.2.gemfile +12 -11
  19. data/gemfiles/3.2_1.9.2.gemfile.lock +14 -2
  20. data/gemfiles/4.0.0.gemfile +10 -12
  21. data/gemfiles/4.0.0.gemfile.lock +13 -10
  22. data/gemfiles/4.0.1.gemfile +10 -12
  23. data/gemfiles/4.0.1.gemfile.lock +13 -10
  24. data/gemfiles/4.1.gemfile +13 -15
  25. data/gemfiles/4.1.gemfile.lock +45 -50
  26. data/gemfiles/4.2.gemfile +36 -0
  27. data/gemfiles/4.2.gemfile.lock +245 -0
  28. data/lib/shoulda/matchers.rb +3 -1
  29. data/lib/shoulda/matchers/action_controller.rb +1 -1
  30. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
  31. data/lib/shoulda/matchers/action_controller/route_params.rb +9 -4
  32. data/lib/shoulda/matchers/action_controller/{set_the_flash_matcher.rb → set_flash_matcher.rb} +34 -26
  33. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +125 -69
  34. data/lib/shoulda/matchers/active_model.rb +1 -2
  35. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +18 -5
  36. data/lib/shoulda/matchers/active_model/exception_message_finder.rb +2 -2
  37. data/lib/shoulda/matchers/active_model/helpers.rb +4 -4
  38. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +10 -3
  39. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +1 -1
  40. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +3 -1
  41. data/lib/shoulda/matchers/active_model/{ensure_length_of_matcher.rb → validate_length_of_matcher.rb} +30 -20
  42. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +21 -0
  43. data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -2
  44. data/lib/shoulda/matchers/active_record.rb +2 -0
  45. data/lib/shoulda/matchers/active_record/association_matcher.rb +96 -2
  46. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
  47. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +3 -3
  48. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +22 -2
  49. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +30 -4
  50. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +19 -3
  51. data/lib/shoulda/matchers/active_record/uniqueness.rb +14 -0
  52. data/lib/shoulda/matchers/active_record/uniqueness/model.rb +45 -0
  53. data/lib/shoulda/matchers/active_record/uniqueness/namespace.rb +36 -0
  54. data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +50 -0
  55. data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +24 -0
  56. data/lib/shoulda/matchers/{active_model → active_record}/validate_uniqueness_of_matcher.rb +76 -16
  57. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +117 -51
  58. data/lib/shoulda/matchers/independent/delegate_method_matcher/target_not_defined_error.rb +1 -1
  59. data/lib/shoulda/matchers/matcher_context.rb +35 -0
  60. data/lib/shoulda/matchers/rails_shim.rb +23 -0
  61. data/lib/shoulda/matchers/util.rb +28 -0
  62. data/lib/shoulda/matchers/version.rb +1 -1
  63. data/script/SUPPORTED_VERSIONS +1 -1
  64. data/spec/acceptance/active_model_integration_spec.rb +20 -0
  65. data/spec/acceptance/independent_matchers_spec.rb +64 -0
  66. data/spec/acceptance/rails_integration_spec.rb +142 -0
  67. data/spec/acceptance_spec_helper.rb +23 -0
  68. data/spec/support/acceptance/helpers.rb +29 -0
  69. data/spec/support/acceptance/helpers/active_model_helpers.rb +11 -0
  70. data/spec/support/acceptance/helpers/array_helpers.rb +13 -0
  71. data/spec/support/acceptance/helpers/base_helpers.rb +14 -0
  72. data/spec/support/acceptance/helpers/command_helpers.rb +51 -0
  73. data/spec/support/acceptance/helpers/file_helpers.rb +19 -0
  74. data/spec/support/acceptance/helpers/gem_helpers.rb +31 -0
  75. data/spec/support/acceptance/helpers/minitest_helpers.rb +19 -0
  76. data/spec/support/acceptance/helpers/pluralization_helpers.rb +13 -0
  77. data/spec/support/acceptance/helpers/rails_version_helpers.rb +11 -0
  78. data/spec/support/acceptance/helpers/rspec_helpers.rb +26 -0
  79. data/spec/support/acceptance/helpers/ruby_version_helpers.rb +9 -0
  80. data/spec/support/acceptance/helpers/step_helpers.rb +117 -0
  81. data/spec/support/acceptance/matchers/have_output.rb +31 -0
  82. data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +55 -0
  83. data/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +103 -0
  84. data/spec/support/tests/bundle.rb +94 -0
  85. data/spec/support/tests/command_runner.rb +214 -0
  86. data/spec/support/tests/filesystem.rb +77 -0
  87. data/spec/support/tests/version.rb +45 -0
  88. data/spec/support/unit/capture.rb +34 -0
  89. data/spec/support/unit/helpers/active_model_helpers.rb +25 -0
  90. data/spec/support/unit/helpers/active_model_versions.rb +20 -0
  91. data/spec/support/unit/helpers/active_resource_builder.rb +27 -0
  92. data/spec/support/unit/helpers/allow_value_matcher_helpers.rb +15 -0
  93. data/spec/support/unit/helpers/class_builder.rb +72 -0
  94. data/spec/support/unit/helpers/confirmation_matcher_helpers.rb +17 -0
  95. data/spec/support/unit/helpers/controller_builder.rb +91 -0
  96. data/spec/support/unit/helpers/i18n_faker.rb +15 -0
  97. data/spec/support/unit/helpers/mailer_builder.rb +12 -0
  98. data/spec/support/unit/helpers/model_builder.rb +102 -0
  99. data/spec/support/unit/helpers/rails_versions.rb +28 -0
  100. data/spec/support/unit/i18n.rb +7 -0
  101. data/spec/support/unit/matchers/deprecate.rb +60 -0
  102. data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +50 -0
  103. data/spec/support/unit/matchers/fail_with_message_matcher.rb +50 -0
  104. data/spec/support/unit/matchers/print_warning_including.rb +59 -0
  105. data/spec/support/unit/rails_application.rb +110 -0
  106. data/spec/support/unit/record_builder_with_i18n_validation_message.rb +69 -0
  107. data/spec/support/unit/record_validating_confirmation_builder.rb +56 -0
  108. data/spec/support/unit/record_with_different_error_attribute_builder.rb +92 -0
  109. data/spec/support/{shared_examples → unit/shared_examples}/numerical_submatcher.rb +0 -2
  110. data/spec/support/{shared_examples → unit/shared_examples}/numerical_type_submatcher.rb +0 -2
  111. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/callback_matcher_spec.rb +2 -2
  112. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/filter_param_matcher_spec.rb +2 -2
  113. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/redirect_to_matcher_spec.rb +3 -3
  114. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/render_template_matcher_spec.rb +2 -4
  115. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/render_with_layout_matcher_spec.rb +9 -6
  116. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/rescue_from_matcher_spec.rb +2 -2
  117. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/respond_with_matcher_spec.rb +2 -2
  118. data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +126 -0
  119. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/route_params_spec.rb +2 -2
  120. data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +167 -0
  121. data/spec/unit/shoulda/matchers/action_controller/set_session_matcher_spec.rb +294 -0
  122. data/spec/{shoulda → unit/shoulda}/matchers/action_controller/strong_parameters_matcher_spec.rb +19 -11
  123. data/spec/{shoulda → unit/shoulda}/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +2 -2
  124. data/spec/{shoulda → unit/shoulda}/matchers/active_model/allow_value_matcher_spec.rb +49 -21
  125. data/spec/{shoulda → unit/shoulda}/matchers/active_model/disallow_value_matcher_spec.rb +8 -4
  126. data/spec/{shoulda → unit/shoulda}/matchers/active_model/exception_message_finder_spec.rb +4 -4
  127. data/spec/{shoulda → unit/shoulda}/matchers/active_model/have_secure_password_matcher_spec.rb +2 -2
  128. data/spec/{shoulda → unit/shoulda}/matchers/active_model/helpers_spec.rb +7 -3
  129. data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +1 -1
  130. data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb +1 -1
  131. data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb +1 -1
  132. data/spec/{shoulda → unit/shoulda}/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb +1 -1
  133. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_absence_of_matcher_spec.rb +3 -3
  134. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_acceptance_of_matcher_spec.rb +2 -2
  135. data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +63 -0
  136. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_exclusion_of_matcher_spec.rb +5 -4
  137. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_inclusion_of_matcher_spec.rb +7 -14
  138. 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
  139. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_numericality_of_matcher_spec.rb +3 -4
  140. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_presence_of_matcher_spec.rb +3 -3
  141. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validate_uniqueness_of_matcher_spec.rb +127 -2
  142. data/spec/{shoulda → unit/shoulda}/matchers/active_model/validation_message_finder_spec.rb +8 -6
  143. data/spec/{shoulda → unit/shoulda}/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +2 -2
  144. data/spec/{shoulda → unit/shoulda}/matchers/active_record/association_matcher_spec.rb +217 -26
  145. data/spec/{shoulda → unit/shoulda}/matchers/active_record/association_matchers/model_reflection_spec.rb +2 -2
  146. data/spec/{shoulda → unit/shoulda}/matchers/active_record/define_enum_for_matcher_spec.rb +2 -2
  147. data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_db_column_matcher_spec.rb +2 -2
  148. data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_db_index_matcher_spec.rb +8 -5
  149. data/spec/{shoulda → unit/shoulda}/matchers/active_record/have_readonly_attributes_matcher_spec.rb +2 -2
  150. data/spec/{shoulda → unit/shoulda}/matchers/active_record/serialize_matcher_spec.rb +3 -3
  151. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_collection_spec.rb +29 -7
  152. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_implementation_registry_spec.rb +1 -1
  153. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/double_spec.rb +20 -10
  154. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/object_double_spec.rb +1 -1
  155. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/proxy_implementation_spec.rb +13 -6
  156. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak/stub_implementation_spec.rb +2 -2
  157. data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +77 -0
  158. data/spec/{shoulda → unit/shoulda}/matchers/doublespeak_spec.rb +11 -3
  159. data/spec/{shoulda → unit/shoulda}/matchers/independent/delegate_method_matcher/stubbed_target_spec.rb +1 -1
  160. data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +517 -0
  161. data/spec/unit_spec_helper.rb +66 -0
  162. data/spec/warnings_spy/partitioner.rb +10 -3
  163. data/spec/warnings_spy/reader.rb +9 -20
  164. data/spec/warnings_spy/reporter.rb +2 -1
  165. metadata +212 -149
  166. data/features/activemodel_integration.feature +0 -15
  167. data/features/rails_integration.feature +0 -160
  168. data/features/step_definitions/activemodel_steps.rb +0 -21
  169. data/features/step_definitions/rails_steps.rb +0 -227
  170. data/features/support/env.rb +0 -6
  171. data/spec/shoulda/matchers/action_controller/route_matcher_spec.rb +0 -70
  172. data/spec/shoulda/matchers/action_controller/set_session_matcher_spec.rb +0 -113
  173. data/spec/shoulda/matchers/action_controller/set_the_flash_matcher_spec.rb +0 -153
  174. data/spec/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +0 -47
  175. data/spec/shoulda/matchers/doublespeak/world_spec.rb +0 -70
  176. data/spec/shoulda/matchers/independent/delegate_method_matcher_spec.rb +0 -309
  177. data/spec/spec_helper.rb +0 -42
  178. data/spec/support/active_model_versions.rb +0 -13
  179. data/spec/support/active_resource_builder.rb +0 -29
  180. data/spec/support/activemodel_helpers.rb +0 -23
  181. data/spec/support/capture_helpers.rb +0 -19
  182. data/spec/support/class_builder.rb +0 -46
  183. data/spec/support/controller_builder.rb +0 -102
  184. data/spec/support/fail_with_message_including_matcher.rb +0 -44
  185. data/spec/support/fail_with_message_matcher.rb +0 -44
  186. data/spec/support/i18n_faker.rb +0 -10
  187. data/spec/support/mailer_builder.rb +0 -10
  188. data/spec/support/model_builder.rb +0 -81
  189. data/spec/support/rails_versions.rb +0 -26
  190. data/spec/support/test_application.rb +0 -120
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e928b8bdcbb158173df075e2d49af0aeb4f584cc
4
- data.tar.gz: 43b6015bf156cec9cb62f686a927e81eaea239b6
3
+ metadata.gz: 2ee8c0b0e1f256d925dbe3f9a4605c50e6ba6f10
4
+ data.tar.gz: 57dd2a461fe108817bd4e0fa289eac15de7bdfb3
5
5
  SHA512:
6
- metadata.gz: 7a1d71a62c646c5607e59ace508393a28068e8c23c0744616a55f846b7bd2be2c7f31a2183c67f75ab72a7f51e03f8efc844ba9f22ad42817d5a17660c0cc0c2
7
- data.tar.gz: f2834dcc2f6e3e052df77f725c676f55264e63ae6f6d20ac7c629728892ef4b0d515b2cedd75a00c1145d7d626d7ab1715eadcf20f0d8374adb446f69577822e
6
+ metadata.gz: f91eb0eb49ac9fa2db0b2905b54c3402a023c2ac15d41ec3f4e303f7eb9c15d220fcb32ce68b823dac8c2950e767d7959118222cea6c9db0fce77b80f513d463
7
+ data.tar.gz: 2a2ee684b5cba052bee3012048b59c4588b0da070e8fbeeac94a8913128d3dd02999558ba83b5cec85d0c28402f6cf7e13bf6a6634ca9c6dc8db5547606c4199
data/.travis.yml CHANGED
@@ -1,6 +1,4 @@
1
- script: "bundle exec rake spec cucumber"
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 pull requests. Here's a quick guide:
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. Add a test for your change. Only refactoring and documentation changes
9
- require no new tests. If you are adding functionality or fixing a bug, we need
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. Update NEWS.md with a brief description of your changes under the HEAD
15
- heading.
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. Push to your fork and submit a pull request.
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
- At this point you're waiting on us. We like to at least comment on, if not
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
- gemspec
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.0.beta2)
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.0.beta2)
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
- # HEAD
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][fury-badge]][fury] [![Build Status][travis-badge]][travis]
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)** tests usage of
14
- the `validates_format_of` validation.
15
- * **[validate_inclusion_of](lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb)**
16
- tests usage of `validates_inclusion_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)** tests
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)** tests
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)** tests that
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)** tests that the
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 usage of the
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)** tests
58
- parameter filtering configuration.
59
- * **[redirect_to](lib/shoulda/matchers/action_controller/redirect_to_matcher.rb)** tests that
60
- an action redirects to a certain location.
61
- * **[render_template](lib/shoulda/matchers/action_controller/render_template_matcher.rb)** tests
62
- that an action renders a template.
63
- * **[render_with_layout](lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb)** tests
64
- that an action is rendereed with a certain layout.
65
- * **[rescue_from](lib/shoulda/matchers/action_controller/rescue_from_matcher.rb)** tests usage
66
- of the `rescue_from` macro.
67
- * **[respond_with](lib/shoulda/matchers/action_controller/respond_with_matcher.rb)** tests that
68
- an action responds with a certain status code.
69
- * **[route](lib/shoulda/matchers/action_controller/route_matcher.rb)** tests your routes.
70
- * **[set_session](lib/shoulda/matchers/action_controller/set_session_matcher.rb)** makes
71
- assertions on the `session` hash.
72
- * **[set_the_flash](lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb)** makes
73
- assertions on the `flash` hash.
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/delegate_matcher.rb)**
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
- [Shoulda](http://github.com/thoughtbot/shoulda) -- it's what provides the nice
105
- `should` syntax which is demonstrated below. For this reason, include it in
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 available beforehand.
121
+ must be present beforehand.
121
122
 
122
- If your application is on Rails, everything should "just work", as
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 on another framework such as Sinatra or Padrino, you may
125
- have a different setup, so you will want to ensure that you are requiring
126
- shoulda-matchers after the components of Rails you are using. For instance,
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
- [fury-badge]: https://badge.fury.io/rb/shoulda-matchers.png
172
- [fury]: http://badge.fury.io/rb/shoulda-matchers
173
- [travis-badge]: https://secure.travis-ci.org/thoughtbot/shoulda-matchers.png?branch=master
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