Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow or item not found now return 404 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/scriptoria-core/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Application < Grape::API
end

rescue_from Workflow::NotFoundError do |e|
error!('workflow_id not found', 400)
error!('workflow_id not found', 404)
end

post :cancel do
Expand All @@ -69,7 +69,7 @@ class Application < Grape::API
end

rescue_from Workitem::NotFoundError do |e|
error!('workitem_id not found', 400)
error!('workitem_id not found', 404)
end

rescue_from Workitem::WorkflowMismatchError do |e|
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/v1/workflow_cancel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
end

context "validations" do
it "returns an error if the workflow does exist" do
it "returns an error if the workflow does not exist" do
allow(ScriptoriaCore::Workflow).to receive(:cancel!).and_raise(ScriptoriaCore::Workflow::NotFoundError)

post '/v1/workflows/1234/cancel'

expect(response.status).to eq 400
expect(response.status).to eq 404
expect(response.body).to eq '{"error":"workflow_id not found"}'
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/v1/workitem_proceed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
}

expect(response.status).to eq 400
expect(response.status).to eq 404
expect(response.body).to eq '{"error":"workitem_id not found"}'
end

Expand Down