Sha256: 0b01c014e32e652bb96ed0ff3f6b20a6f6c6058304ceb93ec5e5e3811493e96b

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require_relative '../../../../../test_helper'
require_relative '../../../../../support/fixture_reader'

describe CineworldUk::Internal::Parser::Api::Performance do
  include Support::FixtureReader

  let(:described_class) { CineworldUk::Internal::Parser::Api::Performance }
  let(:data) { random_performance }

  before { WebMock.disable_net_connect! }
  after { WebMock.allow_net_connect! }

  describe '#booking_url' do
    subject { described_class.new(data).booking_url }

    it 'should be a url on the cineworld website' do
      subject.must_match(%r{cineworld.co.uk/booking\?})
    end
  end

  describe '#film_id' do
    subject { described_class.new(data).film_id }

    it 'should be a six digit integer' do
      subject.must_be_instance_of(Fixnum)
      subject.must_be :>, 10_000
    end
  end

  describe '#starting_at' do
    subject { described_class.new(data).starting_at }

    it 'should be a time' do
      subject.must_be_instance_of(Time)
    end
  end

  describe '#variant' do
    subject { described_class.new(data).variant }

    describe 'has "ad" => true' do
      let(:data) { random_performance.merge('ad' => true) }

      it 'includes "audio_described"' do
        subject.must_include('audio_described')
      end
    end

    describe 'has "ss" => true' do
      let(:data) { random_performance.merge('subtitled' => true) }

      it 'includes "subtitled"' do
        subject.must_include('subtitled')
      end
    end
  end

  private

  def random_performance
    JSON.parse(performances_tomorrow_json(3))['performances'].sample
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cineworld_uk-3.0.4 test/lib/cineworld_uk/internal/parser/api/performance_test.rb
cineworld_uk-3.0.3 test/lib/cineworld_uk/internal/parser/api/performance_test.rb
cineworld_uk-3.0.2 test/lib/cineworld_uk/internal/parser/api/performance_test.rb