Fix payment log entries specs

The tight coupling between doesn't give other option but to check the
private method is called. The specs successfully stub
`log_entries#create` but for some reason the model instance that gets
evaluated it's not the stubbed one.
This commit is contained in:
Pau Perez
2020-06-26 13:06:35 +02:00
parent a01f601363
commit 0ad8dcc2c5

View File

@@ -37,7 +37,7 @@ describe Spree::Payment do
before(:each) do
# So it doesn't create log entries every time a processing method is called
allow(payment.log_entries).to receive(:create)
allow(payment).to receive(:record_response)
end
context 'validations' do
@@ -126,8 +126,8 @@ describe Spree::Payment do
end
it "should log the response" do
expect(payment.log_entries).to receive(:create).with(:details => anything)
payment.authorize!
expect(payment).to have_received(:record_response)
end
context "when gateway does not match the environment" do
@@ -177,8 +177,8 @@ describe Spree::Payment do
end
it "should log the response" do
payment.log_entries.should_receive(:create).with(:details => anything)
payment.purchase!
expect(payment).to have_received(:record_response)
end
context "when gateway does not match the environment" do
@@ -292,8 +292,8 @@ describe Spree::Payment do
end
it "should log the response" do
payment.log_entries.should_receive(:create).with(:details => anything)
payment.void_transaction!
expect(payment).to have_received(:record_response)
end
context "when gateway does not match the environment" do
@@ -374,8 +374,8 @@ describe Spree::Payment do
end
it "should log the response" do
payment.log_entries.should_receive(:create).with(:details => anything)
payment.credit!
expect(payment).to have_received(:record_response)
end
context "when gateway does not match the environment" do