Skip to content

Commit f130b45

Browse files
authored
MONGOID-3999 add failing test (#5214)
1 parent e08fff0 commit f130b45

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/integration/associations/has_one_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,18 @@
255255
end
256256
end
257257
end
258+
259+
context "when overwriting an association" do
260+
let(:post1) { HomPost.create!(title: "post 1") }
261+
let(:post2) { HomPost.create!(title: "post 2") }
262+
let(:comment) { HomComment.create(post: post1) }
263+
264+
it "does not overwrite the original value" do
265+
pending "MONGOID-3999"
266+
p1 = comment.post
267+
expect(p1.title).to eq("post 1")
268+
comment.post = post2
269+
expect(p1.title).to eq("post 1")
270+
end
271+
end
258272
end

0 commit comments

Comments
 (0)