Sha256: f57b3e7087b5c57b94a84829cb3093210c0cd68cf652d2694a1360f1213cfd86
Contents?: true
Size: 692 Bytes
Versions: 12
Compression:
Stored size: 692 Bytes
Contents
require 'rails_helper' RSpec.describe "<%= type %>#create", type: :request do subject(:make_request) do jsonapi_post "/<%= api_namespace %>/v1/<%= type %>", payload end describe 'basic create' do let(:payload) do { data: { type: '<%= type %>', attributes: { # ... your attrs here } } } end it 'works' do expect(<%= resource_class %>).to receive(:build).and_call_original expect { make_request }.to change { <%= model_class %>.count }.by(1) <%= var %> = <%= model_class %>.last # assert on properties expect(response.status).to eq(201) end end end
Version data entries
12 entries across 12 versions & 1 rubygems