Sha256: dae2e1497a9864b7372e3f1b277e18432783c6f53c2839e8748903cd1e0e868b

Contents?: true

Size: 1.15 KB

Versions: 31

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

class GetTripSeatsTest < Minitest::Test

  def get_trip_seats
    Gillbus::GetTripSeats::Response.parse_string(File.read('test/responses/getTripSeats.xml'))
  end

  def get_trip_seats_with_segments
    Gillbus::GetTripSeats::Response.parse_string(File.read('test/responses/getTripSeats-segments.xml'))
  end

  def get_trip_seats_with_one_empty_segment
    Gillbus::GetTripSeats::Response.parse_string(File.read('test/responses/getTripSeats-one-empty-segment.xml'))
  end

  def test_seats
    seats = get_trip_seats.seats
    max_x = seats.map(&:x).max
    max_y = seats.map(&:y).max
    assert_equal( 70, seats.size )
    assert_equal( 4, max_y )
    assert_equal( 13, max_x )
  end

  def test_seats_with_segments
    segments = get_trip_seats_with_segments.segments
    assert_equal 2, segments.size
    assert_equal [0, 1], segments.keys
    assert_equal 70, segments.values.first.size
  end

  def test_seats_with_one_segment_without_seatmap
    segments = get_trip_seats_with_one_empty_segment.segments
    assert_equal 2, segments.size
    assert_equal [0, 1], segments.keys
    assert [], segments[0]
    assert_equal 80, segments[1].size
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
gillbus-0.16.7 test/get_trip_seats_test.rb
gillbus-0.16.6 test/get_trip_seats_test.rb
gillbus-0.16.5 test/get_trip_seats_test.rb
gillbus-0.16.4 test/get_trip_seats_test.rb
gillbus-0.16.3 test/get_trip_seats_test.rb
gillbus-0.16.2 test/get_trip_seats_test.rb
gillbus-0.16.1 test/get_trip_seats_test.rb
gillbus-0.15.7 test/get_trip_seats_test.rb
gillbus-0.15.6 test/get_trip_seats_test.rb
gillbus-0.15.5 test/get_trip_seats_test.rb
gillbus-0.15.4 test/get_trip_seats_test.rb
gillbus-0.15.3 test/get_trip_seats_test.rb
gillbus-0.15.2 test/get_trip_seats_test.rb
gillbus-0.15.1 test/get_trip_seats_test.rb
gillbus-0.15.0 test/get_trip_seats_test.rb
gillbus-0.14.12 test/get_trip_seats_test.rb
gillbus-0.14.11 test/get_trip_seats_test.rb
gillbus-0.14.10 test/get_trip_seats_test.rb
gillbus-0.14.9 test/get_trip_seats_test.rb
gillbus-0.14.8 test/get_trip_seats_test.rb