Sha256: bb1ab6a118e09e0f0ec81bd8011f7a7b6bb57b428710d42e8ccaeb4f4cbee1a3
Contents?: true
Size: 1.51 KB
Versions: 10
Compression:
Stored size: 1.51 KB
Contents
describe Spotlight::TagsController, type: :controller do routes { Spotlight::Engine.routes } let(:exhibit) { FactoryGirl.create(:exhibit) } describe 'when not signed in' do describe 'GET index' do it 'redirects to sign inl' do get :index, exhibit_id: exhibit expect(response).to redirect_to main_app.new_user_session_path end end end describe 'when signed in as a curator' do before { sign_in FactoryGirl.create(:exhibit_curator, exhibit: exhibit) } describe 'GET index' do it 'is successful' do expect(controller).to receive(:add_breadcrumb).with('Home', exhibit) expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit)) expect(controller).to receive(:add_breadcrumb).with('Tags', exhibit_tags_path(exhibit)) get :index, exhibit_id: exhibit expect(response).to be_successful expect(assigns[:tags]).to eq [] expect(assigns[:exhibit]).to eq exhibit end it 'has a json serialization' do get :index, exhibit_id: exhibit, format: 'json' expect(response).to be_successful end end describe 'DELETE destroy' do let!(:tagging) { FactoryGirl.create(:tagging, tagger: exhibit) } it 'is successful' do expect do delete :destroy, exhibit_id: exhibit, id: tagging.tag end.to change { ActsAsTaggableOn::Tagging.count }.by(-1) expect(response).to redirect_to exhibit_tags_path(exhibit) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems