これは私のコントローラーです
class IdeasController < ApplicationController
load_and_authorize_resource
def create
@idea = Idea.create params[:idea]
end
end
私のアビリティファイルは
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.confirmed?
can :manage, Idea
end
end
end
しかし、私のspecは作成時に成功を返します
context "when not logged in"do
it "does not be allowed" do
post :create, FactoryGirl.attributes_for(:idea)
response.should_not be_success
end
end
before_filter :authenticate_user!
コントローラーに追加する必要がありますか?