Created
May 28, 2013 00:59
-
-
Save acnalesso/5659878 to your computer and use it in GitHub Desktop.
Good or Bad? Poor or Fine?
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 'spec_helper' | |
describe AdminController do | |
# Stubs out, returns true. Logged in as Admin | |
login(true) | |
describe 'GET' do | |
let(:admin) { mock_model(Admin) } | |
describe '#index' do | |
before { Admin.should_receive(:find).with('1').and_return(admin) ; subject } | |
subject { get :index, id: 1 } | |
it { should be_success } | |
it { assigns(:admin).should eq(admin) } | |
it 'does not find an admin' do #is this a good spectation? | |
Admin.should_receive(:find).with('0') | |
.and_return { raise ActiveRecord::RecordNotFound } | |
expect { get :index, id: 0 } | |
.to raise_error(ActiveRecord::RecordNotFound) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment