Sha256: 1270ff586cab0a7f630f05fe62256fbdde00da8b7242b2c718014c0776ec16ae

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

module WebsiteFixturesHelper
  private

  def cinema_html(id)
    read_fixture("html/cinema/#{id}")
  end

  def showtimes_html(id, i = nil)
    read_fixture("html/showtimes/#{id}#{ "-#{i}" if i }")
  end

  def sitemap_html
    read_fixture('html/sitemap')
  end

  def read_fixture(filepath)
    File.read(File.expand_path("../../fixtures/#{filepath}.html", __FILE__))
  end

  def stub_get_with_500(site_path)
    url      = "http://www.odeon.co.uk/#{site_path}"
    stub_request(:get, url).to_return(status: [500, 'Internal Server Error'])
  end

  def stub_get(site_path, response_body)
    url      = "http://www.odeon.co.uk/#{site_path}"
    response = { status: 200, body: response_body, headers: {} }
    stub_request(:get, url).to_return(response)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
odeon_uk-3.0.6 test/support/website_fixtures_helper.rb