我开始为Solidus创建多个供应商权限。 我使用了其他权限集之一作为起点,但我遗漏了一件至关重要的事情。
如您所见,我的测试失败了:
$ bundle exec rspec spec/models/spree/permission_sets/multi_vendor_spec.rb
multi_vendor_spec.rb:3:in `<top (required)>':
uninitialized constant Spree::PermissionSets::MultiVendor (NameError)
from gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `load'
from gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files'
from gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `each'
from gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in `load_spec_files'
from gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in `setup'
from gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in `run'
from gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
from gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
from gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
from bin/rspec:23:in `load'
from bin/rspec:23:in `<main>'
from bin/ruby_executable_hooks:15:in `eval'
from bin/ruby_executable_hooks:15:in `<main>'
你能看出为什么Spree :: PermissionSets :: MultiVendor被报告为未初始化吗?
干杯, 马丁
答案 0 :(得分:0)
修复是添加
require 'spree/permission_sets/multi_vendor'
到 spree / permission_sets.rb