Sha256: a9012ef77ddcf535c57c8481be2673f8665e04efa28b629a1a0fa8acd2fd437d

Contents?: true

Size: 1.57 KB

Versions: 17

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'
require 'td/client/spec_resources'

describe 'Command' do
  include_context 'spec symbols'
  include_context 'common helper'
  include_context 'job resources'

  before do
    stub_api_request(:post, "/v3/user/authenticate").
      to_return(:body => {'apikey' => 'apikey'}.to_json)
  end

  let :client do
    Client.authenticate('user', 'password')
  end

  describe '#job' do
    before do
      stub_api_request(:get, "/v3/job/list").to_return(:body => {'jobs' => raw_jobs}.to_json)
    end

    it 'return jobs created with API result' do
      jobs = client.jobs

      expect(jobs).to be_kind_of Array
      jobs.each.with_index do |job, i|
        expect(job.job_id).to       eq raw_jobs[i]['job_id']
        expect(job.type).to         eq raw_jobs[i]['type']
        expect(job.status).to       eq raw_jobs[i]['status']
        expect(job.query).to        eq raw_jobs[i]['query']
        expect(job.start_at).to     eq Time.parse(raw_jobs[i]['start_at'])
        expect(job.end_at).to       eq Time.parse(raw_jobs[i]['end_at'])
        expect(job.cpu_time).to     eq raw_jobs[i]['cpu_time']
        expect(job.result_size).to  eq raw_jobs[i]['result_size']
        expect(job.result_url).to   eq raw_jobs[i]['result_url']
        expect(job.priority).to     eq raw_jobs[i]['priority']
        expect(job.retry_limit).to  eq raw_jobs[i]['retry_limit']
        expect(job.org_name).to     eq raw_jobs[i]['organization']
        expect(job.db_name).to      eq raw_jobs[i]['database']
        expect(job.duration).to     eq raw_jobs[i]['duration']
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
td-client-0.8.84 spec/td/client_spec.rb
td-client-0.8.83 spec/td/client_spec.rb
td-client-0.8.82 spec/td/client_spec.rb
td-client-0.8.81 spec/td/client_spec.rb
td-client-0.8.80 spec/td/client_spec.rb
td-client-0.8.79 spec/td/client_spec.rb
td-client-0.8.78 spec/td/client_spec.rb
td-client-0.9.0dev2 spec/td/client_spec.rb
td-client-0.9.0dev1 spec/td/client_spec.rb
td-client-0.8.77 spec/td/client_spec.rb
td-client-0.8.76 spec/td/client_spec.rb
td-client-0.8.75 spec/td/client_spec.rb
td-client-0.8.74 spec/td/client_spec.rb
td-client-0.8.73 spec/td/client_spec.rb
td-client-0.8.72 spec/td/client_spec.rb
td-client-0.8.71 spec/td/client_spec.rb
td-client-0.8.70 spec/td/client_spec.rb