Sha256: e17daec3dc8cf973eca47dc70a2c497a8dec444885c3b86450ca14237aad17d0

Contents?: true

Size: 1.29 KB

Versions: 44

Compression:

Stored size: 1.29 KB

Contents

require "spec_helper"

describe "jobs" do
  let (:client) { Intercom::Client.new(app_id: 'app_id',  api_key: 'api_key') }
  let (:job) {
    {
      "app_id"=>"app_id",
      "id"=>"super_awesome_job",
      "created_at"=>1446033421,
      "completed_at"=>1446048736,
      "closing_at"=>1446034321,
      "updated_at"=>1446048736,
      "name"=>"api_bulk_job",
      "state"=>"completed",
      "links"=>
        {
          "error"=>"https://api.intercom.io/jobs/super_awesome_job/error",
          "self"=>"https://api.intercom.io/jobs/super_awesome_job"
        },
      "tasks"=>
        [
          {
            "id"=>"super_awesome_task",
            "item_count"=>2,
            "created_at"=>1446033421,
            "started_at"=>1446033709,
            "completed_at"=>1446033709,
            "state"=>"completed"
          }
        ]
      }
  }
  let (:error_feed) {
    {
      "app_id"=>"app_id",
      "job_id"=>"super_awesome_job",
      "pages"=>{},
      "items"=>[]
    }
  }

  it 'gets a job' do
    client.expects(:get).with("/jobs/super_awesome_job", {}).returns(job)
    client.jobs.find(id: 'super_awesome_job')
  end

  it 'gets a job\'s error feed' do
    client.expects(:get).with("/jobs/super_awesome_job/error", {}).returns(error_feed)
    client.jobs.errors(id: 'super_awesome_job')
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
intercom-3.9.5 spec/unit/intercom/job_spec.rb
intercom-3.9.4 spec/unit/intercom/job_spec.rb
intercom-3.9.3 spec/unit/intercom/job_spec.rb
intercom-3.9.2 spec/unit/intercom/job_spec.rb
intercom-3.9.0 spec/unit/intercom/job_spec.rb
intercom-3.8.1 spec/unit/intercom/job_spec.rb
intercom-3.8.0 spec/unit/intercom/job_spec.rb
intercom-3.7.7 spec/unit/intercom/job_spec.rb
intercom-3.7.6 spec/unit/intercom/job_spec.rb
intercom-3.7.5 spec/unit/intercom/job_spec.rb
intercom-3.7.4 spec/unit/intercom/job_spec.rb
intercom-3.7.3 spec/unit/intercom/job_spec.rb
intercom-3.7.2 spec/unit/intercom/job_spec.rb
intercom-3.7.1 spec/unit/intercom/job_spec.rb
intercom-3.7.0 spec/unit/intercom/job_spec.rb
intercom-3.6.2 spec/unit/intercom/job_spec.rb
intercom-3.6.1 spec/unit/intercom/job_spec.rb
intercom-3.6.0 spec/unit/intercom/job_spec.rb
intercom-3.5.26 spec/unit/intercom/job_spec.rb
intercom-3.5.25 spec/unit/intercom/job_spec.rb