-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate orders/could_not_transition view
- Loading branch information
1 parent
18b5370
commit e51fe03
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
api/app/views/spree/api/orders/could_not_transition.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
Spree::Deprecation.warn( | ||
'spree/api/orders/could_not_transition is deprecated.' \ | ||
' Please use spree/api/errors/could_not_transition' | ||
) | ||
|
||
json.error(I18n.t(:could_not_transition, scope: "spree.api.order")) | ||
json.errors(@order.errors.to_hash) |
20 changes: 20 additions & 0 deletions
20
api/spec/views/spree/api/orders/could_not_transition.json.jbuilder_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe 'spree/api/orders/could_not_transition.json.jbuilder' do | ||
helper(Spree::Api::ApiHelpers) | ||
|
||
let(:template_deprecation_error) do | ||
'spree/api/orders/could_not_transition is deprecated.' \ | ||
' Please use spree/api/errors/could_not_transition' | ||
end | ||
|
||
it 'shows a deprecation error' do | ||
assign(:order, instance_double(Spree::Order, errors: {})) | ||
|
||
expect(Spree::Deprecation).to receive(:warn).with(template_deprecation_error) | ||
|
||
render | ||
end | ||
end |