Sha256: 398cd095269c54947d5e21032dbe0fcb05e38d57764f82a2f020975aa834185c

Contents?: true

Size: 1.99 KB

Versions: 2

Compression:

Stored size: 1.99 KB

Contents

require_relative '../../test_helper'

describe OdeonUk::Screening do

  before { WebMock.disable_net_connect! }

  describe '#new film_name, cinema_name, date, time, variant' do
    it 'stores film_name, cinema_name & when (in UTC)' do
      screening = OdeonUk::Screening.new 'Iron Man 3', 'Brighton', Time.parse('2013-09-12 12:00') # non-UTC time
      screening.film_name.must_equal 'Iron Man 3'
      screening.cinema_name.must_equal 'Brighton'
      screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
      screening.booking_url.must_equal nil
      screening.variant.must_equal nil
    end

    it 'stores variant if passed' do
      screening = OdeonUk::Screening.new 'Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), nil, '3d'
      screening.film_name.must_equal 'Iron Man 3'
      screening.cinema_name.must_equal 'Brighton'
      screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
      screening.booking_url.must_equal nil
      screening.variant.must_equal '3d'
    end

    it 'stores booking_url if passed' do
      screening = OdeonUk::Screening.new 'Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), 'http://booking_url'
      screening.film_name.must_equal 'Iron Man 3'
      screening.cinema_name.must_equal 'Brighton'
      screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
      screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
      screening.booking_url.must_equal 'http://booking_url'
      screening.variant.must_equal nil
    end
  end

  describe '#date' do
    subject { OdeonUk::Screening.new('Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), '3d').date }
    it 'should return date of showing' do
      subject.must_be_instance_of(Date)
      subject.must_equal Date.new(2013, 9, 12)
    end
  end

  describe '#varient (DEPRECATED)' do
    subject { screening.varient }
    let(:screening) { OdeonUk::Screening.new('Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), nil, '3d') }

    it 'should return variant' do
      subject.must_equal '3d'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
odeon_uk-1.1.5 test/lib/odeon_uk/screening_test.rb
odeon_uk-1.1.4 test/lib/odeon_uk/screening_test.rb