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

Explicitly define backend/promotions routes #2332

Merged
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: 4 additions & 0 deletions backend/app/controllers/spree/admin/promotions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class PromotionsController < ResourceController

helper 'spree/promotion_rules'

def show
redirect_to action: :edit
end

def create
@promotion = Spree::Promotion.new(permitted_resource_params)
@promotion.codes.new(value: params[:single_code]) if params[:single_code].present?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
let!(:promotion2) { create(:promotion, name: "name2", code: "code2", path: "path2") }
let!(:category) { create :promotion_category }

describe "#show" do
it "redirects to edit" do
expect(get(:show, params: { id: promotion1.id }))
.to redirect_to(action: :edit, id: promotion1.id )
end
end

describe "#index" do
it "succeeds" do
get :index
Expand Down