jefflunt
jefflunt

Reputation: 33954

RSpec: undefined local variable or method `activate_authlogic'

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 used 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 => "[email protected]")
    UserSession.create(@admin)
  end

  ...

end

Upvotes: 2

Views: 1527

Answers (1)

jefflunt
jefflunt

Reputation: 33954

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

I needed require 'authlogic/test_case'

Upvotes: 2

Related Questions