mcmire-shoulda-matchers 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +32 -0
  4. data/.yardopts +7 -0
  5. data/Appraisals +45 -0
  6. data/CONTRIBUTING.md +41 -0
  7. data/Gemfile +31 -0
  8. data/Gemfile.lock +166 -0
  9. data/MIT-LICENSE +22 -0
  10. data/NEWS.md +299 -0
  11. data/README.md +163 -0
  12. data/Rakefile +116 -0
  13. data/doc_config/gh-pages/index.html.erb +9 -0
  14. data/doc_config/yard/setup.rb +22 -0
  15. data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +5967 -0
  16. data/doc_config/yard/templates/default/fulldoc/html/css/full_list.css +12 -0
  17. data/doc_config/yard/templates/default/fulldoc/html/css/global.css +45 -0
  18. data/doc_config/yard/templates/default/fulldoc/html/css/solarized.css +69 -0
  19. data/doc_config/yard/templates/default/fulldoc/html/css/style.css +283 -0
  20. data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +32 -0
  21. data/doc_config/yard/templates/default/fulldoc/html/full_list_class.erb +1 -0
  22. data/doc_config/yard/templates/default/fulldoc/html/full_list_method.erb +8 -0
  23. data/doc_config/yard/templates/default/fulldoc/html/js/app.js +300 -0
  24. data/doc_config/yard/templates/default/fulldoc/html/js/full_list.js +1 -0
  25. data/doc_config/yard/templates/default/fulldoc/html/js/jquery.stickyheaders.js +289 -0
  26. data/doc_config/yard/templates/default/fulldoc/html/js/underscore.min.js +6 -0
  27. data/doc_config/yard/templates/default/fulldoc/html/setup.rb +8 -0
  28. data/doc_config/yard/templates/default/layout/html/breadcrumb.erb +14 -0
  29. data/doc_config/yard/templates/default/layout/html/fonts.erb +1 -0
  30. data/doc_config/yard/templates/default/layout/html/layout.erb +23 -0
  31. data/doc_config/yard/templates/default/layout/html/search.erb +13 -0
  32. data/doc_config/yard/templates/default/layout/html/setup.rb +8 -0
  33. data/doc_config/yard/templates/default/method_details/html/source.erb +10 -0
  34. data/doc_config/yard/templates/default/module/html/box_info.erb +31 -0
  35. data/features/rails_integration.feature +113 -0
  36. data/features/step_definitions/rails_steps.rb +162 -0
  37. data/features/support/env.rb +5 -0
  38. data/gemfiles/3.0.gemfile +24 -0
  39. data/gemfiles/3.0.gemfile.lock +150 -0
  40. data/gemfiles/3.1.gemfile +27 -0
  41. data/gemfiles/3.1.gemfile.lock +173 -0
  42. data/gemfiles/3.2.gemfile +27 -0
  43. data/gemfiles/3.2.gemfile.lock +171 -0
  44. data/gemfiles/4.0.0.gemfile +28 -0
  45. data/gemfiles/4.0.0.gemfile.lock +172 -0
  46. data/gemfiles/4.0.1.gemfile +28 -0
  47. data/gemfiles/4.0.1.gemfile.lock +172 -0
  48. data/lib/shoulda-matchers.rb +1 -0
  49. data/lib/shoulda/matchers.rb +11 -0
  50. data/lib/shoulda/matchers/action_controller.rb +17 -0
  51. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +64 -0
  52. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +97 -0
  53. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +81 -0
  54. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +117 -0
  55. data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +114 -0
  56. data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +154 -0
  57. data/lib/shoulda/matchers/action_controller/route_matcher.rb +116 -0
  58. data/lib/shoulda/matchers/action_controller/route_params.rb +48 -0
  59. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +164 -0
  60. data/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb +296 -0
  61. data/lib/shoulda/matchers/active_model.rb +30 -0
  62. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +167 -0
  63. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +314 -0
  64. data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +46 -0
  65. data/lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb +160 -0
  66. data/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb +417 -0
  67. data/lib/shoulda/matchers/active_model/ensure_length_of_matcher.rb +337 -0
  68. data/lib/shoulda/matchers/active_model/errors.rb +10 -0
  69. data/lib/shoulda/matchers/active_model/exception_message_finder.rb +58 -0
  70. data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +92 -0
  71. data/lib/shoulda/matchers/active_model/helpers.rb +46 -0
  72. data/lib/shoulda/matchers/active_model/numericality_matchers.rb +9 -0
  73. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +75 -0
  74. data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +27 -0
  75. data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +41 -0
  76. data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +27 -0
  77. data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +26 -0
  78. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +112 -0
  79. data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +77 -0
  80. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +121 -0
  81. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +380 -0
  82. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +89 -0
  83. data/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb +372 -0
  84. data/lib/shoulda/matchers/active_model/validation_matcher.rb +97 -0
  85. data/lib/shoulda/matchers/active_model/validation_message_finder.rb +69 -0
  86. data/lib/shoulda/matchers/active_record.rb +22 -0
  87. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +204 -0
  88. data/lib/shoulda/matchers/active_record/association_matcher.rb +901 -0
  89. data/lib/shoulda/matchers/active_record/association_matchers.rb +9 -0
  90. data/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +41 -0
  91. data/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +41 -0
  92. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +81 -0
  93. data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +65 -0
  94. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +94 -0
  95. data/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +41 -0
  96. data/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +41 -0
  97. data/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +63 -0
  98. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +261 -0
  99. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +149 -0
  100. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +72 -0
  101. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +181 -0
  102. data/lib/shoulda/matchers/assertion_error.rb +19 -0
  103. data/lib/shoulda/matchers/error.rb +6 -0
  104. data/lib/shoulda/matchers/integrations/rspec.rb +20 -0
  105. data/lib/shoulda/matchers/integrations/test_unit.rb +30 -0
  106. data/lib/shoulda/matchers/rails_shim.rb +50 -0
  107. data/lib/shoulda/matchers/version.rb +6 -0
  108. data/lib/shoulda/matchers/warn.rb +8 -0
  109. data/shoulda-matchers.gemspec +23 -0
  110. data/spec/shoulda/matchers/action_controller/filter_param_matcher_spec.rb +22 -0
  111. data/spec/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +42 -0
  112. data/spec/shoulda/matchers/action_controller/render_template_matcher_spec.rb +78 -0
  113. data/spec/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +63 -0
  114. data/spec/shoulda/matchers/action_controller/rescue_from_matcher_spec.rb +63 -0
  115. data/spec/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +31 -0
  116. data/spec/shoulda/matchers/action_controller/route_matcher_spec.rb +70 -0
  117. data/spec/shoulda/matchers/action_controller/route_params_spec.rb +30 -0
  118. data/spec/shoulda/matchers/action_controller/set_session_matcher_spec.rb +51 -0
  119. data/spec/shoulda/matchers/action_controller/set_the_flash_matcher_spec.rb +153 -0
  120. data/spec/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +111 -0
  121. data/spec/shoulda/matchers/active_model/allow_value_matcher_spec.rb +170 -0
  122. data/spec/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +81 -0
  123. data/spec/shoulda/matchers/active_model/ensure_exclusion_of_matcher_spec.rb +95 -0
  124. data/spec/shoulda/matchers/active_model/ensure_inclusion_of_matcher_spec.rb +320 -0
  125. data/spec/shoulda/matchers/active_model/ensure_length_of_matcher_spec.rb +166 -0
  126. data/spec/shoulda/matchers/active_model/exception_message_finder_spec.rb +111 -0
  127. data/spec/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb +20 -0
  128. data/spec/shoulda/matchers/active_model/helpers_spec.rb +158 -0
  129. data/spec/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +169 -0
  130. data/spec/shoulda/matchers/active_model/numericality_matchers/even_number_matcher_spec.rb +59 -0
  131. data/spec/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher_spec.rb +59 -0
  132. data/spec/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher_spec.rb +57 -0
  133. data/spec/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +139 -0
  134. data/spec/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +41 -0
  135. data/spec/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +47 -0
  136. data/spec/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +331 -0
  137. data/spec/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +180 -0
  138. data/spec/shoulda/matchers/active_model/validate_uniqueness_of_matcher_spec.rb +398 -0
  139. data/spec/shoulda/matchers/active_model/validation_message_finder_spec.rb +127 -0
  140. data/spec/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +107 -0
  141. data/spec/shoulda/matchers/active_record/association_matcher_spec.rb +860 -0
  142. data/spec/shoulda/matchers/active_record/association_matchers/model_reflection_spec.rb +247 -0
  143. data/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +111 -0
  144. data/spec/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +78 -0
  145. data/spec/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb +41 -0
  146. data/spec/shoulda/matchers/active_record/serialize_matcher_spec.rb +86 -0
  147. data/spec/spec_helper.rb +26 -0
  148. data/spec/support/active_model_versions.rb +13 -0
  149. data/spec/support/active_resource_builder.rb +29 -0
  150. data/spec/support/activemodel_helpers.rb +19 -0
  151. data/spec/support/capture_helpers.rb +19 -0
  152. data/spec/support/class_builder.rb +42 -0
  153. data/spec/support/controller_builder.rb +74 -0
  154. data/spec/support/fail_with_message_including_matcher.rb +33 -0
  155. data/spec/support/fail_with_message_matcher.rb +32 -0
  156. data/spec/support/i18n_faker.rb +10 -0
  157. data/spec/support/mailer_builder.rb +10 -0
  158. data/spec/support/model_builder.rb +81 -0
  159. data/spec/support/rails_versions.rb +18 -0
  160. data/spec/support/shared_examples/numerical_submatcher.rb +19 -0
  161. data/spec/support/shared_examples/numerical_type_submatcher.rb +17 -0
  162. data/spec/support/test_application.rb +120 -0
  163. data/yard.watchr +5 -0
  164. metadata +281 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c096e55f73b803885444d4c6403f05d415c2b46b
