Skip to content

Commit

Permalink
Add Rspecs
Browse files Browse the repository at this point in the history
  • Loading branch information
arturantonnikau committed Mar 21, 2024
1 parent 2141a59 commit c6f32d1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/mongoid/paranoia_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,27 @@ class ParanoidConfiguredReset
expect(post).not_to be_destroyed
end
end

context "when multiple operations wrapped inside transaction" do

let(:post) do
ParanoidPost.create(title: "test")
end

before do
post.with_session do |session|
session.with_transaction(write_concern: {w: :majority}) do
post.set(title: "test_new")
post.destroy
end
end
end

it "should perform operations correct and commit result" do
expect(post.title).to eq("test_new")
expect(post).to be_destroyed
end
end
end

describe "#destroyed?" do
Expand Down

0 comments on commit c6f32d1

Please sign in to comment.