Sha256: ec8f4d6161d6547c11c8240c8d9a5df0923957f7205f91793f11ff024bcf7e65

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require_relative '../../../test_helper'

describe OdeonUk::Html::Screenings do
  include WebsiteFixturesHelper

  let(:described_class) { OdeonUk::Html::Screenings }

  let(:website) { Minitest::Mock.new }

  before { WebMock.disable_net_connect! }

  describe '.at(cinema_id)' do
    subject { described_class.at(71) }

    before do
      website.expect(:showtimes, showtimes_html(71), [71])
    end

    it 'returns an array of screening attributes as hashes' do
      OdeonUk::Html::Website.stub :new, website do
        subject.must_be_instance_of(Array)
        subject.each do |screening|
          screening.must_be_instance_of(Hash)
          screening.keys.must_include(:film_name)

          screening.keys.must_include(:time)
          screening[:time].must_be_instance_of(Time)

          screening.keys.must_include(:variant)

          screening.keys.must_include(:dimension)
          screening[:dimension].must_match(/[23]d/)
        end
      end
    end

    it 'returns correct number of screenings' do
      OdeonUk::Html::Website.stub :new, website do
        subject.count.must_equal 212
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
odeon_uk-3.0.0 test/lib/odeon_uk/html/screenings_test.rb