Sha256: 6c7b2b291cf153ec168969d27dbd7efcbbfc388f73113c27980fec9bbbbae46c

Contents?: true

Size: 1.15 KB

Versions: 29

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

29 entries across 29 versions & 1 rubygems

Version Path
gillbus-0.20.4 test/get_trip_seats_test.rb
gillbus-0.20.3 test/get_trip_seats_test.rb
gillbus-0.20.2 test/get_trip_seats_test.rb
gillbus-0.20.1 test/get_trip_seats_test.rb
gillbus-0.20.0 test/get_trip_seats_test.rb
gillbus-0.19.0 test/get_trip_seats_test.rb
gillbus-0.18.14 test/get_trip_seats_test.rb
gillbus-0.18.13 test/get_trip_seats_test.rb
gillbus-0.18.12 test/get_trip_seats_test.rb
gillbus-0.18.11 test/get_trip_seats_test.rb
gillbus-0.18.10 test/get_trip_seats_test.rb
gillbus-0.18.9 test/get_trip_seats_test.rb
gillbus-0.18.8 test/get_trip_seats_test.rb
gillbus-0.18.7 test/get_trip_seats_test.rb
gillbus-0.18.6 test/get_trip_seats_test.rb
gillbus-0.18.5 test/get_trip_seats_test.rb
gillbus-0.18.4 test/get_trip_seats_test.rb
gillbus-0.18.3 test/get_trip_seats_test.rb
gillbus-0.18.2 test/get_trip_seats_test.rb
gillbus-0.18.1 test/get_trip_seats_test.rb