Add controller tests for admin::versions#index

This commit is contained in:
Nishanth Vijayan 2016-08-06 18:48:36 +05:30
parent 614da6003b
commit 71c8dd4127

View file

@ -97,5 +97,20 @@ describe Admin::VersionsController do
expect(flash[:error]).to match('Revert failed. Attribute missing or invalid') expect(flash[:error]).to match('Revert failed. Attribute missing or invalid')
end end
end end
describe 'GET #index' do
it 'raises error if conference_id is invalid' do
sign_in admin
get :index, conference_id: 88
expect(flash[:error]).to match('Conference with ID 88 does not exist!')
end
it 'raises error if user is not an organizer of specified conference' do
user = create(:user)
sign_in user
get :index, conference_id: conference.id
expect(flash[:alert]).to match('You are not authorized to access this area.')
end
end
end end
end end