-
-
Save agibralter/79641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../../spec_helper' | |
describe Admin::BaseController do | |
subject do | |
Class.new(Admin::BaseController) do | |
def index; end | |
end.new | |
end | |
# class FoobarsController < Admin::BaseController | |
# def index; end | |
# end | |
controller_name :foobars | |
before(:all) do | |
# set custom routes | |
ActionController::Routing::Routes.draw do |map| | |
map.connect 'foobars/:action', :controller => 'foobars' | |
end | |
end | |
after(:all) do | |
# reset routes | |
ActionController::Routing::Routes.reload! | |
end | |
describe "filtering" do | |
def do_get | |
get :index | |
end | |
it "should check for admin" do | |
user = mock_user | |
controller.stub!(:current_user).and_return(user) | |
controller.should_receive(:admin?).and_return(true) | |
do_get | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment