Sha256: 086166f3301bf92a22910d2efcd07ced676484ad613a784ce405de271243be8d

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

require 'rails_helper'

RSpec.describe "<%= file_name.pluralize %>#index", type: :request do
  context 'basic fetch' do
    let!(:<%= file_name %>1) { create(:<%= file_name %>) }
    let!(:<%= file_name %>2) { create(:<%= file_name %>) }

    it 'serializes the list correctly' do
      jsonapi_get "/<%= api_namespace %>/v1/<%= file_name.pluralize %>"

      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

2 entries across 2 versions & 1 rubygems

Version Path
jsonapi_compliable-0.11.0 lib/generators/jsonapi/templates/index_request_spec.rb.erb
jsonapi_compliable-0.10.9 lib/generators/jsonapi/templates/index_request_spec.rb.erb