我有一个 auth 方法,想把它放在我的 application_controller 中。
class ApplicationController < ActionController::Base
helper_method :check_cred
def check_cred
"within check cred"
end
但如果我这样做
require 'spec_helper'
describe ApplicationController do
it 'should check_cred', task050: true do
check_cred.should == 'within check cred'
end
end
我得到:
undefined local variable or method `check_cred' for #<RSpec::Core::ExampleGroup::Nested_9:0x007ff5e3e40558>
我将如何调用这样的方法进行测试?
谢谢