Sha256: cfcefc8e325198e0e731cb457dfcd6bb1bedab311d6e5f90dd359d1964f19304

Contents?: true

Size: 511 Bytes

Versions: 6

Compression:

Stored size: 511 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-panorama-2.3.0 spec/support/helpers/doubles.rb
pageflow-panorama-2.2.0 spec/support/helpers/doubles.rb
pageflow-panorama-2.1.0 spec/support/helpers/doubles.rb
pageflow-panorama-2.0.0 spec/support/helpers/doubles.rb
pageflow-panorama-1.0.1 spec/support/helpers/doubles.rb
pageflow-panorama-1.0.0 spec/support/helpers/doubles.rb