Sha256: 32ab296aef6fc35b69c99666c813fd916c08de88dfa0fd73bb7ffeabbcb733bb

Contents?: true

Size: 707 Bytes

Versions: 33

Compression:

Stored size: 707 Bytes

Contents

require 'rails_helper'

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

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

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

    it 'serializes the list correctly' do
      make_request
      expect(json_ids(true)).to match_array([<%= file_name %>1.id, <%= file_name %>2.id])
      assert_payload(:<%= file_name %>, <%= file_name %>1, json_items[0])
      assert_payload(:<%= file_name %>, <%= file_name %>2, json_items[1])
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
jsonapi_compliable-0.11.34 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.33 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.32 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.31 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.30 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.29 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.28 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.27 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.26 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.25 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.24 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.23 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.22 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.21 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.20 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.19 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.18 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.17 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.16 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.11.15 lib/generators/jsonapi/templates/index_request_spec.rb.erb