Sha256: 70f3e700d22a63fc10edfa44d8679c7195b5e93fdff32c4a9636f6820db6b181

Contents?: true

Size: 797 Bytes

Versions: 104

Compression:

Stored size: 797 Bytes

Contents

require 'rails_helper'

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

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

    let(:payload) do
      {
        data: {
          id: <%= var %>.id.to_s,
          type: '<%= type %>',
          attributes: {
            # ... your attrs here
          }
        }
      }
    end

    # Replace 'xit' with 'it' after adding attributes
    xit 'updates the resource' do
      expect(<%= resource_class %>).to receive(:find).and_call_original
      expect {
        make_request
        expect(response.status).to eq(200), response.body
      }.to change { <%= var %>.reload.attributes }
    end
  end
end

Version data entries

104 entries across 104 versions & 2 rubygems

Version Path
graphiti-1.0.1 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.0 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.28 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.27 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.26 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.25 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.24 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.23 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.22 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.21 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.19 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.18 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.17 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.16 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.15 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.14 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.12 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.11 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.10 lib/generators/graphiti/templates/update_request_spec.rb.erb
graphiti-1.0.rc.9 lib/generators/graphiti/templates/update_request_spec.rb.erb