Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from 0xdiba/send_job_info_on_error
Browse files Browse the repository at this point in the history
fix: render_batch receives jobs in hash form.
  • Loading branch information
goatslacker authored Jan 15, 2019
2 parents cdee4f3 + 6906901 commit 9fa2a7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/hypernova/request_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def render_batch(jobs)
return render_batch_blank(jobs) if jobs.empty?
response_body = Hypernova::ParsedResponse.new(jobs).body
response_body.each do |index_string, resp|
on_error(build_error(resp["error"]), jobs[index_string.to_i]) if resp["error"]
on_error(build_error(resp["error"]), jobs[index_string]) if resp["error"]
end
build_renderer(jobs).render(response_body)
end
Expand Down
10 changes: 5 additions & 5 deletions spec/request_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# Do not override these variables
let(:batch_renderer) { double("batch_renderer") }
let(:jobs) do
[
Helpers.args_1,
Helpers.args_2,
]
{
"0" => Helpers.args_1,
"1" => Helpers.args_2,
}
end
let(:parsed_response) { double("parsed_response", body: body) }

Expand Down Expand Up @@ -61,7 +61,7 @@ def on_error(error, job, jobs_hash)

allow(batch_renderer).to receive(:render).with(body)

expect(plugin).to receive(:on_error).with(error_from_response, jobs[1], nil)
expect(plugin).to receive(:on_error).with(error_from_response, jobs["1"], nil)
request_service.render_batch(jobs)
end
end
Expand Down

0 comments on commit 9fa2a7f

Please sign in to comment.