Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b660d6a

Browse files
committed
[STORE] Fixed tests for the updates to the update method for Persistence::Model
This fixes 50fee81 Related: #289
1 parent 50fee81 commit b660d6a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

‎elasticsearch-persistence/test/unit/model_store_test.rb‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,6 @@ def valid?; false; end;
312312
end
313313

314314
should "not update an invalid model" do
315-
subject.expects(:persisted?).returns(true)
316-
subject.expects(:id).returns('abc123').at_least_once
317-
318315
@gateway
319316
.expects(:update)
320317
.never
@@ -323,19 +320,19 @@ def valid?; false; end;
323320
def valid?; false; end;
324321
end
325322

326-
assert ! subject.update
327-
assert ! subject.persisted?
323+
assert ! subject.update(title: 'INVALID')
328324
end
329325

330326
should "skip the validation with the :validate option" do
331-
subject.expects(:persisted?).returns(true)
327+
subject.expects(:persisted?).returns(true).at_least_once
332328
subject.expects(:id).returns('abc123').at_least_once
333329

334330
@gateway
335331
.expects(:update)
336332
.with do |object, options|
337-
assert_equal subject, object
333+
assert_equal 'abc123', object
338334
assert_equal nil, options[:id]
335+
assert_equal 'INVALID', options[:doc][:title]
339336
true
340337
end
341338
.returns({'_id' => 'abc123'})
@@ -344,7 +341,7 @@ def valid?; false; end;
344341
def valid?; false; end;
345342
end
346343

347-
assert subject.updatevalidate: false
344+
assert subject.update({title: 'INVALID'},{validate: false})
348345
assert subject.persisted?
349346
end
350347

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /