mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
Replace usage of helper method with a more simple approach
This commit is contained in:
@@ -2,17 +2,6 @@ module Spree
|
||||
module Api
|
||||
module TestingSupport
|
||||
module Setup
|
||||
def sign_in_as_user!
|
||||
let!(:current_api_user) do
|
||||
user = Spree::LegacyUser.new(email: "ofn@example.com")
|
||||
user.stub(:has_spree_role?).with("admin").and_return(false)
|
||||
user.stub(:enterprises) { [] }
|
||||
user.stub(:owned_groups) { [] }
|
||||
user.stub(:spree_api_key) { "spree_api_key" }
|
||||
user
|
||||
end
|
||||
end
|
||||
|
||||
# enterprises is an array of variable names of let defines
|
||||
# eg.
|
||||
# let(:enterprise) { ... }
|
||||
|
||||
@@ -14,7 +14,7 @@ describe Api::VariantsController, type: :controller do
|
||||
end
|
||||
|
||||
context "as a normal user" do
|
||||
sign_in_as_user!
|
||||
let(:current_api_user) { build(:user) }
|
||||
|
||||
let!(:product) { create(:product) }
|
||||
let!(:variant) do
|
||||
|
||||
Reference in New Issue
Block a user