Sha256: d343d2b35ad9733988dbfd2bde3bd1675d34a39d202e450e2a2fe52050a53540

Contents?: true

Size: 631 Bytes

Versions: 34

Compression:

Stored size: 631 Bytes

Contents

require 'rails_helper'

RSpec.describe "<%= type %>#destroy", type: :request do
  subject(:make_request) do
    jsonapi_delete "<%= api_namespace %>/<%= type %>/#{<%= var %>.id}"
  end

  describe 'basic destroy' do
    let!(:<%= var %>) { create(:<%= var %>) }

    it 'updates the resource' do
      expect(<%= resource_class %>).to receive(:find).and_call_original
      expect { make_request }.to change { <%= model_class %>.count }.by(-1)
      expect { <%= var %>.reload }
        .to raise_error(ActiveRecord::RecordNotFound)
      expect(response.status).to eq(200)
      expect(json).to eq('meta' => {})
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
graphiti-1.0.rc.4 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.rc.3 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.rc.2 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.rc.1 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.23 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.22 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.21 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.20 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.19 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.18 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.17 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.16 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.15 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.14 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.13 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.12 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.11 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.10 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.9 lib/generators/graphiti/templates/destroy_request_spec.rb.erb
graphiti-1.0.beta.8 lib/generators/graphiti/templates/destroy_request_spec.rb.erb