Sha256: af564a93b95f5cce626b0e3f7a4dbed1fd91d65881ada9f998222e064beefe8b

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

require 'helper'

describe FuturesPipeline::Client do
  before do
    @client = FuturesPipeline::Client.new
  end

  describe "#careers" do
    before do
      stub_get("api/v1/careers.json").
        to_return(:status => 200, :body => fixture("careers.json"))
    end

    it "should fetch all careers" do
      careers = @client.careers
      careers.first.title.should == "Chief Executives"
    end
  end

  describe "#career" do
    context "with API-safe O*NET code" do
      before do
        stub_get("api/v1/careers/11-1011-00.json").
          to_return(:status => 200, :body => fixture("career.json"))
      end

      it "should fetch one career" do
        career = @client.career("11-1011-00")
        career.title.should == "Chief Executives"
      end
    end

    context "with O*NET status code" do
      before do
        stub_get("api/v1/careers/11-1011-00.json").
          to_return(:status => 200, :body => fixture("career.json"))
      end

      it "should fetch one career" do
        career = @client.career("11-1011.00")
        career.title.should == "Chief Executives"
      end
    end
  end

  describe "#search" do
    context "with no paramaters" do
      before do
        stub_get("api/v1/careers/search.json").
          to_return(:status => 200, :body => fixture("search.json"))
      end

      it "should return a search of careers" do
        lambda do
          @client.search
        end.should raise_error ArgumentError
      end
    end

    context "with MOC parameter" do
      before do
        stub_get("api/v1/careers/search.json?moc=11b").
          to_return(:status => 200, :body => fixture("search.json"))
      end

      it "should return one career related to the MOC" do
        search = @client.search("11b")
        search.first.title.should == "Training and Development Specialists"
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
futures_pipeline-0.1.0 spec/futures_pipeline/client_spec.rb
futures_pipeline-0.0.4 spec/futures_pipeline/client_spec.rb
futures_pipeline-0.0.3 spec/futures_pipeline/client_spec.rb