开发者

RSpec: undefined local variable or method `activate_authlogic'

开发者 https://www.devze.com 2023-04-03 04:34 出处:网络
My _spec file includes the code below, but my test fails with: NameError in \'MembershipsController should allow you to save updates to the notes\'

My _spec file includes the code below, but my test fails with:

NameError in 'MembershipsController should allow you to save updates to the notes'
undefined local variable or method `activate_authlogic' for #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0x107cee930>

I don't understand why activate_authlogic is undefined in this case. I've us开发者_C百科ed this line in TestUnit many times, and the RSpec examples I've read all seem to say that this should work. NOTE: I've also tried adding require 'authlogic' to the top of the _spec file, but it produces an identical error message.

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'ruby-debug'

describe MembershipsController do

  before(:each) do
    activate_authlogic
    @admin = Factory(:admin, :email => "admin@example.com")
    UserSession.create(@admin)
  end

  ...

end


Apparently a misunderstanding on my part. Instead of require 'authlogic'

I needed require 'authlogic/test_case'

0

精彩评论

暂无评论...
验证码 换一张
取 消