Sha256: 978de631c164325c22aadb569c582b8201a1d5d76643dac0d95495bcd308491d

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 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(:sitemap, sitemap_html)
      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

6 entries across 6 versions & 1 rubygems

Version Path
odeon_uk-3.0.6 test/lib/odeon_uk/html/screenings_test.rb
odeon_uk-3.0.5 test/lib/odeon_uk/html/screenings_test.rb
odeon_uk-3.0.4 test/lib/odeon_uk/html/screenings_test.rb
odeon_uk-3.0.3 test/lib/odeon_uk/html/screenings_test.rb
odeon_uk-3.0.2 test/lib/odeon_uk/html/screenings_test.rb
odeon_uk-3.0.1 test/lib/odeon_uk/html/screenings_test.rb