Commit 7cce1ef3 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Checks for :success instead "success"

parent ac3e9c2a
......@@ -11,7 +11,7 @@ module Projects
opts = { issue_references: params[:issue_references] }
result = RelatedIssues::CreateService.new(issue, current_user, opts).execute
if result['status'] == 'success'
if result['status'] == :success
render json: { result: result, issues: issues }, status: result['http_status']
else
render json: { result: result }, status: result['http_status']
......
......@@ -34,7 +34,7 @@ describe Projects::RelatedIssuesController, type: :controller do
describe 'POST #create' do
let(:service) { double(RelatedIssues::CreateService, execute: service_response) }
let(:list_service) { double(RelatedIssues::ListService, execute: list_service_response) }
let(:service_response) { { 'message' => 'yay', 'status' => 'success' } }
let(:service_response) { { 'message' => 'yay', 'status' => :success } }
let(:list_service_response) { [{ 'foo' => 'bar' }] }
let(:issue_references) { double }
let(:user_role) { :developer }
......@@ -63,7 +63,7 @@ describe Projects::RelatedIssuesController, type: :controller do
context 'with success' do
it 'returns success JSON' do
is_expected.to have_http_status(200)
expect(json_response).to eq('result' => service_response,
expect(json_response).to eq('result' => { 'message' => 'yay', 'status' => 'success' },
'issues' => list_service_response)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment