我在运行测试时遇到此错误,但它在浏览器中有效!我无法弄清楚。奇怪的是,当它在第142行引用时,它会抱怨第143行!
1) Sign Up signs up user
Failure/Error: click_button 'Sign Up'
NameError:
uninitialized constant UserPlugin
# ./app/decorators/models/refinery/user_decorator.rb:142:in `add_plugin'
# ./app/controllers/community_members_controller.rb:11:in `create'
# ./spec/requests/sign_up_spec.rb:18:in `block (2 levels) in <top (required)>'
141 def add_plugin(name)
142 raise ArgumentException, "Plugin should be the name of the plugin not a Plugin object." if name.is_a?(::Refinery::UserPlugin)
143 plugins << ::Refinery::UserPlugin.find_by_name(name)
144 end
我在_spec顶部的文件顶部尝试了require 'refinery/user_plugin'
;我试过了Refinery::UserPlugin
而只是UserPlugin
。此声明适用于控制台:::Refinery::UserPlugin.find_by_name :refinerycms_blog
这是spec_helper.rb
:http://pastie.org/private/wvwopbzueo6zxmjmzjma
这是有问题的课程FYI:https://github.com/refinery/refinerycms/blob/master/authentication/app/models/refinery/user_plugin.rb
Capybara 2.2.1,Rails 3.2.14,RSpec 2.14.1