Sha256: 464e477ed4fa829510362c1cb28036f051f1a4301c2616821e0ad4d2e0050720
Contents?: true
Size: 967 Bytes
Versions: 1
Compression:
Stored size: 967 Bytes
Contents
module SolidusEasypost module TestHelpers module ApiStubs def stub_easypost_shipment EasyPost::Shipment.class_eval do def rates; end def tracking_code; end end easypost_shipment = instance_spy( EasyPost::Shipment, id: SecureRandom.hex, tracking_code: SecureRandom.hex, rates: Array.new(3) { stub_easypost_rate }, ) allow(EasyPost::Shipment).to receive(:retrieve) .with(easypost_shipment.id) .and_return(easypost_shipment) easypost_shipment end def stub_easypost_rate easypost_rate = instance_spy(EasyPost::Rate, id: SecureRandom.hex) allow(EasyPost::Shipment).to receive(:retrieve) .with(easypost_rate.id) .and_return(easypost_rate) easypost_rate end end end end RSpec.configure do |config| config.include SolidusEasypost::TestHelpers::ApiStubs end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_easypost-3.0.0 | spec/support/helpers/api_stubs.rb |