Replace usage of helper method with a more simple approach

This commit is contained in:
Luis Ramos
2020-08-31 16:56:48 +01:00
parent a029a86f0d
commit b872bf49c5
2 changed files with 1 additions and 12 deletions

View File

@@ -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) { ... }

View File

@@ -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