shoulda-matchers 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +1 -1
  3. data/.hound/ruby.yml +1042 -0
  4. data/{.hound_config/ruby.yml → .rubocop.yml} +7 -6
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +26 -32
  7. data/NEWS.md +18 -0
  8. data/README.md +32 -6
  9. data/docs/errors/NonCaseSwappableValueError.md +2 -2
  10. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +6 -6
  11. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -1
  12. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +7 -8
  13. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
  14. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +1 -1
  15. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +2 -2
  16. data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -1
  17. data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -3
  18. data/lib/shoulda/matchers/action_controller/route_matcher.rb +2 -2
  19. data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +4 -4
  20. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
  21. data/lib/shoulda/matchers/active_model.rb +1 -1
  22. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +3 -3
  23. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +10 -10
  24. data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +1 -1
  25. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +3 -3
  26. data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +3 -3
  27. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +3 -3
  28. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +4 -4
  29. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +8 -8
  30. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +8 -8
  31. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +12 -12
  32. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +4 -4
  33. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +4 -4
  34. data/lib/shoulda/matchers/active_record/association_matcher.rb +61 -43
  35. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +2 -3
  36. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +3 -3
  37. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +3 -3
  38. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +1 -1
  39. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -3
  40. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +11 -11
  41. data/lib/shoulda/matchers/version.rb +1 -1
  42. data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +9 -0
  43. metadata +5 -5
@@ -9,9 +9,8 @@ module Shoulda
9
9
  # end
10
10
  #
11
11
  # # RSpec
12
- # describe Process do
12
+ # RSpec.describe Process, type: :model do
13
13
  # it { should define_enum_for(:status) }
14
- # end
15
14
  # end
16
15
  #
17
16
  # # Minitest (Shoulda)
@@ -31,7 +30,7 @@ module Shoulda
31
30
  # end
32
31
  #
33
32
  # # RSpec
34
- # describe Process do
33
+ # RSpec.describe Process, type: :model do
35
34
  # it do
36
35
  # should define_enum_for(:status).
37
36
  # with([:running, :stopped, :suspended])
@@ -13,7 +13,7 @@ module Shoulda
13
13
  # end
14
14
  #
15
15
  # # RSpec
16
- # describe Phone do
16
+ # RSpec.describe Phone, type: :model do
17
17
  # it { should have_db_column(:supported_ios_version) }
18
18
  # end
19
19
  #
@@ -37,7 +37,7 @@ module Shoulda
37
37
  # end
38
38
  #
39
39
  # # RSpec
40
- # describe Phone do
40
+ # RSpec.describe Phone, type: :model do
41
41
  # it do
42
42
  # should have_db_column(:camera_aperture).of_type(:decimal)
43
43
  # end
@@ -63,7 +63,7 @@ module Shoulda
63
63
  # end
64
64
  #
65
65
  # # RSpec
66
- # describe Phone do
66
+ # RSpec.describe Phone, type: :model do
67
67
  # it do
68
68
  # should have_db_column(:camera_aperture).
69
69
  # with_options(precision: 1, null: false)
@@ -15,7 +15,7 @@ module Shoulda
15
15
  # end
16
16
  #
17
17
  # # RSpec
18
- # describe Blog do
18
+ # RSpec.describe Blog, type: :model do
19
19
  # it { should have_db_index(:user_id) }
20
20
  # end
21
21
  #
@@ -41,7 +41,7 @@ module Shoulda
41
41
  # end
42
42
  #
43
43
  # # RSpec
44
- # describe Blog do
44
+ # RSpec.describe Blog, type: :model do
45
45
  # it { should have_db_index(:name).unique(true) }
46
46
  # end
47
47
  #
@@ -54,7 +54,7 @@ module Shoulda
54
54
  # leave off the argument to save some keystrokes:
55
55
  #
56
56
  # # RSpec
57
- # describe Blog do
57
+ # RSpec.describe Blog, type: :model do
58
58
  # it { should have_db_index(:name).unique }
59
59
  # end
60
60
  #
@@ -9,7 +9,7 @@ module Shoulda
9
9
  # end
10
10
  #
11
11
  # # RSpec
12
- # describe User do
12
+ # RSpec.describe User, type: :model do
13
13
  # it { should have_readonly_attribute(:password) }
14
14
  # end
15
15
  #
@@ -8,7 +8,7 @@ module Shoulda
8
8
  # end
9
9
  #
10
10
  # # RSpec
11
- # describe Product do
11
+ # RSpec.describe Product, type: :model do
12
12
  # it { should serialize(:customizations) }
13
13
  # end
14
14
  #
@@ -38,7 +38,7 @@ module Shoulda
38
38
  # end
39
39
  #
40
40
  # # RSpec
41
- # describe Product do
41
+ # RSpec.describe Product, type: :model do
42
42
  # it do
43
43
  # should serialize(:specifications).
44
44
  # as(ProductSpecsSerializer)
@@ -70,7 +70,7 @@ module Shoulda
70
70
  # end
71
71
  #
72
72
  # # RSpec
73
- # describe Product do
73
+ # RSpec.describe Product, type: :model do
74
74
  # it do
75
75
  # should serialize(:options).
76
76
  # as_instance_of(ProductOptionsSerializer)
@@ -14,7 +14,7 @@ module Shoulda
14
14
  # end
15
15
  #
16
16
  # # RSpec
17
- # describe Post do
17
+ # RSpec.describe Post, type: :model do
18
18
  # it { should validate_uniqueness_of(:permalink) }