4
+ data.tar.gz: 98132edf5cea73a593f1ce2ffbd61a0412e7443a
5
+ SHA512:
6
+ metadata.gz: 46e4382716b1e65c0c26231207e1663324164283f16425e9888b6cab729121b7b65f29703620b95bd7eee66d44474ff1eda17b0cdbb5761cf0d0c33006aa2def
7
+ data.tar.gz: a8c5297f2e1e6d10cbd4526db01fa884855a608d3cc30201b3e5cd9e547bb14d3f419278a92588cd6326aa45c24c1b53459d4059e33ed4c616d1ba3803bc55cb
@@ -0,0 +1,12 @@
1
+ *.rbc
2
+ *.swo
3
+ *.swp
4
+ .bundle
5
+ .gh-pages
6
+ .svn/
7
+ .yardoc
8
+ coverage
9
+ pkg
10
+ tags
11
+ test/*/log/*.log
12
+ tmp
@@ -0,0 +1,32 @@
1
+ script: "bundle exec rake spec cucumber"
2
+
3
+ install: "travis_retry bundle install"
4
+
5
+ rvm:
6
+ - 1.9.2
7
+ - 1.9.3
8
+
9
+ gemfile:
10
+ - gemfiles/3.0.gemfile
11
+ - gemfiles/3.1.gemfile
12
+ - gemfiles/3.2.gemfile
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: rbx-19mode
17
+ - rvm: jruby-19mode
18
+ include:
19
+ - rvm: 1.9.3
20
+ gemfile: gemfiles/4.0.0.gemfile
21
+ - rvm: 1.9.3
22
+ gemfile: gemfiles/4.0.1.gemfile
23
+ - rvm: 2.0.0
24
+ gemfile: gemfiles/3.2.gemfile
25
+ - rvm: 2.0.0
26
+ gemfile: gemfiles/4.0.0.gemfile
27
+ - rvm: 2.0.0
28
+ gemfile: gemfiles/4.0.1.gemfile
29
+ - rvm: rbx-19mode
30
+ gemfile: gemfiles/3.2.gemfile
31
+ - rvm: jruby-19mode
32
+ gemfile: gemfiles/3.2.gemfile
@@ -0,0 +1,7 @@
1
+ --no-private
2
+ --protected
3
+ --files README.md lib/**/*.rb
4
+ --markup markdown
5
+ --hide-tag return
6
+ --hide-tag param
7
+ -e ./doc_config/yard/setup.rb
@@ -0,0 +1,45 @@
1
+ rails_4_0 = proc do
2
+ gem 'jquery-rails'
3
+ gem 'activeresource', '4.0.0'
4
+ # Test suite makes heavy use of attr_accessible
5
+ gem 'protected_attributes'
6
+ end
7
+
8
+ #---
9
+
10
+ if RUBY_VERSION < '2.0'
11
+ appraise '3.0' do
12
+ gem 'rails', '~> 3.0.17'
13
+ gem 'strong_parameters'
14
+ end
15
+
16
+ appraise '3.1' do
17
+ gem 'rails', '~> 3.1.8'
18
+ gem 'bcrypt-ruby', '~> 3.0.0'
19
+ gem 'jquery-rails'
20
+ gem 'sass-rails'
21
+ gem 'strong_parameters'
22
+ end
23
+ end
24
+
25
+ appraise '3.2' do
26
+ gem 'rails', '~> 3.2.13'
27
+ gem 'bcrypt-ruby', '~> 3.0.0'
28
+ gem 'jquery-rails'
29
+ gem 'sass-rails'
30
+ gem 'strong_parameters'
31
+ end
32
+
33
+ appraise '4.0.0' do
34
+ instance_eval(&rails_4_0)
35
+ gem 'rails', '4.0.0'
36
+ gem 'sass-rails', '4.0.0'
37
+ gem 'bcrypt-ruby', '~> 3.0.0'
38
+ end
39
+
40
+ appraise '4.0.1' do
41
+ instance_eval(&rails_4_0)
42
+ gem 'rails', '4.0.1'
43
+ gem 'sass-rails', '4.0.1'
44
+ gem 'bcrypt-ruby', '~> 3.1.2'
45
+ end
@@ -0,0 +1,41 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
6
+ to know that you have a clean slate: `bundle && bundle exec rake`
7
+
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!
11
+
12
+ 4. Make the test pass.
13
+
14
+ 5. Update NEWS.md with a brief description of your changes under the HEAD
15
+ heading.
16
+
17
+ 6. Push to your fork and submit a pull request.
18
+
19
+
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!
data/Gemfile ADDED
@@ -0,0 +1,31 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'appraisal', '~> 1.0.0.beta2'
6
+ gem 'aruba'
7
+ gem 'bourne', '~> 1.3'
8
+ gem 'bundler', '~> 1.1'
9
+ gem 'cucumber', '~> 1.1'
10
+ gem 'pry'
11
+ gem 'rails', '~> 3.0'
12
+ gem 'rake', '>= 0.9.2'
13
+ gem 'rspec-rails', '>= 2.13.1', '< 3'
14
+
15
+ # YARD
16
+ gem 'yard'
17
+ gem 'redcarpet'
18
+ gem 'pygments.rb'
19
+ gem 'watchr'
20
+
21
+ # For test Rails application
22
+ gem 'shoulda-context', '~> 1.1.2'
23
+ gem 'sqlite3', :platform => :ruby
24
+
25
+ # Can't wrap in platform :jruby do...end block because appraisal doesn't
26
+ # support it
27
+ gem 'activerecord-jdbc-adapter', :platform => :jruby
28
+ gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
29
+ gem 'jdbc-sqlite3', :platform => :jruby
30
+ gem 'jruby-openssl', :platform => :jruby
31
+ gem 'therubyrhino', :platform => :jruby
@@ -0,0 +1,166 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mcmire-shoulda-matchers (2.5.0)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.16)
11
+ actionpack (= 3.2.16)
12
+ mail (~> 2.5.4)
13
+ actionpack (3.2.16)
14
+ activemodel (= 3.2.16)
15
+ activesupport (= 3.2.16)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.16)
24
+ activesupport (= 3.2.16)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.16)
27
+ activemodel (= 3.2.16)
28
+ activesupport (= 3.2.16)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.16)
32
+ activemodel (= 3.2.16)
33
+ activesupport (= 3.2.16)
34
+ activesupport (3.2.16)
35
+ i18n (~> 0.6, >= 0.6.4)
36
+ multi_json (~> 1.0)
37
+ appraisal (1.0.0.beta2)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
41
+ arel (3.0.3)
42
+ aruba (0.5.3)
43
+ childprocess (~> 0.3.6)
44
+ cucumber (>= 1.1.1)
45
+ rspec-expectations (>= 2.7.0)
46
+ bourne (1.5.0)
47
+ mocha (>= 0.13.2, < 0.15)
48
+ builder (3.0.4)
49
+ childprocess (0.3.9)
50
+ ffi (~> 1.0, >= 1.0.11)
51
+ coderay (1.1.0)
52
+ cucumber (1.3.10)
53
+ builder (>= 2.1.2)
54
+ diff-lcs (>= 1.1.3)
55
+ gherkin (~> 2.12)
56
+ multi_json (>= 1.7.5, < 2.0)
57
+ multi_test (>= 0.0.2)
58
+ diff-lcs (1.2.5)
59
+ erubis (2.7.0)
60
+ ffi (1.9.3)
61
+ gherkin (2.12.2)
62
+ multi_json (~> 1.3)
63
+ hike (1.2.3)
64
+ i18n (0.6.9)
65
+ journey (1.0.4)
66
+ json (1.8.1)
67
+ mail (2.5.4)
68
+ mime-types (~> 1.16)
69
+ treetop (~> 1.4.8)
70
+ metaclass (0.0.1)
71
+ method_source (0.8.2)
72
+ mime-types (1.25.1)
73
+ mocha (0.14.0)
74
+ metaclass (~> 0.0.1)
75
+ multi_json (1.8.4)
76
+ multi_test (0.0.3)
77
+ polyglot (0.3.3)
78
+ posix-spawn (0.3.8)
79
+ pry (0.9.12.6)
80
+ coderay (~> 1.0)
81
+ method_source (~> 0.8)
82
+ slop (~> 3.4)
83
+ pygments.rb (0.3.7)
84
+ posix-spawn (~> 0.3.6)
85
+ yajl-ruby (~> 1.1.0)
86
+ rack (1.4.5)
87
+ rack-cache (1.2)
88
+ rack (>= 0.4)
89
+ rack-ssl (1.3.3)
90
+ rack
91
+ rack-test (0.6.2)
92
+ rack (>= 1.0)
93
+ rails (3.2.16)
94
+ actionmailer (= 3.2.16)
95
+ actionpack (= 3.2.16)
96
+ activerecord (= 3.2.16)
97
+ activeresource (= 3.2.16)
98
+ activesupport (= 3.2.16)
99
+ bundler (~> 1.0)
100
+ railties (= 3.2.16)
101
+ railties (3.2.16)
102
+ actionpack (= 3.2.16)
103
+ activesupport (= 3.2.16)
104
+ rack-ssl (~> 1.3.2)
105
+ rake (>= 0.8.7)
106
+ rdoc (~> 3.4)
107
+ thor (>= 0.14.6, < 2.0)
108
+ rake (10.1.1)
109
+ rdoc (3.12.2)
110
+ json (~> 1.4)
111
+ redcarpet (3.0.0)
112
+ rspec-core (2.14.7)
113
+ rspec-expectations (2.14.4)
114
+ diff-lcs (>= 1.1.3, < 2.0)
115
+ rspec-mocks (2.14.4)
116
+ rspec-rails (2.14.1)
117
+ actionpack (>= 3.0)
118
+ activemodel (>= 3.0)
119
+ activesupport (>= 3.0)
120
+ railties (>= 3.0)
121
+ rspec-core (~> 2.14.0)
122
+ rspec-expectations (~> 2.14.0)
123
+ rspec-mocks (~> 2.14.0)
124
+ shoulda-context (1.1.6)
125
+ slop (3.4.7)
126
+ sprockets (2.2.2)
127
+ hike (~> 1.2)
128
+ multi_json (~> 1.0)
129
+ rack (~> 1.0)
130
+ tilt (~> 1.1, != 1.3.0)
131
+ sqlite3 (1.3.8)
132
+ thor (0.18.1)
133
+ tilt (1.4.1)
134
+ treetop (1.4.15)
135
+ polyglot
136
+ polyglot (>= 0.3.1)
137
+ tzinfo (0.3.38)
138
+ watchr (0.7)
139
+ yajl-ruby (1.1.0)
140
+ yard (0.8.7.3)
141
+
142
+ PLATFORMS
143
+ ruby
144
+
145
+ DEPENDENCIES
146
+ activerecord-jdbc-adapter
147
+ activerecord-jdbcsqlite3-adapter
148
+ appraisal (~> 1.0.0.beta2)
149
+ aruba
150
+ bourne (~> 1.3)
151
+ bundler (~> 1.1)
152
+ cucumber (~> 1.1)
153
+ jdbc-sqlite3
154
+ jruby-openssl
155
+ mcmire-shoulda-matchers!
156
+ pry
157
+ pygments.rb
158
+ rails (~> 3.0)
159
+ rake (>= 0.9.2)
160
+ redcarpet
161
+ rspec-rails (>= 2.13.1, < 3)
162
+ shoulda-context (~> 1.1.2)
163
+ sqlite3
164
+ therubyrhino
165
+ watchr
166
+ yard
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2006-2014, Tammer Saleh, thoughtbot, inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,299 @@
1
+ # HEAD
2
+
3
+ * Association matchers now test that the model being referred to (either
4
+ implicitly or explicitly, using `:class_name`) actually exists.
5
+
6
+ * Add ability to test `:autosave` option on associations.
7
+
8
+ * Fix `validate_uniqueness_of(...).allow_nil` so that it can be used against an
9
+ non-password attribute which is in a model that `has_secure_password`. Doing
10
+ so previously would result in a "Password digest missing on new record" error.
11
+
12
+ * Fix description for `validate_numericality_of` so that if the matcher fails,
13
+ the error message reported does not say the matcher accepts integer values if
14
+ you didn't specify that.
15
+
16
+ * Fix `ensure_inclusion_of` so that you can use it against a boolean column
17
+ (and pass boolean values to `in_array`). There are two caveats:
18
+
19
+ * You should not test that your attribute allows both true and false
20
+ (`.in_array([true, false]`); there's no way to test that it doesn't accept
21
+ anything other than that.
22
+ * You cannot test that your attribute allows nil (`.in_array([nil])`) if
23
+ the column does not allow null values.
24
+
25
+ * Change `validate_uniqueness_of(...)` so that it provides default values for
26
+ non-nullable attributes.
27
+
28
+ * Running `rake` now installs Appraisals before running the test suite.
29
+
30
+ * Additionally, we now manage Appraisals using the `appraisal` executable that
31
+ is coming in Appraisal 1.0.0 (we're using the beta for now).
32
+
33
+ * Add `allow_nil` option to `validate_numericality_of` so that you can validate
34
+ that numeric values are validated only if a value is supplied.
35
+
36
+ * Fix `validate_numericality_of` so that test fails when the value with
37
+ `greater_than`, `greater_than_or_equal_to`, `less_than`, `less_than_or_equal_
38
+ to` or `equal_to` is not appropriate.
39
+
40
+ # v 2.5.0
41
+
42
+ * Fix Rails/Test::Unit integration to ensure that the test case classes we are
43
+ re-opening actually exist.
44
+
45
+ * Fix `ensure_length_of` so that it uses the right message to validate when
46
+ `is_equal_to` is specified in conjunction with a custom message.
47
+
48
+ * The `route` matcher now accepts specifying a controller/action pair as a
49
+ string instead of only a hash (e.g. `route(...).to('posts#index')` instead of
50
+ `route(...).to(controller: 'posts', action: 'index')`).
51
+
52
+ * The `ensure_inclusion_of` matcher now works with a decimal column.
53
+
54
+ * Under Rails 3, if you had an association matcher chained with the
55
+ the `order` submatcher -- e.g. `should have_many(:foos).order(:bar)` -- and
56
+ your association had an `:include` on it, using the matcher would raise an
57
+ error. This has been fixed.
58
+
59
+ * Fix `validate_uniqueness_of` so it doesn't fail if the attribute under
60
+ test has a limit of fewer than 16 characters.
61
+
62
+ * You can now test that your `has_many :through` or `has_one :through`
63
+ associations are defined with a `:source` option.
64
+
65
+ * Add new matcher `validates_absence_of`.
66
+
67
+ * Update matchers so that they use `failure_message` and
68
+ `failure_message_when_negated` to define error messages. These are new methods
69
+ in the upcoming RSpec 3 release which replace `failure_message_for_should` and
70
+ `failure_message_for_should_not`. We've kept backward compatibility so all of
71
+ your existing tests should still work -- this is just to make sure when RSpec
72
+ 3 is released you don't get a bunch of warnings.
73
+
74
+ # v 2.4.0
75
+
76
+ * Fix a bug with the `validate_numericality_of` matcher that would not allow the
77
+ `with_message` option on certain submatchers.
78
+
79
+ * Fix a regression with context-dependent validations in ActiveResource
80
+
81
+ * shoulda-matchers is now fully compatible with Rails 4.
82
+
83
+ * When not using RSpec, shoulda-matchers is now auto-included into
84
+ ActiveSupport::TestCase instead of Test::Unit::TestCase (in Rails 4
85
+ the former no longer inherits from the latter).
86
+
87
+ # v 2.3.0
88
+
89
+ * Fix a bug in `ensure_inclusion_of` that would cause issues with using
90
+ `in_array` with an integer value.
91
+
92
+ * Add support for PostgreSQL UUID columns to `validates_uniqueness_of` (#334).
93
+
94
+ * Fix `validates_numericality_of` so that `is_equal_to` submatcher works
95
+ correctly (#326).
96
+
97
+ * Fix context support for validation matchers and disallowed values (#313).
98
+
99
+ * Add a `counter_cache` submatcher for `belongs_to` associations (#311).
100
+
101
+ * Add a `rescue_from` matcher for Rails controllers which checks that the
102
+ correct ActiveSupport call has been made and that the handlers exist without
103
+ actually throwing an exception (#287).
104
+
105
+ * Changed the scope of AssociationMatcher methods from protected to private.
106
+
107
+ * Extracted `#order`, `#through`, and `#dependent` from AssociationMatcher as
108
+ their own submatchers.
109
+
110
+ # v 2.2.0
111
+
112
+ * Fix `have_and_belong_to_many` matcher issue for Rails 4.
113
+
114
+ * Fix `validate_uniqueness_of.scoped_to` issue when the scoped field is already
115
+ taken (#207).
116
+
117
+ * Add comparison submatchers to `validate_numericality_of` to correspond to the
118
+ comparison options you can give to `validates_numericality_of` (#244).
119
+
120
+ # v 2.1.0
121
+
122
+ * Add missing `failure_message_for_should_not` implementations to
123
+ `validate_numericality_of` and its submatchers
124
+
125
+ * Support validation contexts for testing validations `on: :create` and when
126
+ using custom contexts like `model.valid?(:my_context)`.
127
+
128
+ * Fix a bug in validations with autosaved models.
129
+
130
+ * Fix maximum value detection for the `ensure_inclusion_of` and
131
+ `ensure_exclusion_of` matchers.
132
+
133
+ * Add `:odd` and `:even` options to the `validate_numericality_of` matcher.
134
+
135
+ * Add `:touch` option to AssociationMatcher.
136
+
137
+ * Ruby 2.0.0 is now officially supported.
138
+
139
+ * Fix the issue where using `%{attribute}` or `%{model}` in I18n translations
140
+ raised exceptions.
141
+
142
+ * Support datetime columns in `validate_uniqueness_of.scoped_to`.
143
+
144
+ * Add `allow_nil` option to the `validate_uniqueness_of` matcher.
145
+
146
+ # v 2.0.0
147
+ * Remove the following matchers:
148
+ * `assign_to`
149
+ * `respond_with_content_type`
150
+ * `query_the_database`
151
+ * `validate_format_of`
152
+ * `have_sent_email`
153
+ * `permit` (strong parameters matcher)
154
+ * `delegate_method`
155
+
156
+ * For more information about 2.0 changes, see:
157
+ http://robots.thoughtbot.com/post/47031676783/shoulda-matchers-2-0.
158
+
159
+ # v 1.5.6
160
+ * Revert previous change in AllowValueMatcher that added a check for a
161
+ properly-set attribute.
162
+
163
+ # v 1.5.5
164
+ * AllowValueMatcher checks that the right value is used for attempts at
165
+ setting the attribute with it.
166
+ * Please note that previously-passing tests might now fail. It is likely that
167
+ it's not a bug, but please make sure that the code you're testing is written
168
+ properly before submitting an issue.
169
+
170
+ * Use DisallowValueMatcher for `disallows_value_of` method.
171
+
172
+ * Assert `class_name` value on real class name for AssociationMatcher.
173
+
174
+ * Correct the variable used for `validate_confirmation_of` matcher description.
175
+
176
+ # v 1.5.4
177
+ * Properly-released version of 1.5.3.
178
+
179
+ # v 1.5.3 - yanked due to mis-release
180
+ * Alleviate the need to add `rspec` gem to your app.
181
+
182
+ # v 1.5.1
183
+ * Bump version dependency of Bourne to allow for Mocha upgrade.
184
+
185
+ * Should fix incompatibility with MiniTest.
186
+
187
+ # v 1.5.0
188
+ * Deprecate the following matchers:
189
+ * `assign_to`
190
+ * `respond_with_content_type`
191
+ * `query_the_database`
192
+ * `validate_format_of`
193
+ * `have_sent_email`
194
+ * `permit` (strong parameters matcher)
195
+ * `delegate_method`
196
+
197
+ * Use RSpec's native `configure.include` syntax for including matchers into
198
+ RSpec (#204).
199
+
200
+ * Do not force MiniTest loading when test-unit is available (this was fixed
201
+ before 1.3.0 then reverted in 1.3.0).
202
+
203
+ # v1.4.2
204
+ * Add a new `delegate_method` matcher.
205
+
206
+ # v1.4.1
207
+ * Fix an issue when used with Test::Unit on the allow value matcher.
208
+
209
+ * Fix an issue with using `ensure_inclusion_of(:attr)` given an array of true or false values.
210
+
211
+ # v1.4.0
212
+
213
+ * Add `strict` option to validation matchers.
214
+
215
+ * Verify that arguments to `set_the_flash` matcher are valid.
216
+
217
+ * Fix issue in ValidateUniquenessMatcher that could cause an error on postgres.
218
+
219
+ * You can now pass an array to `ensure_exclusion_of` using `in_array`.
220
+
221
+ * Allow testing of `:foreign_key` option for `has_one` relationships using the association matcher.
222
+
223
+ * Fix bug where `ensure_length_of` would pass if the given string was too long.
224
+
225
+ * `allow_blank` will now allow values such as: ' ', '\n', and '\r'.
226
+
227
+ * Test outside values for `ensure_inclusion_of` when given an array.
228
+
229
+ * Fix the output of the `set_the_flash` matcher.
230
+
231
+ # v1.3.0
232
+
233
+ * `validate_format_of` will accept `allow_blank(bool)` and `allow_nil(bool)`.
234
+
235
+ * Prefer Test::Unit to MiniTest when loading integrations so that RubyMine is
236
+ happy (#88).
237
+
238
+ * `validates_uniqueness_of` will now create a record if one does not exist.
239
+ Previously, users were required to create a record in the database before
240
+ using this matcher.
241
+
242
+ * Fix an edge case when where the matchers weren't loaded into Test::Unit when
243
+ mixing RSpec and Test::Unit tests and also loading both the 'rspec-rails' gem
244
+ and 'shoulda-matchers' gem from the same Gemfile group, namely [:test,
245
+ :development].
246
+
247
+ * `controller.should_not render_partial` now correctly matches `render partial: "partial"`.
248
+
249
+ # v1.2.0
250
+
251
+ * `ensure_inclusion_of` now has an `in_array` parameter:
252
+ `ensure_inclusion_of(:attr).in_array(['foo', 'bar'])`. It cannot be used with
253
+ the `.in_range` option. (vpereira)
254
+
255
+ * `ensure_in_inclusion_of` with `in_array` will accept `allow_blank(bool)` and `allow_nil(false)`
256
+
257
+ * Test against Rails 3.2.
258
+
259
+ * Fix `ensure_length_of` to use all possible I18n error messages.
260
+
261
+ * `have_db_index.unique(nil)` used to function exactly the same as
262
+ `have_db_index` with no unique option. It now functions the same as
263
+ `have_db_index.unique(false)`.
264
+
265
+ * In 1.1.0, `have_sent_email` checked all emails to ensure they matched. It now
266
+ checks that only one email matches, which restores 1.0.0 behavior.
267
+
268
+ # v1.1.0
269
+
270
+ * Add `only_integer` option to `validate_numericality_of`:
271
+ `should validate_numericality_of(:attribute).only_integer`
272
+
273
+ * Add a `query_the_database` matcher:
274
+
275
+ `it { should query_the_database(4.times).when_calling(:complicated_method) }`
276
+ `it { should query_the_database(4.times).or_less.when_calling(:complicated_method) }`
277
+ `it { should_not query_the_database.when_calling(:complicated_method) }`
278
+
279
+ * Database columns are now correctly checked for primality. E.G., this works
280
+ now: `it { should have_db_column(:id).with_options(:primary => true) }`
281
+
282
+ * The flash matcher can check specific flash keys using [], like so:
283
+ `it { should set_the_flash[:alert].to("Password doesn't match") }`
284
+
285
+ * The `have_sent_email` matcher can check `reply_to`:
286
+ ` it { should have_sent_email.reply_to([user, other]) }`
287
+
288
+ * Add `validates_confirmation_of` matcher:
289
+ `it { should validate_confirmation_of(:password) }`
290
+
291
+ * Add `serialize` matcher:
292
+ `it { should serialize(:details).as(Hash).as_instance_of(Hash) }`
293
+
294
+ * shoulda-matchers checks for all possible I18n keys, instead of just
295
+ e.g. `activerecord.errors.messages.blank`
296
+
297
+ * Add `accept_nested_attributes` matcher
298
+
299
+ * Our very first dependency: ActiveSupport &gt;= 3.0.0