Skip to content

Commit

Permalink
Redirect admin/promotions#show to #edit
Browse files Browse the repository at this point in the history
  • Loading branch information
vladstoick committed Nov 9, 2017
1 parent c27eb7b commit 0f936fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 0f936fd

Please sign in to comment.