Sha256: c7e5c1ad55caa05269e3ea5bb84ff1bd874dcd2b5dba1db4df6d452f7227bc15

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..','..', 'lib'))

require_relative 'helper'

class TrainTest < MiniTest::Unit::TestCase
  def setup
    ir = IERail.new

    VCR.configure do |c|
      c.cassette_library_dir = 'fixtures/vcr_cassettes'
      c.hook_into :webmock
    end

    VCR.use_cassette('trains') do
      @train = ir.trains.sample #Use a random station
    end
  end

  def test_that_a_train_has_status
    refute_empty @train.status
  end

  def test_that_a_train_has_a_location
    refute_empty @train.location
  end

  def test_that_a_trains_location_is_an_array
    assert_equal @train.location.class, Array
  end

  def test_that_the_location_array_contains_only_two_values
    assert_equal @train.location.size, 2
  end

  def test_that_a_train_has_a_code
    refute_empty @train.code
  end

  def test_that_a_train_has_a_date
    refute_nil @train.date
  end

  def test_that_a_train_has_a_message
    refute_empty @train.message
  end

  def test_that_a_train_has_a_direction
    refute_empty @train.direction
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ierail-0.4.1 test/unit/train.rb
ierail-0.4.0 test/unit/train.rb