Files
openfoodnetwork/spec/models/spree/gateway_spec.rb
Maikel Linke 162c58ac39 Check which methods we need to delegate
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.
2026-02-04 12:24:50 +11:00

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