Skip to content

Commit

Permalink
AggClient already returns the parsed response body (#4348)
Browse files Browse the repository at this point in the history
* AggClient already returns the parsed response body

* and the spec fix
  • Loading branch information
zwolf authored Jun 15, 2024
1 parent b6d3205 commit df1f926
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/aggregations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def create
create_params['links']['user']
)
super do |agg|
agg.update({ task_id: response.body[:task_id], status: 'pending' })
agg.update({ task_id: response[:task_id], status: 'pending' })
end
rescue AggregationClient::ConnectionError
json_api_render(:service_unavailable, 'The aggregation service is unavailable or not responding')
Expand Down
3 changes: 1 addition & 2 deletions spec/controllers/api/v1/aggregations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
describe 'create' do
let(:test_attr) { :workflow_id }
let(:test_attr_value) { workflow.id }
let(:fake_response) { double }
let(:fake_response) { { 'task_id': 'asdf-1234-asdf' } }
let(:mock_agg) { instance_double(AggregationClient) }

let(:create_params) do
Expand All @@ -48,7 +48,6 @@

before do
allow(AggregationClient).to receive(:new).and_return(mock_agg)
allow(fake_response).to receive(:body).and_return({ 'task_id': 'asdf-1234-asdf' })
allow(mock_agg).to receive(:send_aggregation_request).and_return(fake_response)
default_request scopes: scopes, user_id: authorized_user.id
end
Expand Down

0 comments on commit df1f926

Please sign in to comment.