spec/boltless/transaction_spec.rb in boltless-1.3.0 vs spec/boltless/transaction_spec.rb in boltless-1.4.0
- old
+ new
@@ -39,11 +39,11 @@
tx.commit!
end
it 'rolls back the transaction on errors' do
failed_action
- expect(check_action.count).to be_eql(0)
+ expect(check_action.count).to be(0)
end
it 'returns a mapped result' do
expect(check_action).to be_a(Boltless::Result)
end
@@ -67,11 +67,11 @@
end
end
describe 'delegations' do
it 'allows to access the #build_cypher utility' do
- expect(instance.respond_to?(:build_cypher)).to be_eql(true)
+ expect(instance.respond_to?(:build_cypher)).to be(true)
end
end
describe '#initialize' do
it 'passes down the connection to the request' do
@@ -112,27 +112,27 @@
describe '#access_mode' do
let(:action) { instance.access_mode }
context 'when not explictly configured' do
it 'returns write' do
- expect(action).to be_eql(:write)
+ expect(action).to be(:write)
end
end
context 'when initialized with read' do
let(:instance) { new_instance[access_mode: :read] }
it 'returns read' do
- expect(action).to be_eql(:read)
+ expect(action).to be(:read)
end
end
context 'when initialized with write' do
let(:instance) { new_instance[access_mode: :write] }
it 'returns write' do
- expect(action).to be_eql(:write)
+ expect(action).to be(:write)
end
end
end
describe '#id' do
@@ -160,11 +160,11 @@
expect(action).to be_a(Symbol)
end
describe 'after initialization' do
it 'returns not_yet_started' do
- expect(action).to be_eql(:not_yet_started)
+ expect(action).to be(:not_yet_started)
end
end
end
describe '#state' do
@@ -174,11 +174,11 @@
expect(action).to be_a(ActiveSupport::StringInquirer)
end
describe 'after initialization' do
it 'returns not_yet_started' do
- expect(action).to be_eql('not_yet_started')
+ expect(action).to eql('not_yet_started')
end
end
end
describe '#begin!' do
@@ -201,11 +201,11 @@
expect(request).to receive(:begin_transaction).once
action
end
it 'returns true' do
- expect(action).to be_eql(true)
+ expect(action).to be(true)
end
it 'switches the state to open' do
expect { action }.to \
change(instance, :state).from('not_yet_started').to('open')
@@ -217,11 +217,11 @@
context 'when the transaction is not in a usable state' do
let(:raw_state) { :closed }
it 'returns false' do
- expect(action).to be_eql(false)
+ expect(action).to be(false)
end
end
it 'wraps the bang-variant in a #handle_errors call' do
expect(instance).to receive(:handle_errors).with(false)
@@ -230,19 +230,19 @@
context 'with errors' do
before { allow(instance).to receive(:begin!, &res_err) }
it 'returns false' do
- expect(action).to be_eql(false)
+ expect(action).to be(false)
end
end
context 'without errors' do
before { allow(request).to receive(:begin_transaction) }
it 'returns true' do
- expect(action).to be_eql(true)
+ expect(action).to be(true)
end
it 'switches the state to open' do
expect { action }.to \
change(instance, :state).from('not_yet_started').to('open')
@@ -272,11 +272,11 @@
action
end
it 'returns the result' do
res = instance.run!('RETURN date() AS date')
- expect(res.value).to be_eql(Date.today.to_s)
+ expect(res.value).to eql(Date.today.to_s)
end
end
end
describe '#run' do
@@ -285,11 +285,11 @@
context 'when the transaction is not in a usable state' do
let(:raw_state) { :closed }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
it 'wraps the bang-variant in a #handle_errors call' do
expect(instance).to receive(:handle_errors)
@@ -298,19 +298,19 @@
context 'with errors' do
before { allow(instance).to receive(:run!, &res_err) }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
context 'without errors' do
before { allow(request).to receive(:run_query).and_return([123]) }
it 'returns an the first result' do
- expect(action).to be_eql(123)
+ expect(action).to be(123)
end
end
end
describe '#run_in_batch!' do
@@ -346,19 +346,19 @@
expect(request).to receive(:run_query).with(instance.id, *statements)
action
end
it 'returns two results (one for each statement)' do
- expect(action.count).to be_eql(2)
+ expect(action.count).to be(2)
end
it 'returns the correct result (first statement)' do
- expect(action.first.value).to be_eql(1)
+ expect(action.first.value).to be(1)
end
it 'returns the correct result (second statement)' do
- expect(action.last.value).to be_eql(Date.today.to_s)
+ expect(action.last.value).to eql(Date.today.to_s)
end
end
end
describe '#run_in_batch' do
@@ -367,11 +367,11 @@
context 'when the transaction is not in a usable state' do
let(:raw_state) { :closed }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
it 'wraps the bang-variant in a #handle_errors call' do
expect(instance).to receive(:handle_errors)
@@ -380,19 +380,19 @@
context 'with errors' do
before { allow(instance).to receive(:run_in_batch!, &res_err) }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
context 'without errors' do
before { allow(request).to receive(:run_query).and_return([]) }
it 'returns an empty array' do
- expect(action).to match_array([])
+ expect(action).to be_empty
end
end
end
describe '#commit!' do
@@ -417,11 +417,11 @@
action
end
it 'allows to send finalizing statements' do
res = instance.commit!(['RETURN date() AS date'])
- expect(res.first.value).to be_eql(Date.today.to_s)
+ expect(res.first.value).to eql(Date.today.to_s)
end
it 'switches the state to closed' do
expect { action }.to \
change(instance, :state).from('open').to('closed')
@@ -435,11 +435,11 @@
context 'when the transaction is not in a usable state' do
let(:raw_state) { :closed }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
it 'wraps the bang-variant in a #handle_errors call' do
expect(instance).to receive(:handle_errors)
@@ -448,19 +448,19 @@
context 'with errors' do
before { allow(instance).to receive(:commit!, &res_err) }
it 'returns nil' do
- expect(action).to be_eql(nil)
+ expect(action).to be_nil
end
end
context 'without errors' do
before { allow(request).to receive(:commit_transaction).and_return([]) }
it 'returns an empty array' do
- expect(action).to match_array([])
+ expect(action).to be_empty
end
it 'switches the state to closed' do
expect { action }.to \
change(instance, :state).from('open').to('closed')
@@ -489,11 +489,11 @@
expect(request).to receive(:rollback_transaction).with(instance.id)
action
end
it 'returns true' do
- expect(action).to be_eql(true)
+ expect(action).to be(true)
end
it 'switches the state to closed' do
expect { action }.to \
change(instance, :state).from('open').to('closed')
@@ -507,11 +507,11 @@
context 'when the transaction is not in a usable state' do
let(:raw_state) { :closed }
it 'returns false' do
- expect(action).to be_eql(false)
+ expect(action).to be(false)
end
end
it 'wraps the bang-variant in a #handle_errors call' do
expect(instance).to receive(:handle_errors).with(false)
@@ -520,19 +520,19 @@
context 'with errors' do
before { allow(instance).to receive(:rollback!, &res_err) }
it 'returns false' do
- expect(action).to be_eql(false)
+ expect(action).to be(false)
end
end
context 'without errors' do
before { allow(request).to receive(:rollback_transaction) }
it 'returns true' do
- expect(action).to be_eql(true)
+ expect(action).to be(true)
end
it 'switches the state to closed' do
expect { action }.to \
change(instance, :state).from('open').to('closed')
@@ -559,19 +559,19 @@
expect { action.call { raise ArgumentError } }.to \
raise_error(ArgumentError)
end
it 'returns the given error result in case of errors (non-proc)' do
- expect(action.call(true, &res_err)).to be_eql(true)
+ expect(action.call(true, &res_err)).to be(true)
end
it 'returns the given error result in case of errors (proc)' do
err_res = ->(e) { "Err: #{e.message}" }
- expect(action.call(err_res, &res_err)).to be_eql('Err: test')
+ expect(action.call(err_res, &res_err)).to eql('Err: test')
end
it 'returns the result of the user given block when no errors occur' do
- expect(action.call { 123 }).to be_eql(123)
+ expect(action.call { 123 }).to be(123)
end
it 'switches the state to closed on errors' do
expect { action.call(&res_err) }.to \
change(instance, :state).from('not_yet_started').to('closed')