Skip to content

Commit

Permalink
DG-28544 integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil91 committed Apr 25, 2024
1 parent a305e8a commit 099f1a3
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions spec/task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,33 +224,33 @@
end

describe '#find_task' do
it 'retrieves a specific task by ID' do
task_id = 6486
task = generate_task(task_id)
stub_factory "/api/v1/tasks/#{task_id}", task.to_json

res = @conn.task.find_task(task_id)
expect(res['id']).to eq(task['id'])
expect(res['name']).to eq(task['name'])
expect(res['status']).to eq(task['status'])
end
it 'retrieves a specific task by ID' do
task_id = 6486
task = generate_task(task_id)
stub_factory "/api/v1/tasks/#{task_id}", task.to_json

res = @conn.task.find_task(task_id)
expect(res['id']).to eq(task['id'])
expect(res['name']).to eq(task['name'])
expect(res['status']).to eq(task['status'])
end

it 'raises an error when task is not found' do
task_id = 456
error_response = { 'message' => 'Task not found' }
stub_factory "/api/v1/tasks/#{task_id}", error_response.to_json, 404
it 'raises an error when task is not found' do
task_id = 456
error_response = { 'message' => 'Task not found' }
stub_factory "/api/v1/tasks/#{task_id}", error_response.to_json, 404

expect { @conn.task.find_task(task_id) }.to raise_error(SFRest::SFError)
expect { @conn.task.find_task(task_id) }.to raise_error(SFRest::SFError)
end
end
end

def generate_task(task_id)
{
'id' => task_id,
'name' => "Task #{task_id}",
'status' => SFRest::Task::STATUS_COMPLETED
}
end
def generate_task(task_id)
{
'id' => task_id,
'name' => "Task #{task_id}",
'status' => SFRest::Task::STATUS_COMPLETED
}
end

describe '#get_task_id' do
it 'can get task id for a named task' do
Expand Down

0 comments on commit 099f1a3

Please sign in to comment.