mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
This implicit delegation makes it impossible to know which code is used and which code is dead. The refund method is very rarely used though. So we'll need to wait for a while.
28 lines
698 B
Ruby
28 lines
698 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Spree::Gateway do
|
|
let(:test_gateway) do
|
|
Class.new(Spree::Gateway) do
|
|
def provider_class
|
|
Class.new do
|
|
def initialize(*); end
|
|
|
|
def imaginary_method; end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
it "passes through all arguments on a method_missing call" do
|
|
expect(Rails.env).to receive(:local?).and_return(false)
|
|
gateway = test_gateway.new
|
|
expect(gateway.provider).to receive(:imaginary_method).with('foo')
|
|
gateway.imaginary_method('foo')
|
|
end
|
|
|
|
it "raises an error in test env" do
|
|
gateway = test_gateway.new
|
|
expect { gateway.imaginary_method('foo') }.to raise_error StandardError
|
|
end
|
|
end
|