Rails + rspec + devise = undefined method `authenticate_user! '

ApplicationController:

class ApplicationController < ActionController::Base
  before_filter :authenticate_user!

  protect_from_forgery
end

DashboardsController:

class DashboardsController < ApplicationController
  def index
  end

end

DashboardsControllerSpec:

require 'spec_helper'
describe DashboardsController do
  include Devise::TestHelpers

  describe "GET 'index'" do
    it "returns http success" do
      get 'index'
      response.should be_success
    end
  end
end

Результат:

Failure/Error: get 'index'
     NoMethodError:
       undefined method `authenticate_user!' for #<DashboardsController:0x007fef81f2efb8>

Версия Rails: 3.1.3

Версия Rspec: 2.8.0

Версия Devise: 1.5.3

Примечание. Я также создал файл support / deviser.rb, но это не помогает. Есть идеи?

8
задан 7elephant 11 January 2012 в 12:34
поделиться