Sha256: 4f1e7a9e7ab45300eed53bc1ddc73b78aef367cae09c74d64a76dc863a896bed

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Qa::Authorities::Loc do
  
  before :all do
    stub_request(:get, "http://id.loc.gov/search/?format=json&q=haw*&q=cs:http://id.loc.gov/vocabulary/geographicAreas").
      with(:headers => {'Accept'=>'application/json'}).
      to_return(:body => webmock_fixture("loc-response.txt"), :status => 200)
    @authority = Qa::Authorities::Loc.new("haw*", "geographicAreas")
  end
  
  it "should instantiate with a query and return data" do
    expect(@authority).not_to be_nil
    @authority.raw_response.to_s.should include("id")
  end  
  
  it "should return a sub_authority url" do
    @authority.should_not be_nil
    url = @authority.sub_authorityURL("geographicAreas")
    expect(url).not_to be_nil
  end
  
  it "should not return a url for an invalid sub_authority" do
    @authority.should_not be_nil
    url = @authority.sub_authorityURL("invalid sub_authority")
    expect(url).to eq("")
  end
  
  it "should return JSON" do
    @authority.should_not be_nil
    json = @authority.parse_authority_response
    expect(json).not_to be_empty
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qa-0.0.1 spec/lib/authorities_loc_spec.rb