Sha256: 5573185871b2a1acea9072ad03933f665d315772ea54dfb7188d1f5d011683dc
Contents?: true
Size: 860 Bytes
Versions: 31
Compression:
Stored size: 860 Bytes
Contents
RSpec.shared_examples 'a requests 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' } get polymorphic_path(factory.to_s.pluralize) expect(response).to have_http_status(:success) end it '#destroy' do entity # touch expect { delete polymorphic_path(entity) }.to change(entity.class, :count).by(-1) end context 'json' do it '#index' do entities_list get polymorphic_path(factory.to_s.pluralize, format: "json") expect(response).to have_http_status(:success) end it '#show' do get polymorphic_path(entity) expect(response).to have_http_status(:success) expect(response.body).to include "id", entity.id.to_s end end end
Version data entries
31 entries across 31 versions & 1 rubygems