Sha256: c5a21708023048a7d90227f9c52bd1417dc069a49b5549a66164789bba1cdfc6

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe Ratis::Routes do
  let(:empty_body){ {:allroutes2_response => {:routes => []}} }

  describe '#all', vcr: {} do
    it 'returns all routes' do
      response = Ratis::Routes.all
      expect(response).to have(103).items
      expect(response.all?{|rte| rte.is_a?(Ratis::Route) }).to be_true
    end

    it 'only makes one request' do
      Ratis::Request.should_receive(:get).once.and_call_original
      Ratis::Routes.all
    end

    it 'requests the correct SOAP action' do
      Ratis::Request.should_receive(:get) do |action, options|
                       action.should eq('Allroutes2')
                     end.and_return(double('response', :success? => false, :body => empty_body)) # false only to stop further running

      Ratis::Routes.all
    end

    it 'should set directions and short_name to variables' do
      response = Ratis::Routes.all
      route    = response.first

      expect(response).to be_a(Array)
      expect(route).to be_a(Ratis::Route)
      expect(route.short_name).to eq('1')
      expect(route.directions).to have(2).directions
      expect(route.directions).to include('E')
      expect(route.directions).to include('W')
    end

  end

  describe '#timetable' do
    it "description" do
      pending
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ratis-3.6.6 spec/ratis/routes_spec.rb
ratis-3.6.5 spec/ratis/routes_spec.rb
ratis-3.6.4 spec/ratis/routes_spec.rb
ratis-3.6.3 spec/ratis/routes_spec.rb
ratis-3.6.2 spec/ratis/routes_spec.rb
ratis-3.6.1 spec/ratis/routes_spec.rb
ratis-3.6.0 spec/ratis/routes_spec.rb
ratis-3.5.0 spec/ratis/routes_spec.rb