Sha256: 177fe1481a9d9ee5f4e9c5908071c576b6c61e76a8ad62706c813e623751c420

Contents?: true

Size: 1.79 KB

Versions: 5

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe Ratis::LandmarkCategory do

  before do
    Ratis.reset
    Ratis.configure do |config|
      config.endpoint   = 'http://soap.valleymetro.org/cgi-bin-soap-web-262/soap.cgi'
      config.namespace  = 'PX_WEB'
    end
  end

  describe '.all', vcr: {} do
    it 'only makes one request' do
      # false just to stop further processing of response
      Ratis::Request.should_receive(:get).once.and_call_original
      Ratis::LandmarkCategory.all
    end

    it 'requests the correct SOAP action with correct args' do
      Ratis::Request.should_receive(:get) do |action, options|
        action.should eq('Getcategories')

      end.and_return(double('response', :success? => false))

      Ratis::LandmarkCategory.all
    end

    it 'should return a collection of Ratis::LandmarkCategory(s)' do
      categories = Ratis::LandmarkCategory.all
      categories.each do |obj|
        expect(obj).to be_a(Ratis::LandmarkCategory)
      end
    end

    it 'should return all landmark categories' do
      categories = Ratis::LandmarkCategory.all
      categories.should have(76).items
    end
  end

  describe '.web_categories', vcr: {} do
    it "does something" do
      web_categories = Ratis::LandmarkCategory.web_categories
      expect(web_categories).to have(14).items

      [["AIRPORT", "WEBAIR"], ["COLLEGES", "WEBCOL"], ["COMMUNITY RESOURCES", "WEBCMR"], ["FAMILY ATTRACTIONS", "WEBFAM"], ["GOVT LOCAL STATE FEDERAL", "WEBGOV"], ["HOSPITALS AND CLINICS", "WEBHOS"], ["LIBRARIES", "WEBLIB"], ["LIGHT RAIL STATIONS", "WEBSTN"], ["MUSEUMS", "WEBMUS"], ["PARK AND RIDE", "WEBPR"], ["PERFORMING ARTS", "WEBPER"], ["SHOPPING MALLS", "WEBSHP"], ["SPORTS VENUES", "WEBSPT"], ["TRANSIT CENTERS", "WEBTC"]].each do |pair|
        expect(web_categories).to include(pair)
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ratis-3.4.3 spec/ratis/landmark_category_spec.rb
ratis-3.4.2 spec/ratis/landmark_category_spec.rb
ratis-3.4.1 spec/ratis/landmark_category_spec.rb
ratis-3.4.0 spec/ratis/landmark_category_spec.rb
ratis-3.3.7 spec/ratis/landmark_category_spec.rb