mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Add test and change order_cycle#show to redirect to edit page.
This commit is contained in:
committed by
bellvat
parent
6deb5ea4d4
commit
ebaf96ddae
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user