mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add spec for shipping categories
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
describe ShippingCategoriesController, type: :controller do
|
||||
include AuthenticationWorkflow
|
||||
|
||||
describe "#create and #update" do
|
||||
before { login_as_admin }
|
||||
|
||||
it "creates a shipping shipping category" do
|
||||
expect {
|
||||
spree_post :create, shipping_category: { name: "Frozen" }
|
||||
}.to change(Spree::ShippingCategory.all, :count).by(1)
|
||||
|
||||
expect(response).to redirect_to spree.admin_shipping_categories_url
|
||||
end
|
||||
|
||||
it "updates an existing shipping category" do
|
||||
shipping_category = create(:shipping_category)
|
||||
spree_put :update, id: shipping_category.id,
|
||||
shipping_category: { name: "Super Frozen" }
|
||||
|
||||
expect(response).to redirect_to spree.admin_shipping_categories_url
|
||||
expect(shipping_category.reload.name).to eq "Super Frozen"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user