Sha256: 285735d7a9ebb98c086f9a4c8c1bd9b59f097338c7cb8b16b3650025bfcad21b

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Backend - Entries (JSON)", type: :request do
  before { stub_authorization! }

  describe "POST /backend/collections/:id/entries/sort (#sort)" do
    let(:collection) { create(:collection, slug: "amazing") }

    let(:entry_a) do
      create(:entry, collection: collection, value: { slug: "first" })
    end
    let(:entry_b) do
      create(:entry, collection: collection, value: { slug: "second" })
    end

    before { create(:field, collection: collection, slug: "slug") }

    describe "with valid attributes" do
      it "returns 202 status code" do
        post "/backend/collections/amazing/entries/sort",
             headers: { accept: "application/json" },
             params: { collection_entry: { sort: {
               id: entry_a.id, position: "1"
             } } }

        expect(response).to have_http_status(:accepted)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/requests/backend/entries_spec.rb