Sha256: 2004cdff618ac8892d854a2cb24725024839ab0ee82e463ea1a982b2175c85a2

Contents?: true

Size: 636 Bytes

Versions: 12

Compression:

Stored size: 636 Bytes

Contents

require 'rails_helper'

RSpec.describe "<%= type %>#index", type: :request do
  let(:params) { {} }

  subject(:make_request) do
    jsonapi_get "/<%= api_namespace %>/v1/<%= type %>", params: params
  end

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

    it 'works' do
      expect(<%= resource_class %>).to receive(:all).and_call_original
      make_request
      expect(response.status).to eq(200)
      expect(d.map(&:jsonapi_type).uniq).to eq(['<%= type %>'])
      expect(d.map(&:id)).to match_array([<%= var %>1.id, <%= var %>2.id])
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
graphiti-1.0.alpha.18 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.17 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.16 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.15 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.14 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.12 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.11 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.10 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.9 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.8 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.7 lib/generators/graphiti/templates/index_request_spec.rb.erb
graphiti-1.0.alpha.6 lib/generators/graphiti/templates/index_request_spec.rb.erb