Sha256: 6c685ec4df66afc43895b3a3d0cd82006d6e22dc069a8020ecb6a1e4a5d75058

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

require 'rspec/mocks'

module Doubles
  extend RSpec::Mocks::ExampleMethods
  extend self

  def bucket
    instance_double(Pageflow::Panorama::S3Bucket).as_null_object
  end

  def bucket_raising_once(error)
    bucket.tap do |bucket|
      called = false

      allow(bucket).to receive(:write) do
        unless called
          called = true
          raise error
        end
      end
    end
  end

  def bucket_raising(error)
    bucket.tap do |bucket|
      allow(bucket).to receive(:write).and_raise(error)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pageflow-panorama-2.4.0 spec/support/helpers/doubles.rb