Sha256: 032ea8196bf37d6c30463b04a46843513b3c39b1dcbb1dcb134e86968cc1e82f

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

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

describe OdeonUk::Api::Screenings do
  include ApiFixturesHelper

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

  before { WebMock.disable_net_connect! }

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

    before do
      stub_post('app-init', nil, app_init_plist)
      film_times_plists(71).each do |name|
        film_id = name.match(/(\d+)\.plist/)[1]
        stub_post('film-times',
                  { s: '71', m: film_id },
                  film_times_plist(71, film_id))
      end
    end

    it 'returns an array of screening attributes as hashes' 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

    it 'returns correct number of screenings' do
      subject.count.must_equal 159
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
odeon_uk-3.0.2 test/lib/odeon_uk/api/screenings_test.rb
odeon_uk-3.0.1 test/lib/odeon_uk/api/screenings_test.rb
odeon_uk-3.0.0 test/lib/odeon_uk/api/screenings_test.rb