Sha256: 62d233631649efe152cb194925d7088cd77b15af09bdb5955b3779784b149c37

Contents?: true

Size: 925 Bytes

Versions: 2

Compression:

Stored size: 925 Bytes

Contents

require File.expand_path('../spec_helper', __FILE__)

describe Open311, ".service_list" do
  before do
    Open311.configure do |config|
      config.endpoint     = 'https://open311.sfgov.org/'
      config.format       = 'xml'
      config.jurisdiction = 'sfgov.org'
    end
    stub_request(:get, 'https://open311.sfgov.org/dev/v2/services.xml').
      with(:query => {:jurisdiction_id => 'sfgov.org'}).
      to_return(:body => fixture('services.xml'), :headers => {'Content-Type' => 'text/xml; charset=utf-8'})
  end

  it "should request the correct resource" do
    Open311.service_list
    a_request(:get, 'https://open311.sfgov.org/dev/v2/services.xml').
      with(:query => {:jurisdiction_id => 'sfgov.org'}).
      should have_been_made
  end

  it "should return the correct results" do
    services = Open311.service_list
    services.should be_an Array
    services.first.service_code.should == '001'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open311-0.0.1 spec/open311_spec.rb
open311-0.0.0 spec/open311_spec.rb