Sha256: 75019f64ee18d6930a0c892283e2bc0371cdf5af04cf651f34dcfaf985a586c9

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe "HawatelSearchJobs::Api::Indeed"  do

  before(:each) do
    HawatelSearchJobs.configure do |config|
      config.indeed[:api] = 'api.indeed.com'
      config.indeed[:publisher] = ''
    end
  end

  let(:client) { return HawatelSearchJobs::Client.new }
  let(:result) {
    return HawatelSearchJobs::Api::Indeed.search(
        :settings => HawatelSearchJobs.indeed,
        :query    => { :keywords => 'ruby', :company => '' }
    )}

  xit "metadata from search() result" do
    expect(result.totalResults).to be_a_kind_of(Integer)
    expect(result.page).to be_a_kind_of(Integer)
    expect(result.last).to be_a_kind_of(Integer)
    expect(result.key).to include("http")
  end

  xit "job attrubutes from search() result" do
    expect(result.jobs.size).to be > 0
    result.jobs.each do |job|
      expect(job.jobtitle).to be_a_kind_of(String)
      expect(job.location).to be_a_kind_of(String)
      expect(job.company).to be_a_kind_of(String)
      expect(job.url).to include('http')
    end
  end

  xit "call page() without page param (default 0)" do
    jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key})
    expect(jobs.page).to eq(0)
  end

  xit "call page() with specified page" do
    jobs = HawatelSearchJobs::Api::Indeed.page({:query_key => result.key, :page => 1})
    expect(jobs.page).to eq(1)
  end

  xit "call search() with providing location param" do
    result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:location => 'US'})
    result.jobs.each do |job|
      expect(job.location).to include("US")
    end
  end


  xit "call search() with providing company param" do
    result = HawatelSearchJobs::Api::Indeed.search(:settings => HawatelSearchJobs.indeed, :query => {:company => 'ibm'})
    result.jobs.each do |job|
      expect(job.company).to eq("IBM")
    end
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hawatel_search_jobs-0.1.0 spec/indeed_spec.rb