[rspec-users] Anonymous Subclass of ActionController::Base

amkirwan amkirwan at gmail.com
Wed Mar 30 12:04:57 EDT 2011


I'm trying to spec a subclass of ActionController::Base using an
anonymous subclass but I am running into errors but I am receiving a
uninitialized constant StubResource

Here is my base class

class Admin::BaseController < ApplicationController
  before_filter :etherweb_site

  load_and_authorize_resource

  layout "admin/admin"

  protected

  def etherweb_site

  end
end

Spec:
require File.expand_path(File.dirname(__FILE__) + '/../../
spec_helper')

describe "Admin::BaseController" do
  let(:current_user) { logged_in(:role? => true) }

  controller(Admin::BaseController) do
    def index
      render :nothing => true
    end
  end

  before(:each) do
    cas_faker(current_user.username)
  end

  describe "cms_site before_filter" do
    it "should receive before_filter cms_site" do
      controller.should_receive(:etherweb_site)
      get :index
    end
  end
end


More information about the rspec-users mailing list