Add test and change order_cycle#show to redirect to edit page.

This commit is contained in:
Monica Sirathanarun
2021-10-16 17:04:31 +07:00
committed by bellvat
parent 6deb5ea4d4
commit ebaf96ddae
2 changed files with 17 additions and 1 deletions

View File

@@ -26,7 +26,9 @@ module Admin
def show
respond_to do |format|
format.html
format.html do
redirect_to edit_admin_order_cycle_path(@order_cycle)
end
format.json do
render_as_json @order_cycle, current_user: spree_current_user
end

View File

@@ -104,6 +104,20 @@ module Admin
end
end
describe "show" do
context 'a distributor manages an order cycle' do
let(:distributor) { create(:distributor_enterprise, owner: distributor_owner) }
let(:oc) { create(:simple_order_cycle, coordinator: distributor) }
context "distributor navigates to order cycle show page" do
it 'redirects to edit page' do
get :show, params: { id: oc.id }
expect(response).to redirect_to edit_admin_order_cycle_path(oc.id)
end
end
end
end
describe "create" do
let(:shop) { create(:distributor_enterprise) }