Sha256: 7d9451b414474bfb25a090880d6ed74cce76070c36e33a0a0a0a6d7a2b7a2410
Contents?: true
Size: 1.63 KB
Versions: 12
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' require 'td/client/spec_resources' describe 'Schedule Command' do include_context 'spec symbols' include_context 'common helper' let :api do API.new(nil) end let :client do client = TreasureData::Client.new('dummy') client.instance_variable_set('@api', api) client end describe 'history' do let :opts do {'database' => db_name} end let :history do ['history', 'scheduled_at', 'job_id', 'type', 'database', 'status', 'query', 'start_at', 'end_at', 'result', 'priority'].inject({}) { |r, e| r[e] = e r } end it 'returns scheduled_job' do h = history; h['scheduled_at'] = '2015-02-17 14:16:00 +0900' stub_api_request(:get, "/v3/schedule/history/#{e(sched_name)}?from=0&to=19"). to_return(:body => {'count' => 1, 'history' => [h]}.to_json) client.history(sched_name, 0, 19).each do |scheduled_job| scheduled_job.scheduled_at.xmlschema.should == Time.parse('2015-02-17T14:16:00+09:00').xmlschema #avoid depending on CI's Locale scheduled_job.job_id.should == 'job_id' scheduled_job.status.should == 'status' scheduled_job.priority.should == 'priority' scheduled_job.result_url.should == 'result' end end it 'works when scheduled_at == ""' do h = history; h['scheduled_at'] = '' stub_api_request(:get, "/v3/schedule/history/#{e(sched_name)}?from=0&to=19"). to_return(:body => {'count' => 1, 'history' => [h]}.to_json) client.history(sched_name, 0, 19).each do |scheduled_job| scheduled_job.scheduled_at.should == nil end end end end
Version data entries
12 entries across 12 versions & 1 rubygems