-
-
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.
Make admin order event_links translatable
The admin/orders_helper event_links didn't had enough scope to be translatable for the particular order event. In some languages canceling and order is something different than clicking a "cancel" button in a form. The solidus_i18n gem already has the translation scopes for these events, so I implemeted it that it will Just Work™
- Loading branch information
Showing
3 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
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
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,53 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe Spree::Admin::OrdersHelper, type: :helper do | ||
describe "#event_links" do | ||
subject { helper.event_links } | ||
|
||
before do | ||
helper.class.include Spree::Admin::NavigationHelper | ||
helper.class.include Spree::Core::Engine.routes.url_helpers | ||
@order_events = %w{approve cancel resume} | ||
end | ||
|
||
context "with an uncompleted order" do | ||
before do | ||
@order = create(:order) | ||
end | ||
|
||
it "renders link to approve order" do | ||
is_expected.to have_button("Approve") | ||
end | ||
end | ||
|
||
context "with a complete order" do | ||
before do | ||
@order = create(:completed_order_with_totals) | ||
end | ||
|
||
it "renders link to approve order" do | ||
is_expected.to have_button("Approve") | ||
end | ||
|
||
it "renders link to cancel order" do | ||
is_expected.to have_button("Cancel") | ||
end | ||
end | ||
|
||
context "with a canceled order" do | ||
before do | ||
@order = create(:completed_order_with_totals).tap(&:cancel!) | ||
end | ||
|
||
it "renders link to approve order" do | ||
is_expected.to have_button("Approve") | ||
end | ||
|
||
it "renders link to resume order" do | ||
is_expected.to have_button("Resume") | ||
end | ||
end | ||
end | ||
end |
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