Sha256: 8f3cc64f8d71ca423edffafca82d52038ddd4b1431efa45307bec6a678a336ae
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
RSpec.shared_examples 'a controller actions' do |factory| let(:entity) { FactoryBot.create(factory) } let(:entities_list) { FactoryBot.create_list(factory, 3) } it '#index' do entities_list get :index, params: { use_route: 'admin' } expect(response).to have_http_status(:success) end it '#destroy' do entity # touch expect { delete :destroy, params: { id: entity } }.to change(subject, :count).by(-1) end context 'json' do it '#index' do entities_list get :index, params: { use_route: 'admin', format: 'json' } expect(response).to have_http_status(:success) end it '#show' do get :show, params: {id: entity, format: 'json'} expect(response).to have_http_status(:success) expect(response.body).to include %Q{"id":#{entity.id}} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
symphonia-2.1.8 | spec/support/shared_controllers.rb |
symphonia-2.1.7 | spec/support/shared_controllers.rb |