Sha256: b9273d05ee5d9d4a7b2f3bce548e9f88d4238b121f5c7c52aed93231949ade1d

Contents?: true

Size: 442 Bytes

Versions: 9

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

module RepositoryStubber
  def stub_repository(repository:, expected_output:, response: :success, params: nil)
    monads      = response.to_s.eql?('success') ? Dry::Monads::Success(expected_output) : Dry::Monads::Failure(expected_output)
    expectation = allow(repository).to receive(:new)
    expectation.with(params) if params
    expectation.and_return(instance_double(repository, call: monads))
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rider-kick-0.0.10 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.9 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.8 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.7 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.6 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.5 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.4 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.3 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb
rider-kick-0.0.2 lib/generators/rider_kick/templates/spec/support/repository_stubber.rb