19
19
  # end
20
20
  #
@@ -49,7 +49,7 @@ module Shoulda
49
49
  #
50
50
  # You may be tempted to test the model like this:
51
51
  #
52
- # describe Post do
52
+ # RSpec.describe Post, type: :model do
53
53
  # it { should validate_uniqueness_of(:title) }
54
54
  # end
55
55
  #
@@ -78,7 +78,7 @@ module Shoulda
78
78
  # end of the error message, the solution is to build a custom Post object
79
79
  # ahead of time with `content` filled in:
80
80
  #
81
- # describe Post do
81
+ # RSpec.describe Post, type: :model do
82
82
  # describe "validations" do
83
83
  # subject { Post.new(content: "Here is the content") }
84
84
  # it { should validate_uniqueness_of(:title) }
@@ -90,7 +90,7 @@ module Shoulda
90
90
  # `post` factory defined which automatically fills in `content`, you can
91
91
  # say:
92
92
  #
93
- # describe Post do
93
+ # RSpec.describe Post, type: :model do
94
94
  # describe "validations" do
95
95
  # subject { FactoryGirl.build(:post) }
96
96
  # it { should validate_uniqueness_of(:title) }
@@ -106,7 +106,7 @@ module Shoulda
106
106
  # end
107
107
  #
108
108
  # # RSpec
109
- # describe Post do
109
+ # RSpec.describe Post, type: :model do
110
110
  # it { should validate_uniqueness_of(:title).on(:create) }
111
111
  # end
112
112
  #
@@ -124,7 +124,7 @@ module Shoulda
124
124
  # end
125
125
  #
126
126
  # # RSpec
127
- # describe Post do
127
+ # RSpec.describe Post, type: :model do
128
128
  # it do
129
129
  # should validate_uniqueness_of(:title).
130
130
  # with_message('Please choose another title')
@@ -148,7 +148,7 @@ module Shoulda
148
148
  # end
149
149
  #
150
150
  # # RSpec
151
- # describe Post do
151
+ # RSpec.describe Post, type: :model do
152
152
  # it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) }
153
153
  # end
154
154
  #
@@ -169,7 +169,7 @@ module Shoulda
169
169
  # end
170
170
  #
171
171
  # # RSpec
172
- # describe Post do
172
+ # RSpec.describe Post, type: :model do
173
173
  # it { should validate_uniqueness_of(:key).case_insensitive }
174
174
  # end
175
175
  #
@@ -201,7 +201,7 @@ module Shoulda
201
201
  # end
202
202
  #
203
203
  # # RSpec
204
- # describe Post do
204
+ # RSpec.describe Post, type: :model do
205
205
  # it do
206
206
  # should validate_uniqueness_of(:email).ignoring_case_sensitivity
207
207
  # end
@@ -221,7 +221,7 @@ module Shoulda
221
221
  # end
222
222
  #
223
223
  # # RSpec
224
- # describe Post do
224
+ # RSpec.describe Post, type: :model do
225
225
  # it { should validate_uniqueness_of(:author_id).allow_nil }
226
226
  # end
227
227
  #
@@ -241,7 +241,7 @@ module Shoulda
241
241
  # end
242
242
  #
243
243
  # # RSpec
244
- # describe Post do
244
+ # RSpec.describe Post, type: :model do
245
245
  # it { should validate_uniqueness_of(:author_id).allow_blank }
246
246
  # end
247
247
  #
@@ -1,6 +1,6 @@
1
1
  module Shoulda
2
2
  module Matchers
3
3
  # @private
4
- VERSION = '3.1.1'.freeze
4
+ VERSION = '3.1.2'.freeze
5
5
  end
6
6
  end
@@ -190,6 +190,15 @@ describe Shoulda::Matchers::ActionController::PermitMatcher, type: :controller d
190
190
  for(:update, params: { id: 1 })
191
191
  end
192
192
 
193
+ it 'works when multiple ActionController::Parameters were instantiated' do
194
+ define_controller_with_strong_parameters(action: :create) do
195
+ params.permit(:name)
196
+ params.dup
197
+ end
198
+
199
+ expect(controller).to permit(:name).for(:create)
200
+ end
201
+
193
202
  describe '#matches?' do
194
203
  it 'does not raise an error when #fetch was used instead of #require (issue #495)' do
195
204
  matcher = permit(:eta, :diner_id).for(:create)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tammer Saleh
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2016-01-28 00:00:00.000000000 Z
17
+ date: 2017-07-12 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport
@@ -38,7 +38,8 @@ extra_rdoc_files: []
38
38
  files:
39
39
  - ".gitignore"
40
40
  - ".hound.yml"
41
- - ".hound_config/ruby.yml"
41
+ - ".hound/ruby.yml"
42
+ - ".rubocop.yml"
42
43
  - ".travis.yml"
43
44
  - ".yardopts"
44
45
  - Appraisals
@@ -365,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
366
  version: '0'
366
367
  requirements: []
367
368
  rubyforge_project:
368
- rubygems_version: 2.5.1
369
+ rubygems_version: 2.6.11
369
370
  signing_key:
370
371
  specification_version: 4
371
372
  summary: Making tests easy on the fingers and eyes
@@ -504,4 +505,3 @@ test_files:
504
505
  - spec/warnings_spy/partitioner.rb
505
506
  - spec/warnings_spy/reader.rb
506
507
  - spec/warnings_spy/reporter.rb
507
- has_rdoc: