spec/boltless/extensions/transactions_spec.rb in boltless-1.3.0 vs spec/boltless/extensions/transactions_spec.rb in boltless-1.4.0

- old
+ new

@@ -64,11 +64,11 @@ before { create_users } it 'returns the user names' do expect(action.pluck(:name)).to \ - match_array(%w[Bernd Klaus Uwe Monika]) + contain_exactly('Bernd', 'Klaus', 'Uwe', 'Monika') end it 'returns a Boltless::Result' do expect(action).to be_a(Boltless::Result) end @@ -149,11 +149,11 @@ end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with multiple statements' do let(:statements) do @@ -164,15 +164,15 @@ count_users_statement ] end it 'returns 4 results (one for each statement)' do - expect(action.count).to be_eql(4) + expect(action.count).to be(4) end it 'returns the correct created user count' do - expect(action.last.value).to be_eql(3) + expect(action.last.value).to be(3) end end end describe '.one_shot' do @@ -197,11 +197,11 @@ end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with multiple statements' do let(:statements) do @@ -212,15 +212,15 @@ count_users_statement ] end it 'returns 4 results (one for each statement)' do - expect(action.count).to be_eql(4) + expect(action.count).to be(4) end it 'returns the correct created user count' do - expect(action.last.value).to be_eql(3) + expect(action.last.value).to be(3) end end end describe '.transaction!' do @@ -245,11 +245,11 @@ it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement expect(described_class.execute!(cypher, **args).value).to \ - be_eql(0) + be(0) end end context 'with manual rollback (without raised errors)' do let(:user_block) do @@ -259,17 +259,17 @@ tx.rollback! end end it 'returns true' do - expect(action).to be_eql(true) + expect(action).to be(true) end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with manual commit (without raised errors)' do let(:user_block) do @@ -279,31 +279,31 @@ tx.commit! end end it 'returns an empty array (due to no finalization statements given)' do - expect(action).to match_array([]) + expect(action).to be_empty end it 'completed the transaction (data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(1) + expect(described_class.execute!(cypher, **args).value).to be(1) end end context 'with intermediate results' do # rubocop:disable RSpec/MultipleExpectations because of the # in-block testing # rubocop:disable RSpec/ExampleLength dito it 'allows direct access to each result' do Boltless.transaction! do |tx| cypher, args = fetch_date_statement - expect(tx.run!(cypher, **args).value).to be_eql(Date.today.to_s) + expect(tx.run!(cypher, **args).value).to eql(Date.today.to_s) cypher, args = fetch_static_number_statement - expect(tx.run!(cypher, **args).value).to be_eql(9867) + expect(tx.run!(cypher, **args).value).to be(9867) end end # rubocop:enable RSpec/MultipleExpectations # rubocop:enable RSpec/ExampleLength end @@ -328,11 +328,11 @@ end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with an error in between (raised)' do let(:user_block) do @@ -352,11 +352,11 @@ end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with manual rollback (without raised errors)' do let(:user_block) do @@ -366,17 +366,17 @@ tx.rollback end end it 'returns true' do - expect(action).to be_eql(true) + expect(action).to be(true) end it 'rolls back the transaction (no data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(0) + expect(described_class.execute!(cypher, **args).value).to be(0) end end context 'with manual commit (without raised errors)' do let(:user_block) do @@ -386,30 +386,30 @@ tx.commit end end it 'returns an empty array (due to no finalization statements given)' do - expect(action).to match_array([]) + expect(action).to be_empty end it 'completed the transaction (data is written)' do suppress(StandardError) { action } cypher, args = count_users_statement - expect(described_class.execute!(cypher, **args).value).to be_eql(1) + expect(described_class.execute!(cypher, **args).value).to be(1) end end context 'with intermediate results' do # rubocop:disable RSpec/MultipleExpectations because of the # in-block testing # rubocop:disable RSpec/ExampleLength dito it 'allows direct access to each result' do Boltless.transaction do |tx| cypher, args = fetch_date_statement - expect(tx.run(cypher, **args).value).to be_eql(Date.today.to_s) + expect(tx.run(cypher, **args).value).to eql(Date.today.to_s) cypher, args = fetch_static_number_statement - expect(tx.run(cypher, **args).value).to be_eql(9867) + expect(tx.run(cypher, **args).value).to be(9867) end end # rubocop:enable RSpec/MultipleExpectations # rubocop:enable RSpec/ExampleLength end