spec/td/client/sched_api_spec.rb in td-client-0.8.79 vs spec/td/client/sched_api_spec.rb in td-client-0.8.80
- old
+ new
@@ -18,19 +18,19 @@
start = Time.now
stub_api_request(:post, "/v3/schedule/create/#{e(sched_name)}").
with(:body => opts.merge('type' => 'hive')).
to_return(:body => {'name' => sched_name, 'start' => start.to_s}.to_json)
- api.create_schedule(sched_name, opts.merge('type' => 'hive')).should == start.to_s
+ expect(api.create_schedule(sched_name, opts.merge('type' => 'hive'))).to eq(start.to_s)
end
it 'should create a dummy schedule' do
stub_api_request(:post, "/v3/schedule/create/#{e(sched_name)}").
with(:body => opts.merge('type' => 'hive')).
to_return(:body => {'name' => sched_name, 'start' => nil}.to_json)
- api.create_schedule(sched_name, opts.merge('type' => 'hive')).should be_nil
+ expect(api.create_schedule(sched_name, opts.merge('type' => 'hive'))).to be_nil
end
it 'should return 422 error with invalid name' do
name = '1'
err_msg = "Validation failed: Name is too short" # " (minimum is 3 characters)"
@@ -46,11 +46,11 @@
describe 'delete_schedule' do
it 'should delete the schedule' do
stub_api_request(:post, "/v3/schedule/delete/#{e(sched_name)}").
to_return(:body => {'cron' => 'cron', 'query' => 'query'}.to_json)
- api.delete_schedule(sched_name).should == ['cron', 'query']
+ expect(api.delete_schedule(sched_name)).to eq(['cron', 'query'])
end
end
describe 'update_schedule' do
let :pig_query do
@@ -92,18 +92,18 @@
it 'should return history records' do
stub_api_request(:get, "/v3/schedule/history/#{e(sched_name)}").
with(:query => {'from' => 0, 'to' => 100}).
to_return(:body => {'history' => [history]}.to_json)
- api.history(sched_name, 0, 100).should == [[nil, 'job_id', :type, 'status', 'query', 'start_at', 'end_at', 'result', 'priority', 'database']]
+ expect(api.history(sched_name, 0, 100)).to eq([[nil, 'job_id', :type, 'status', 'query', 'start_at', 'end_at', 'result', 'priority', 'database']])
end
end
describe 'run_schedule' do
it 'should return history records' do
stub_api_request(:post, "/v3/schedule/run/#{e(sched_name)}/123456789").
with(:body => {'num' => '5'}).
to_return(:body => {'jobs' => [{'job_id' => 'job_id', 'scheduled_at' => 'scheduled_at', 'type' => 'type'}]}.to_json)
- api.run_schedule(sched_name, 123456789, 5).should == [['job_id', :type, 'scheduled_at']]
+ expect(api.run_schedule(sched_name, 123456789, 5)).to eq([['job_id', :type, 'scheduled_at']])
end
end
end