Created
May 19, 2011 02:17
-
-
Save dangalipo/980045 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| describe '#destroy' do | |
| before :each do | |
| stub(HealthProfessional).find(8) { @health_professional } | |
| end | |
| context 'as a user without permissions' do | |
| before :each do | |
| login_as_user! | |
| delete :destroy, :id => 8 | |
| end | |
| it_should_behave_like 'user gets redirected to profile' | |
| end | |
| context 'as a user with permissions' do | |
| before :each do | |
| login_as_admin! | |
| end | |
| it 'redirect to index' do | |
| mock(@health_professional).destroy { true } | |
| stub(@health_professional).persisted? { false } | |
| delete :destroy, :id => 8 | |
| response.should redirect_to manage_health_professionals_url | |
| end | |
| it 'should destroy the health professional object' do | |
| mock(@health_professional).destroy { true } | |
| stub(@health_professional).persisted? { false } | |
| delete :destroy, :id => 8 | |
| end | |
| it 'should display a flash notice' do | |
| mock(@health_professional).destroy { true} | |
| stub(@health_professional).persisted? { false } | |
| delete :destroy, :id => 8 | |
| flash.now[:notice].should == "successfully deleted health professional" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment