Sha256: 88450c832d87a9300de84adf85a1ea5e80708d1b2deac946505acc540fc312c5

Contents?: true

Size: 491 Bytes

Versions: 2

Compression:

Stored size: 491 Bytes

Contents

module SlackStubFactory
  def stub_slack_request(method, path, fixtures)
    fixtures = [fixtures].flatten

    full_path = "https://slack.com/api/#{path}"

    stub = stub_request(method, full_path)
    begin
      fixture = fixtures.shift
      stub.to_return(status: 200, body: slack_json_fixture(fixture))
    end while !fixtures.empty?

    stub
  end

  def slack_json_fixture(fixture)
    File.read(File.join('spec', 'support', 'fixtures', fixture)).strip.gsub(/\n\s*/, "")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
laziness-0.2.6 spec/support/slack_stub_factory.rb
laziness-0.2.5 spec/support/slack_stub_factory.rb