Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickClark/359415 to your computer and use it in GitHub Desktop.
Save NickClark/359415 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe Admin::SettingsController do
describe "as an administrator" do
before(:each) do
login_admin
end
describe "handling GET index" do
before(:each) do
@setting_1 = mock_model(Setting)
@settings = [@setting_1]
end
def do_get
get :index
end
it "should find all the settings and assign them for the view" do
Setting.should_receive(:find).with(:all).and_return(@setting_1)
do_get
assigns[:settings].should == @settings
end
it "should render the index template" do
do_get
response.should render_template(:index)
end
end
end
describe "as a standard user" do
before(:each) do
login_standard
end
it "should disallow access" do
allowed_actions.should_not == all_actions
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment