运行Rails控制器的单个RSpec文件的未定义方法\'action\'
||
我有一个特殊的情况-rspec文件在独立运行时会失败,但是在作为整个套件的一部分运行时会运行正常。
Failure/Error: visit oauth_callback_path
NoMethodError:
undefined method `action\' for MyController:Class
# <internal:prelude>:10:in `synchronize\'
# ./spec/requests/login_spec.rb:xx:in `block (5 levels) in <top (required)>\'
# ./spec/requests/login_spec.rb:xx:in `block (4 levels) in <top (required)>\'
简化规格:
require \'spec_helper\'
class MyController
def oauth_response
sign_in(
ENV[\'TEST_ACCESS_TOKEN\'],
ENV[\'TEST_ACCESS_SECRET\'])
redirect_to root_path
end
end
describe \'logging in\' do
it \'login\' do
visit oauth_callback_path
response.should be_success
end
end
没有找到相关结果
已邀请:
2 个回复
替秀宝
没有扩展
。这就是为什么未为
定义方法
的原因。
坛沤疲撑拆