mongoid-rspec 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/README.md +217 -111
  4. data/Rakefile +8 -5
  5. data/lib/matchers/accept_nested_attributes.rb +22 -23
  6. data/lib/matchers/allow_mass_assignment.rb +12 -12
  7. data/lib/matchers/associations.rb +36 -37
  8. data/lib/matchers/be_dynamic_document.rb +26 -0
  9. data/lib/matchers/be_mongoid_document.rb +26 -0
  10. data/lib/matchers/be_stored_in.rb +55 -0
  11. data/lib/matchers/have_field.rb +90 -0
  12. data/lib/matchers/have_timestamps.rb +61 -0
  13. data/lib/matchers/indexes/have_index_for.rb +16 -0
  14. data/lib/matchers/indexes/v3/have_index_for.rb +59 -0
  15. data/lib/matchers/indexes/v4/have_index_for.rb +54 -0
  16. data/lib/matchers/validations.rb +30 -11
  17. data/lib/matchers/validations/associated.rb +1 -1
  18. data/lib/matchers/validations/confirmation_of.rb +0 -7
  19. data/lib/matchers/validations/custom_validation_of.rb +1 -4
  20. data/lib/matchers/validations/exclusion_of.rb +5 -5
  21. data/lib/matchers/validations/format_of.rb +2 -2
  22. data/lib/matchers/validations/inclusion_of.rb +5 -5
  23. data/lib/matchers/validations/length_of.rb +13 -35
  24. data/lib/matchers/validations/numericality_of.rb +32 -16
  25. data/lib/matchers/validations/presence_of.rb +1 -1
  26. data/lib/matchers/validations/uniqueness_of.rb +7 -10
  27. data/lib/mongoid/rspec.rb +17 -5
  28. data/lib/mongoid/rspec/version.rb +2 -2
  29. data/spec/models/article.rb +6 -6
  30. data/spec/models/comment.rb +1 -1
  31. data/spec/models/log.rb +3 -3
  32. data/spec/models/message.rb +11 -0
  33. data/spec/models/movie_article.rb +1 -2
  34. data/spec/models/person.rb +1 -1
  35. data/spec/models/profile.rb +2 -2
  36. data/spec/models/record.rb +1 -1
  37. data/spec/models/user.rb +11 -11
  38. data/spec/spec_helper.rb +9 -9
  39. data/spec/unit/accept_nested_attributes_spec.rb +1 -1
  40. data/spec/unit/associations_spec.rb +11 -7
  41. data/spec/unit/be_dynamic_document_spec.rb +21 -0
  42. data/spec/unit/be_mongoid_document_spec.rb +25 -0
  43. data/spec/unit/be_stored_in.rb +54 -0
  44. data/spec/unit/document_spec.rb +5 -14
  45. data/spec/unit/have_index_for_spec.rb +46 -0
  46. data/spec/unit/have_timestamps_spec.rb +71 -0
  47. data/spec/unit/validations_spec.rb +22 -15
  48. data/spec/validators/ssn_validator.rb +6 -6
  49. metadata +63 -29
  50. data/.document +0 -5
  51. data/.gitignore +0 -6
  52. data/.ruby-gemset +0 -1
  53. data/.ruby-version +0 -1
  54. data/.travis.yml +0 -10
  55. data/Gemfile +0 -4
  56. data/lib/matchers/collections.rb +0 -9
  57. data/lib/matchers/document.rb +0 -173
  58. data/lib/matchers/indexes.rb +0 -69
  59. data/lib/matchers/validations/with_message.rb +0 -27
  60. data/mongoid-rspec.gemspec +0 -26
  61. data/spec/unit/collections_spec.rb +0 -7
  62. data/spec/unit/indexes_spec.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b504e1e16799457c84312c3adc8eb0087c4f73a5
4
- data.tar.gz: 8e7b3f190ccae6c7176e060058361b12ef9ba419
2
+ SHA256:
3
+ metadata.gz: 25fcea5e8cc5e8f247b099f60276d560a83c2538e47856a8063f6fae57bffa37
4
+ data.tar.gz: 291d75e35f982c38b7c58787d6127a0d693e850f3ef1840f02d45963304ad2c1
5
5
  SHA512:
6
- metadata.gz: 80b798e3c37139a718d8d5ee53dabdfddfe5936e3aebc5ab2cf844533761f038fb87c1be831ccbf2f3cb13a2748090890069273250b9046e9951404b6e10f3ff
7
- data.tar.gz: 67ef37f44c29b2484157fa048de71365af86e2aad025a064e72167303ebfc0fd2e786832c04652a193f00a05dc4e816559095ef19476920fa53eb345910cabf7
6
+ metadata.gz: f53b92e750ceba490eecd7c492b6ffd967131566ffc228c887a35f3e202d75a337a7903cd1b35717e54243906e582306773e2b849f0aea9462448351b58e0594
7
+ data.tar.gz: d4e252e36a4b77b17b081e0e58176776c6c337a871864c1f805514c9da45cb8d0607fa42e518d08c28ecb8ce419008b1b85c4d07c2ee9f5c627642926775a324
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Evan Sagge
1
+ Copyright (c) 2009-2018 Evan Sagge and Contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,52 +1,218 @@
1
- # [mongoid-rspec]
1
+ # [mongoid-rspec](https://github.com/mongoid/mongoid-rspec "A collection of RSpec-compatible matchers that help to test Mongoid documents.")
2
2
 
3
- [![Build Status][travis_badge]][travis]
4
- [![Gem Version][rubygems_badge]][rubygems]
5
- [![Code Climate][codeclimate_badge]][codeclimate]
3
+ [![Build Status](https://travis-ci.org/mongoid/mongoid-rspec.svg?branch=master)](https://travis-ci.org/mongoid/mongoid-rspec)
4
+ [![Gem Version](https://badge.fury.io/rb/mongoid-rspec.svg)](https://badge.fury.io/rb/mongoid-rspec)
6
5
 
7
- mongoid-rspec provides a collection of RSpec-compatible matchers that help to test Mongoid documents.
6
+ The mongoid-rspec library provides a collection of RSpec-compatible matchers that help to test Mongoid documents.
8
7
 
9
8
  ## Installation
10
9
 
11
- ### With Mongoid 5.x
10
+ Drop this line into your Gemfile:
12
11
 
13
- Use mongoid-rspec [3.0.0][mongoid5]
12
+ ```ruby
13
+ group :test do
14
+ gem 'mongoid-rspec'
15
+ end
14
16
 
15
- gem 'mongoid-rspec', '3.0.0'
17
+ ```
16
18
 
17
- ### With Mongoid 4.x
19
+ ## Compatibility
18
20
 
19
- Use mongoid-rspec [2.1.0][mongoid4]
21
+ This gem is compatible with Mongoid 3, 4, 5 and 6.
20
22
 
21
- gem 'mongoid-rspec', '~> 2.1.0'
23
+ ## Configuration
22
24
 
23
- ### With Mongoid 3.x
25
+ ### Rails
24
26
 
25
- Use mongoid-rspec [1.13.0][mongoid3].
27
+ Add to your `rails_helper.rb` file
26
28
 
27
- gem 'mongoid-rspec', '~> 1.13.0'
29
+ ```ruby
30
+ require 'mongoid-rspec'
28
31
 
29
- ### With Mongoid 2.x
32
+ RSpec.configure do |config|
33
+ config.include Mongoid::Matchers, type: :model
34
+ end
35
+ ```
30
36
 
31
- Use mongoid-rspec [1.4.5][mongoid2]
37
+ ### Other
32
38
 
33
- gem 'mongoid-rspec', '1.4.5'
39
+ Add to your `spec_helper.rb` file.
34
40
 
35
- ### Configuring
41
+ ```ruby
42
+ require 'mongoid-rspec'
36
43
 
37
- Drop in existing or dedicated support file in spec/support.
38
- i.e: `spec/support/mongoid.rb`
44
+ RSpec.configure do |config|
45
+ config.include Mongoid::Matchers
46
+ end
47
+ ```
48
+
49
+ ## Matchers
50
+
51
+ ### be_mongoid_document
39
52
 
40
53
  ```ruby
41
- RSpec.configure do |config|
42
- config.include Mongoid::Matchers, type: :model
54
+ class Post
55
+ include Mongoid::Document
56
+ end
57
+
58
+ RSpec.describe Post, type: :model do
59
+ it { is_expected.to be_mongoid_document }
43
60
  end
44
61
  ```
45
62
 
46
- If you aren't using rails then you don't have to specify the type.
47
- If you want to know why visit [the rspec documentation](https://relishapp.com/rspec/rspec-rails/docs/directory-structure).
63
+ ### be_dynamic_document
48
64
 
49
- ## Matchers
65
+ ```ruby
66
+ class User
67
+ include Mongoid::Document
68
+ include Mongoid::Attributes::Dynamic
69
+ end
70
+
71
+ RSpec.describe User, type: :model do
72
+ it { is_expected.to be_dynamic_document }
73
+ end
74
+ ```
75
+
76
+ ### have_timestamps
77
+
78
+ With full timestamps.
79
+
80
+ ```ruby
81
+ class Log
82
+ include Mongoid::Document
83
+ include Mongoid::Timestamps
84
+ end
85
+
86
+ RSpec.describe Log, type: :model do
87
+ it { is_expected.to have_timestamps }
88
+ end
89
+ ```
90
+
91
+ With short timestamps.
92
+
93
+ ```ruby
94
+ class User
95
+ include Mongoid::Document
96
+ include Mongoid::Timestamps::Short
97
+ end
98
+
99
+ RSpec.describe User, type: :model do
100
+ it { is_expected.to have_timestamps.shortened }
101
+ end
102
+ ```
103
+
104
+ With only creating or updating timestamps.
105
+
106
+ ```ruby
107
+ class Admin
108
+ include Mongoid::Document
109
+ include Mongoid::Timestamps::Create
110
+ include Mongoid::Timestamps::Update
111
+ end
112
+
113
+ RSpec.describe Admin, type: :model do
114
+ it { is_expected.to have_timestamps.for(:creating) }
115
+ it { is_expected.to have_timestamps.for(:updating) }
116
+ end
117
+ ```
118
+
119
+ With short creating or updating timestamps.
120
+
121
+ ```ruby
122
+ class Post
123
+ include Mongoid::Document
124
+ include Mongoid::Timestamps::Create::Short
125
+ end
126
+
127
+ RSpec.describe Short, type: :model do
128
+ it { is_expected.to have_timestamps.for(:creating).shortened }
129
+ end
130
+ ```
131
+
132
+ ### be_stored_in
133
+
134
+ ```ruby
135
+ class Post
136
+ include Mongoid::Document
137
+
138
+ store_in database: 'db1', collection: 'messages', client: 'secondary'
139
+ end
140
+
141
+ RSpec.describe Post, type: :model do
142
+ it { is_expected.to be_stored_in(database: 'db1', collection: 'messages', client: 'secondary') }
143
+ end
144
+ ```
145
+
146
+ It checks only those options, that you specify. For instance, test in example below will pass, even though expectation contains only `database` option.
147
+
148
+ ```ruby
149
+ class Comment
150
+ include Mongoid::Document
151
+
152
+ store_in database: 'db2', collection: 'messages'
153
+ end
154
+
155
+ RSpec.describe Comment, type: :model do
156
+ it { is_expected.to be_stored_in(database: 'db2') }
157
+ end
158
+ ```
159
+
160
+ It works fine with lambdas and procs.
161
+
162
+ ```ruby
163
+ class User
164
+ include Mongoid::Document
165
+
166
+ store_in database: ->{ Thread.current[:database] }
167
+ end
168
+
169
+ RSpec.describe Post, type: :model do
170
+ it do
171
+ Thread.current[:database] = 'db3'
172
+ is_expected.to be_stored_in(database: 'db3')
173
+
174
+ Thread.current[:database] = 'db4'
175
+ is_expected.to be_stored_in(database: 'db4')
176
+ end
177
+ end
178
+ ```
179
+
180
+ ### have_index_for
181
+
182
+ ```ruby
183
+ class Article
184
+ index({ title: 1 }, { unique: true, background: true, drop_dups: true })
185
+ index({ title: 1, created_at: -1 })
186
+ index({ category: 1 })
187
+ end
188
+
189
+ RSpec.describe Article, type: :model do
190
+ it do
191
+ is_expected
192
+ .to have_index_for(title: 1)
193
+ .with_options(unique: true, background: true, drop_dups: true)
194
+ end
195
+ it { is_expected.to have_index_for(title: 1, created_at: -1) }
196
+ it { is_expected.to have_index_for(category: 1) }
197
+ end
198
+ ```
199
+
200
+ ### Field Matchers
201
+
202
+ ```ruby
203
+ RSpec.describe Article do
204
+ it { is_expected.to have_field(:published).of_type(Boolean).with_default_value_of(false) }
205
+ it { is_expected.to have_field(:allow_comments).of_type(Boolean).with_default_value_of(true) }
206
+ it { is_expected.not_to have_field(:allow_comments).of_type(Boolean).with_default_value_of(false) }
207
+ it { is_expected.not_to have_field(:number_of_comments).of_type(Integer).with_default_value_of(1) }
208
+ end
209
+
210
+ RSpec.describe User do
211
+ it { is_expected.to have_fields(:email, :login) }
212
+ it { is_expected.to have_field(:s).with_alias(:status) }
213
+ it { is_expected.to have_fields(:birthdate, :registered_at).of_type(DateTime) }
214
+ end
215
+ ```
50
216
 
51
217
  ### Association Matchers
52
218
 
@@ -55,14 +221,16 @@ RSpec.describe User do
55
221
  it { is_expected.to have_many(:articles).with_foreign_key(:author_id).ordered_by(:title) }
56
222
 
57
223
  it { is_expected.to have_one(:record) }
58
- #can verify autobuild is set to true
224
+
225
+ # can verify autobuild is set to true
59
226
  it { is_expected.to have_one(:record).with_autobuild }
60
227
 
61
228
  it { is_expected.to have_many :comments }
62
229
 
63
- #can also specify with_dependent to test if :dependent => :destroy/:destroy_all/:delete is set
230
+ # can also specify with_dependent to test if :dependent => :destroy/:destroy_all/:delete is set
64
231
  it { is_expected.to have_many(:comments).with_dependent(:destroy) }
65
- #can verify autosave is set to true
232
+
233
+ # can verify autosave is set to true
66
234
  it { is_expected.to have_many(:comments).with_autosave }
67
235
 
68
236
  it { is_expected.to embed_one :profile }
@@ -95,21 +263,6 @@ RSpec.describe Site do
95
263
  end
96
264
  ```
97
265
 
98
- ### Mass Assignment Matcher
99
-
100
- ```ruby
101
- RSpec.describe User do
102
- it { is_expected.to allow_mass_assignment_of(:login) }
103
- it { is_expected.to allow_mass_assignment_of(:email) }
104
- it { is_expected.to allow_mass_assignment_of(:age) }
105
- it { is_expected.to allow_mass_assignment_of(:password) }
106
- it { is_expected.to allow_mass_assignment_of(:password) }
107
- it { is_expected.to allow_mass_assignment_of(:role).as(:admin) }
108
-
109
- it { is_expected.not_to allow_mass_assignment_of(:role) }
110
- end
111
- ```
112
-
113
266
  ### Validation Matchers
114
267
 
115
268
  ```ruby
@@ -139,6 +292,10 @@ RSpec.describe Article do
139
292
  it { is_expected.to validate_length_of(:title).within(8..16) }
140
293
  end
141
294
 
295
+ RSpec.describe Visitor do
296
+ it { is_expected.to validate_length_of(:name).with_maximum(160).with_minimum(1) }
297
+ end
298
+
142
299
  RSpec.describe Profile do
143
300
  it { is_expected.to validate_numericality_of(:age).greater_than(0) }
144
301
  end
@@ -155,91 +312,40 @@ RSpec.describe Person do
155
312
  end
156
313
  ```
157
314
 
158
- ### Accepts Nested Attributes Matcher
315
+ ### Mass Assignment Matcher
159
316
 
160
317
  ```ruby
161
318
  RSpec.describe User do
162
- it { is_expected.to accept_nested_attributes_for(:articles) }
163
- it { is_expected.to accept_nested_attributes_for(:comments) }
164
- end
165
-
166
- RSpec.describe Article do
167
- it { is_expected.to accept_nested_attributes_for(:permalink) }
168
- end
169
- ```
170
-
171
- ### Index Matcher
172
-
173
- ```ruby
174
- RSpec.describe Article do
175
- it { is_expected.to have_index_for(published: 1) }
176
- it { is_expected.to have_index_for(title: 1).with_options(unique: true, background: true) }
177
- end
178
-
179
- RSpec.describe Profile do
180
- it { is_expected.to have_index_for(first_name: 1, last_name: 1) }
181
- end
319
+ it { is_expected.to allow_mass_assignment_of(:login) }
320
+ it { is_expected.to allow_mass_assignment_of(:email) }
321
+ it { is_expected.to allow_mass_assignment_of(:age) }
322
+ it { is_expected.to allow_mass_assignment_of(:password) }
323
+ it { is_expected.to allow_mass_assignment_of(:password) }
324
+ it { is_expected.to allow_mass_assignment_of(:role).as(:admin) }
182
325
 
183
- Rspec.describe Log do
184
- it { is_expected.to have_index_for(created_at: 1).with_options(bucket_size: 100, expire_after_seconds: 3600) }
326
+ it { is_expected.not_to allow_mass_assignment_of(:role) }
185
327
  end
186
328
  ```
187
329
 
188
- ### Others
330
+ ### Accepts Nested Attributes Matcher
189
331
 
190
332
  ```ruby
191
333
  RSpec.describe User do
192
- it { is_expected.to have_fields(:email, :login) }
193
- it { is_expected.to have_field(:s).with_alias(:status) }
194
- it { is_expected.to have_fields(:birthdate, :registered_at).of_type(DateTime) }
195
-
196
- # if you're declaring 'include Mongoid::Timestamps'
197
- # or any of 'include Mongoid::Timestamps::Created' and 'Mongoid::Timestamps::Updated'
198
- it { is_expected.to be_timestamped_document }
199
- it { is_expected.to be_timestamped_document.with(:created) }
200
- it { is_expected.not_to be_timestamped_document.with(:updated) }
201
-
202
- it { is_expected.to be_versioned_document } # if you're declaring `include Mongoid::Versioning`
203
- it { is_expected.to be_paranoid_document } # if you're declaring `include Mongoid::Paranoia`
204
- it { is_expected.to be_multiparameted_document } # if you're declaring `include Mongoid::MultiParameterAttributes`
205
- end
206
-
207
- RSpec.describe Log do
208
- it { is_expected.to be_stored_in :logs }
209
- it { is_expected.to be_dynamic_document }
334
+ it { is_expected.to accept_nested_attributes_for(:articles) }
335
+ it { is_expected.to accept_nested_attributes_for(:comments) }
210
336
  end
211
337
 
212
338
  RSpec.describe Article do
213
- it { is_expected.to have_field(:published).of_type(Boolean).with_default_value_of(false) }
214
- it { is_expected.to have_field(:allow_comments).of_type(Boolean).with_default_value_of(true) }
215
- it { is_expected.not_to have_field(:allow_comments).of_type(Boolean).with_default_value_of(false) }
216
- it { is_expected.not_to have_field(:number_of_comments).of_type(Integer).with_default_value_of(1) }
339
+ it { is_expected.to accept_nested_attributes_for(:permalink) }
217
340
  end
218
341
  ```
219
342
 
220
- ## Known issues
221
-
222
- accept_nested_attributes_for matcher must test options [issue 91](https://github.com/mongoid-rspec/mongoid-rspec/issues/91).
223
-
224
- ## Acknowledgement
225
-
226
- Thanks to [Durran Jordan][durran] for providing the changes necessary to make
227
- this compatible with mongoid 2.0.0.rc, and for other [contributors](https://github.com/mongoid-rspec/mongoid-rspec/contributors)
228
- to this project.
229
-
230
- [mongoid-rspec]: https://github.com/mongoid-rspec/mongoid-rspec "A collection of RSpec-compatible matchers that help to test Mongoid documents."
343
+ ## Contributing
231
344
 
232
- [durran]: https://github.com/durran
233
- [mongoid2]: https://rubygems.org/gems/mongoid-rspec/versions/1.4.5
234
- [mongoid3]: https://rubygems.org/gems/mongoid-rspec/versions/1.13.0
235
- [mongoid4]: https://rubygems.org/gems/mongoid-rspec/versions/2.1.0
236
- [mongoid5]: https://rubygems.org/gems/mongoid-rspec/versions/3.0.0
345
+ You're encouraged to contribute to this library. See [CONTRIBUTING](CONTRIBUTING.md) for details.
237
346
 
238
- [travis_badge]: http://img.shields.io/travis/mongoid-rspec/mongoid-rspec.svg?style=flat
239
- [travis]: https://travis-ci.org/mongoid-rspec/mongoid-rspec
347
+ ## Copyright and License
240
348
 
241
- [rubygems_badge]: http://img.shields.io/gem/v/mongoid-rspec.svg?style=flat
242
- [rubygems]: http://rubygems.org/gems/mongoid-rspec
349
+ Copyright (c) 2009-2018 Evan Sagge and Contributors.
243
350
 
244
- [codeclimate_badge]: http://img.shields.io/codeclimate/github/mongoid-rspec/mongoid-rspec.svg?style=flat
245
- [codeclimate]: https://codeclimate.com/github/mongoid-rspec/mongoid-rspec
351
+ MIT License. See [LICENSE](LICENSE) for details.
data/Rakefile CHANGED
@@ -1,17 +1,20 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  require 'bundler'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
6
  require 'rspec/core/rake_task'
7
7
 
8
- task :default => :spec
9
-
10
8
  RSpec::Core::RakeTask.new(:spec) do |spec|
11
- spec.pattern = "./spec/**/*_spec.rb"
9
+ spec.pattern = './spec/**/*_spec.rb'
12
10
  end
13
11
 
14
12
  RSpec::Core::RakeTask.new(:rcov) do |spec|
15
- spec.pattern = "./spec/**/*_spec.rb"
13
+ spec.pattern = './spec/**/*_spec.rb'
16
14
  spec.rcov = true
17
15
  end
16
+
17
+ require 'rubocop/rake_task'
18
+ RuboCop::RakeTask.new(:rubocop)
19
+
20
+ task default: %i[rubocop spec]
@@ -1,6 +1,5 @@
1
1
  module Mongoid
2
2
  module Matchers # :nodoc:
3
-
4
3
  # Ensures that the model can accept nested attributes for the specified
5
4
  # association.
6
5
  #
@@ -12,7 +11,6 @@ module Mongoid
12
11
  end
13
12
 
14
13
  class AcceptNestedAttributesForMatcher
15
-
16
14
  def initialize(attribute)
17
15
  @attribute = attribute.to_s
18
16
  @options = {}
@@ -31,37 +29,38 @@ module Mongoid
31
29
  "Did not expect #{expectation}"
32
30
  end
33
31
 
34
- alias :failure_message_when_negated :negative_failure_message
32
+ alias failure_message_when_negated negative_failure_message
35
33
 
36
34
  def description
37
35
  description = "accepts_nested_attributes_for :#{@attribute}"
38
36
  end
39
37
 
40
38
  protected
41
- def match?
42
- exists?
43
- end
44
39
 
45
- def exists?
46
- if config
47
- true
48
- else
49
- @problem = 'is not declared'
50
- false
51
- end
52
- end
40
+ def match?
41
+ exists?
42
+ end
53
43
 
54
- def config
55
- model_class.nested_attributes["#{@attribute}_attributes"]
44
+ def exists?
45
+ if config
46
+ true
47
+ else
48
+ @problem = 'is not declared'
49
+ false
56
50
  end
51
+ end
57
52
 
58
- def model_class
59
- @subject.class
60
- end
53
+ def config
54
+ model_class.nested_attributes["#{@attribute}_attributes"]
55
+ end
61
56
 
62
- def expectation
63
- "#{model_class.name} to accept nested attributes for #{@attribute}"
64
- end
57
+ def model_class
58
+ @subject.class
59
+ end
60
+
61
+ def expectation
62
+ "#{model_class.name} to accept nested attributes for #{@attribute}"
63
+ end
65
64
  end
66
65
  end
67
- end
66
+ end