granite-form 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -2
- data/.github/workflows/{ci.yml → ruby.yml} +22 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +3 -3
- data/Appraisals +1 -2
- data/CHANGELOG.md +15 -0
- data/README.md +6 -15
- data/docker-compose.yml +14 -0
- data/gemfiles/rails.5.0.gemfile +0 -1
- data/gemfiles/rails.5.1.gemfile +0 -1
- data/gemfiles/rails.5.2.gemfile +0 -1
- data/granite-form.gemspec +15 -15
- data/lib/granite/form/active_record/associations.rb +1 -1
- data/lib/granite/form/base.rb +1 -2
- data/lib/granite/form/errors.rb +0 -15
- data/lib/granite/form/model/associations/base.rb +0 -4
- data/lib/granite/form/model/associations/collection/embedded.rb +2 -1
- data/lib/granite/form/model/associations/collection/proxy.rb +1 -1
- data/lib/granite/form/model/associations/embeds_any.rb +7 -0
- data/lib/granite/form/model/associations/embeds_many.rb +9 -58
- data/lib/granite/form/model/associations/embeds_one.rb +7 -36
- data/lib/granite/form/model/associations/nested_attributes.rb +7 -7
- data/lib/granite/form/model/associations/persistence_adapters/active_record.rb +0 -4
- data/lib/granite/form/model/associations/persistence_adapters/base.rb +0 -4
- data/lib/granite/form/model/associations/references_many.rb +0 -32
- data/lib/granite/form/model/associations/references_one.rb +0 -28
- data/lib/granite/form/model/associations/reflections/embeds_any.rb +1 -1
- data/lib/granite/form/model/associations/reflections/embeds_many.rb +1 -1
- data/lib/granite/form/model/associations/reflections/embeds_one.rb +11 -1
- data/lib/granite/form/model/associations/reflections/references_any.rb +0 -4
- data/lib/granite/form/model/associations/reflections/singular.rb +0 -22
- data/lib/granite/form/model/associations.rb +0 -6
- data/lib/granite/form/model/attributes/attribute.rb +3 -21
- data/lib/granite/form/model/attributes/base.rb +5 -23
- data/lib/granite/form/model/attributes/reference_many.rb +1 -1
- data/lib/granite/form/model/attributes/reference_one.rb +1 -1
- data/lib/granite/form/model/attributes/reflections/attribute.rb +2 -8
- data/lib/granite/form/model/attributes/reflections/base/build_type_definition.rb +38 -0
- data/lib/granite/form/model/attributes/reflections/base.rb +20 -17
- data/lib/granite/form/model/attributes/reflections/collection/build_type_definition.rb +19 -0
- data/lib/granite/form/model/attributes/reflections/dictionary/build_type_definition.rb +19 -0
- data/lib/granite/form/model/attributes/reflections/dictionary.rb +0 -3
- data/lib/granite/form/model/attributes/reflections/reference_one.rb +0 -6
- data/lib/granite/form/model/attributes/reflections/represents/build_type_definition.rb +73 -0
- data/lib/granite/form/model/attributes/reflections/represents.rb +10 -2
- data/lib/granite/form/model/attributes/represents.rb +22 -37
- data/lib/granite/form/model/attributes.rb +10 -2
- data/lib/granite/form/model/persistence.rb +1 -19
- data/lib/granite/form/model/representation.rb +1 -0
- data/lib/granite/form/model/validations.rb +6 -0
- data/lib/granite/form/model.rb +1 -3
- data/lib/granite/form/types/active_support/time_zone.rb +2 -0
- data/lib/granite/form/types/array.rb +2 -0
- data/lib/granite/form/types/big_decimal.rb +2 -0
- data/lib/granite/form/types/boolean.rb +2 -0
- data/lib/granite/form/types/collection.rb +11 -0
- data/lib/granite/form/types/date.rb +2 -0
- data/lib/granite/form/types/date_time.rb +2 -0
- data/lib/granite/form/types/dictionary.rb +23 -0
- data/lib/granite/form/types/float.rb +2 -0
- data/lib/granite/form/types/has_subtype.rb +18 -0
- data/lib/granite/form/types/hash_with_action_controller_parameters.rb +2 -0
- data/lib/granite/form/types/integer.rb +2 -0
- data/lib/granite/form/types/object.rb +28 -0
- data/lib/granite/form/types/string.rb +2 -0
- data/lib/granite/form/types/time.rb +2 -0
- data/lib/granite/form/types/uuid.rb +2 -0
- data/lib/granite/form/types.rb +3 -0
- data/lib/granite/form/util.rb +55 -0
- data/lib/granite/form/version.rb +1 -1
- data/lib/granite/form.rb +1 -0
- data/spec/granite/form/active_record/associations_spec.rb +16 -18
- data/spec/granite/form/model/associations/embeds_many_spec.rb +29 -305
- data/spec/granite/form/model/associations/embeds_one_spec.rb +27 -212
- data/spec/granite/form/model/associations/nested_attributes_spec.rb +0 -95
- data/spec/granite/form/model/associations/references_many_spec.rb +5 -326
- data/spec/granite/form/model/associations/references_one_spec.rb +7 -279
- data/spec/granite/form/model/associations/reflections/embeds_any_spec.rb +1 -2
- data/spec/granite/form/model/associations/reflections/embeds_many_spec.rb +18 -26
- data/spec/granite/form/model/associations/reflections/embeds_one_spec.rb +16 -23
- data/spec/granite/form/model/associations/reflections/references_many_spec.rb +1 -1
- data/spec/granite/form/model/associations/reflections/references_one_spec.rb +1 -22
- data/spec/granite/form/model/associations/validations_spec.rb +0 -3
- data/spec/granite/form/model/associations_spec.rb +3 -24
- data/spec/granite/form/model/attributes/attribute_spec.rb +0 -29
- data/spec/granite/form/model/attributes/reflections/attribute_spec.rb +0 -9
- data/spec/granite/form/model/attributes/reflections/base/build_type_definition_spec.rb +27 -0
- data/spec/granite/form/model/attributes/reflections/base_spec.rb +16 -10
- data/spec/granite/form/model/attributes/reflections/collection/build_type_definition_spec.rb +24 -0
- data/spec/granite/form/model/attributes/reflections/dictionary/build_type_definition_spec.rb +24 -0
- data/spec/granite/form/model/attributes/reflections/dictionary_spec.rb +0 -6
- data/spec/granite/form/model/attributes/reflections/represents/build_type_definition_spec.rb +129 -0
- data/spec/granite/form/model/attributes/reflections/represents_spec.rb +43 -20
- data/spec/granite/form/model/attributes/represents_spec.rb +78 -55
- data/spec/granite/form/model/attributes_spec.rb +84 -23
- data/spec/granite/form/model/dirty_spec.rb +1 -7
- data/spec/granite/form/model/persistence_spec.rb +0 -2
- data/spec/granite/form/model/representation_spec.rb +4 -7
- data/spec/granite/form/model/validations/associated_spec.rb +2 -4
- data/spec/granite/form/model/validations/nested_spec.rb +2 -4
- data/spec/granite/form/model/validations_spec.rb +28 -1
- data/spec/granite/form/types/collection_spec.rb +22 -0
- data/spec/granite/form/types/dictionary_spec.rb +32 -0
- data/spec/granite/form/types/has_subtype_spec.rb +20 -0
- data/spec/granite/form/types/object_spec.rb +50 -4
- data/spec/granite/form/util_spec.rb +108 -0
- data/spec/spec_helper.rb +0 -15
- data/spec/support/active_record.rb +23 -0
- data/spec/support/shared/nested_attribute_examples.rb +3 -21
- metadata +56 -51
- data/.github/workflows/main.yml +0 -29
- data/gemfiles/rails.4.2.gemfile +0 -15
- data/lib/granite/form/model/attributes/collection.rb +0 -19
- data/lib/granite/form/model/attributes/dictionary.rb +0 -28
- data/lib/granite/form/model/attributes/localized.rb +0 -44
- data/lib/granite/form/model/attributes/reflections/localized.rb +0 -45
- data/lib/granite/form/model/callbacks.rb +0 -72
- data/lib/granite/form/model/lifecycle.rb +0 -309
- data/lib/granite/form/model/localization.rb +0 -26
- data/spec/granite/form/model/attributes/collection_spec.rb +0 -72
- data/spec/granite/form/model/attributes/dictionary_spec.rb +0 -100
- data/spec/granite/form/model/attributes/localized_spec.rb +0 -103
- data/spec/granite/form/model/attributes/reflections/localized_spec.rb +0 -37
- data/spec/granite/form/model/callbacks_spec.rb +0 -337
- data/spec/granite/form/model/lifecycle_spec.rb +0 -356
@@ -1,356 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Granite::Form::Model::Lifecycle do
|
4
|
-
context do
|
5
|
-
before do
|
6
|
-
stub_model(:user) do
|
7
|
-
include Granite::Form::Model::Lifecycle
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
subject { User.new }
|
12
|
-
|
13
|
-
%i[save create update destroy].each do |action|
|
14
|
-
specify { expect { subject.public_send "_#{action}_performer=", '' }.to raise_error NoMethodError }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'performer execution' do
|
18
|
-
let(:foo) { true }
|
19
|
-
|
20
|
-
specify { expect { subject.save { foo } }.to raise_error NameError }
|
21
|
-
specify { expect { subject.save { |_| attributes } }.to raise_error NameError }
|
22
|
-
specify { expect(subject.save { attributes }).to eq(true) }
|
23
|
-
specify { expect(subject.save { |_| foo }).to eq(true) }
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'save' do
|
27
|
-
specify { expect { subject.save }.to raise_error Granite::Form::UnsavableObject }
|
28
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::UnsavableObject }
|
29
|
-
|
30
|
-
specify { expect(subject.save { true }).to eq(true) }
|
31
|
-
specify { expect(subject.save! { true }).to eq(true) }
|
32
|
-
|
33
|
-
context 'instance performer' do
|
34
|
-
before { subject.define_save { false } }
|
35
|
-
|
36
|
-
specify { expect(subject.save).to eq(false) }
|
37
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'create performer' do
|
41
|
-
before { User.define_create { true } }
|
42
|
-
|
43
|
-
specify { expect(subject.save).to eq(true) }
|
44
|
-
specify { expect(subject.save!).to eq(true) }
|
45
|
-
|
46
|
-
context do
|
47
|
-
subject { User.create }
|
48
|
-
|
49
|
-
specify { expect { subject.save }.to raise_error Granite::Form::UnsavableObject }
|
50
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::UnsavableObject }
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'instance performer' do
|
54
|
-
before { subject.define_create { false } }
|
55
|
-
|
56
|
-
specify { expect(subject.save).to eq(false) }
|
57
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'update performer' do
|
62
|
-
before { User.define_update { true } }
|
63
|
-
|
64
|
-
specify { expect { subject.save }.to raise_error Granite::Form::UnsavableObject }
|
65
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::UnsavableObject }
|
66
|
-
|
67
|
-
context do
|
68
|
-
subject { User.new.tap { |u| u.save { true } } }
|
69
|
-
|
70
|
-
specify { expect(subject.save).to eq(true) }
|
71
|
-
specify { expect(subject.save!).to eq(true) }
|
72
|
-
|
73
|
-
context 'instance performer' do
|
74
|
-
before { subject.define_update { false } }
|
75
|
-
|
76
|
-
specify { expect(subject.save).to eq(false) }
|
77
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'performers execution' do
|
83
|
-
before do
|
84
|
-
stub_model(:user) do
|
85
|
-
include Granite::Form::Model::Lifecycle
|
86
|
-
|
87
|
-
attribute :actions, Array, default: []
|
88
|
-
|
89
|
-
def append(action)
|
90
|
-
self.actions = actions + [action]
|
91
|
-
end
|
92
|
-
|
93
|
-
define_create { append :create }
|
94
|
-
define_update { append :update }
|
95
|
-
define_destroy { append :destroy }
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
subject { User.new }
|
100
|
-
|
101
|
-
specify do
|
102
|
-
subject.destroy
|
103
|
-
subject.save
|
104
|
-
subject.save
|
105
|
-
subject.destroy
|
106
|
-
subject.destroy
|
107
|
-
subject.save
|
108
|
-
expect(subject.actions).to eq(%i[destroy create update destroy destroy create])
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'destroy' do
|
114
|
-
specify { expect { subject.destroy }.to raise_error Granite::Form::UndestroyableObject }
|
115
|
-
specify { expect { subject.destroy! }.to raise_error Granite::Form::UndestroyableObject }
|
116
|
-
|
117
|
-
specify { expect(subject.destroy { true }).to be_a User }
|
118
|
-
specify { expect(subject.destroy! { true }).to be_a User }
|
119
|
-
|
120
|
-
context 'instance performer' do
|
121
|
-
before { subject.define_save { false } }
|
122
|
-
|
123
|
-
specify { expect(subject.save).to eq(false) }
|
124
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
context do
|
130
|
-
before do
|
131
|
-
stub_class(:storage) do
|
132
|
-
def self.storage
|
133
|
-
@storage ||= {}
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
before do
|
139
|
-
stub_model(:user) do
|
140
|
-
include Granite::Form::Model::Lifecycle
|
141
|
-
delegate :generate_id, to: 'self.class'
|
142
|
-
|
143
|
-
attribute :id, Integer, &:generate_id
|
144
|
-
attribute :name, String
|
145
|
-
validates :id, :name, presence: true
|
146
|
-
|
147
|
-
def self.generate_id
|
148
|
-
@id = @id.to_i.next
|
149
|
-
end
|
150
|
-
|
151
|
-
define_save do
|
152
|
-
Storage.storage.merge!(id => attributes.symbolize_keys)
|
153
|
-
end
|
154
|
-
|
155
|
-
define_destroy do
|
156
|
-
Storage.storage.delete(id)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe '.create' do
|
162
|
-
subject { User.create(name: 'Jonny') }
|
163
|
-
|
164
|
-
it { is_expected.to be_a User }
|
165
|
-
it { is_expected.to be_valid }
|
166
|
-
it { is_expected.to be_persisted }
|
167
|
-
|
168
|
-
context 'invalid' do
|
169
|
-
subject { User.create }
|
170
|
-
|
171
|
-
it { is_expected.to be_a User }
|
172
|
-
it { is_expected.to be_invalid }
|
173
|
-
it { is_expected.not_to be_persisted }
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe '.create!' do
|
178
|
-
subject { User.create!(name: 'Jonny') }
|
179
|
-
|
180
|
-
it { is_expected.to be_a User }
|
181
|
-
it { is_expected.to be_valid }
|
182
|
-
it { is_expected.to be_persisted }
|
183
|
-
|
184
|
-
context 'invalid' do
|
185
|
-
subject { User.create! }
|
186
|
-
|
187
|
-
specify { expect { subject }.to raise_error Granite::Form::ValidationError }
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe '#update, #update!' do
|
192
|
-
subject { User.new }
|
193
|
-
|
194
|
-
specify { expect { subject.update(name: 'Jonny') }.to change { subject.persisted? }.from(false).to(true) }
|
195
|
-
specify { expect { subject.update!(name: 'Jonny') }.to change { subject.persisted? }.from(false).to(true) }
|
196
|
-
|
197
|
-
specify { expect { subject.update({}) }.not_to change { subject.persisted? } }
|
198
|
-
specify { expect { subject.update!({}) }.to raise_error Granite::Form::ValidationError }
|
199
|
-
|
200
|
-
specify do
|
201
|
-
expect { subject.update(name: 'Jonny') }
|
202
|
-
.to change { Storage.storage.keys }.from([]).to([subject.id])
|
203
|
-
end
|
204
|
-
specify do
|
205
|
-
expect { subject.update!(name: 'Jonny') }
|
206
|
-
.to change { Storage.storage.keys }.from([]).to([subject.id])
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
describe '#update_attributes, #update_attributes!' do
|
211
|
-
subject { User.new }
|
212
|
-
|
213
|
-
specify { expect { subject.update_attributes(name: 'Jonny') }.to change { subject.persisted? }.from(false).to(true) }
|
214
|
-
specify { expect { subject.update_attributes!(name: 'Jonny') }.to change { subject.persisted? }.from(false).to(true) }
|
215
|
-
|
216
|
-
specify { expect { subject.update_attributes({}) }.not_to change { subject.persisted? } }
|
217
|
-
specify { expect { subject.update_attributes!({}) }.to raise_error Granite::Form::ValidationError }
|
218
|
-
|
219
|
-
specify do
|
220
|
-
expect { subject.update_attributes(name: 'Jonny') }
|
221
|
-
.to change { Storage.storage.keys }.from([]).to([subject.id])
|
222
|
-
end
|
223
|
-
specify do
|
224
|
-
expect { subject.update_attributes!(name: 'Jonny') }
|
225
|
-
.to change { Storage.storage.keys }.from([]).to([subject.id])
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe '#save, #save!' do
|
230
|
-
context 'invalid' do
|
231
|
-
subject { User.new }
|
232
|
-
|
233
|
-
it { is_expected.to be_invalid }
|
234
|
-
it { is_expected.not_to be_persisted }
|
235
|
-
|
236
|
-
specify { expect(subject.save).to eq(false) }
|
237
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ValidationError }
|
238
|
-
|
239
|
-
specify { expect { subject.save }.not_to change { subject.persisted? } }
|
240
|
-
specify do
|
241
|
-
expect { muffle(Granite::Form::ValidationError) { subject.save! } }
|
242
|
-
.not_to change { subject.persisted? }
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
context 'create' do
|
247
|
-
subject { User.new(name: 'Jonny') }
|
248
|
-
|
249
|
-
it { is_expected.to be_valid }
|
250
|
-
it { is_expected.not_to be_persisted }
|
251
|
-
|
252
|
-
specify { expect(subject.save).to eq(true) }
|
253
|
-
specify { expect(subject.save!).to eq(true) }
|
254
|
-
|
255
|
-
specify { expect { subject.save }.to change { subject.persisted? }.from(false).to(true) }
|
256
|
-
specify { expect { subject.save! }.to change { subject.persisted? }.from(false).to(true) }
|
257
|
-
|
258
|
-
specify { expect { subject.save }.to change { Storage.storage.keys }.from([]).to([subject.id]) }
|
259
|
-
specify { expect { subject.save! }.to change { Storage.storage.keys }.from([]).to([subject.id]) }
|
260
|
-
|
261
|
-
context 'save failed' do
|
262
|
-
before { User.define_save { false } }
|
263
|
-
|
264
|
-
it { is_expected.not_to be_persisted }
|
265
|
-
|
266
|
-
specify { expect(subject.save).to eq(false) }
|
267
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
268
|
-
|
269
|
-
specify { expect { subject.save }.not_to change { subject.persisted? } }
|
270
|
-
specify do
|
271
|
-
expect { muffle(Granite::Form::ObjectNotSaved) { subject.save! } }
|
272
|
-
.not_to change { subject.persisted? }
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
context 'update' do
|
278
|
-
subject! { User.new(name: 'Jonny').tap(&:save).tap { |u| u.name = 'Jimmy' } }
|
279
|
-
|
280
|
-
it { is_expected.to be_valid }
|
281
|
-
it { is_expected.to be_persisted }
|
282
|
-
|
283
|
-
specify { expect(subject.save).to eq(true) }
|
284
|
-
specify { expect(subject.save!).to eq(true) }
|
285
|
-
|
286
|
-
specify { expect { subject.save }.not_to change { subject.persisted? } }
|
287
|
-
specify { expect { subject.save! }.not_to change { subject.persisted? } }
|
288
|
-
|
289
|
-
specify do
|
290
|
-
expect { subject.save }.to change { Storage.storage[subject.id] }
|
291
|
-
.from(hash_including(name: 'Jonny')).to(hash_including(name: 'Jimmy'))
|
292
|
-
end
|
293
|
-
specify do
|
294
|
-
expect { subject.save! }.to change { Storage.storage[subject.id] }
|
295
|
-
.from(hash_including(name: 'Jonny')).to(hash_including(name: 'Jimmy'))
|
296
|
-
end
|
297
|
-
|
298
|
-
context 'save failed' do
|
299
|
-
before { User.define_save { false } }
|
300
|
-
|
301
|
-
it { is_expected.to be_persisted }
|
302
|
-
|
303
|
-
specify { expect(subject.save).to eq(false) }
|
304
|
-
specify { expect { subject.save! }.to raise_error Granite::Form::ObjectNotSaved }
|
305
|
-
|
306
|
-
specify { expect { subject.save }.not_to change { subject.persisted? } }
|
307
|
-
specify do
|
308
|
-
expect { muffle(Granite::Form::ObjectNotSaved) { subject.save! } }
|
309
|
-
.not_to change { subject.persisted? }
|
310
|
-
end
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
describe '#destroy, #destroy!' do
|
316
|
-
subject { User.create(name: 'Jonny') }
|
317
|
-
|
318
|
-
it { is_expected.to be_valid }
|
319
|
-
it { is_expected.to be_persisted }
|
320
|
-
it { is_expected.not_to be_destroyed }
|
321
|
-
|
322
|
-
specify { expect(subject.destroy).to eq(subject) }
|
323
|
-
specify { expect(subject.destroy!).to eq(subject) }
|
324
|
-
|
325
|
-
specify { expect { subject.destroy }.to change { subject.persisted? }.from(true).to(false) }
|
326
|
-
specify { expect { subject.destroy! }.to change { subject.persisted? }.from(true).to(false) }
|
327
|
-
|
328
|
-
specify { expect { subject.destroy }.to change { subject.destroyed? }.from(false).to(true) }
|
329
|
-
specify { expect { subject.destroy! }.to change { subject.destroyed? }.from(false).to(true) }
|
330
|
-
|
331
|
-
specify { expect { subject.destroy }.to change { Storage.storage.keys }.from([subject.id]).to([]) }
|
332
|
-
specify { expect { subject.destroy! }.to change { Storage.storage.keys }.from([subject.id]).to([]) }
|
333
|
-
|
334
|
-
context 'save failed' do
|
335
|
-
before { User.define_destroy { false } }
|
336
|
-
|
337
|
-
it { is_expected.to be_persisted }
|
338
|
-
|
339
|
-
specify { expect(subject.destroy).to eq(subject) }
|
340
|
-
specify { expect { subject.destroy! }.to raise_error Granite::Form::ObjectNotDestroyed }
|
341
|
-
|
342
|
-
specify { expect { subject.destroy }.not_to change { subject.persisted? } }
|
343
|
-
specify do
|
344
|
-
expect { muffle(Granite::Form::ObjectNotDestroyed) { subject.destroy! } }
|
345
|
-
.not_to change { subject.persisted? }
|
346
|
-
end
|
347
|
-
|
348
|
-
specify { expect { subject.destroy }.not_to change { subject.destroyed? } }
|
349
|
-
specify do
|
350
|
-
expect { muffle(Granite::Form::ObjectNotDestroyed) { subject.destroy! } }
|
351
|
-
.not_to change { subject.destroyed? }
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
|
-
end
|
356
|
-
end
|