Skip to content

Commit 783cd1a

Browse files
committed
[STORE] Added an integration test for creating/saving models with custom IDs
1 parent 35aa57a commit 783cd1a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: elasticsearch-persistence/test/integration/model/model_basic_test.rb

+17
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ class ::Person
3030
Person.gateway.create_index! force: true
3131
end
3232

33+
should "save the object with custom ID" do
34+
person = Person.new id: 1, name: 'Number One'
35+
person.save
36+
37+
document = Person.find(1)
38+
assert_not_nil document
39+
assert_equal 'Number One', document.name
40+
end
41+
42+
should "create the object with custom ID" do
43+
person = Person.create id: 1, name: 'Number One'
44+
45+
document = Person.find(1)
46+
assert_not_nil document
47+
assert_equal 'Number One', document.name
48+
end
49+
3350
should "save and find the object" do
3451
person = Person.new name: 'John Smith', birthday: Date.parse('1970-01-01')
3552
person.save

0 commit comments

Comments
 (0)