Sha256: 78155aa9241d091a3d66401677317716b9a7d9f129fe1217fe31f31c643c29c5

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

require "test_helper"

class TestHelpersTest < ActionDispatch::IntegrationTest
  before do
    @controller = OrdersController.new
    @routes = Dummy::Application.routes
  end

  let(:order) { Order.create!(customer_name: "Customer X", date: Date.today) }
  let(:response_json) { response.parsed_body }

  describe "parameter encoder" do
    it "sends a DELETE request with no body as jsonapi" do
      delete order_path(order), as: :jsonapi
      assert_response :no_content
      assert_operator response.parsed_body, :blank?
    end

    it "sends a DELETE request with a body as jsonapi" do
      delete order_path(order), params: { data: { id: "foo" } }, as: :jsonapi
      assert_response :no_content
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_jsonapi_rails-1.3.0 test/test_helpers_test.rb
simple_jsonapi_rails-1.2.0 test/test_helpers_test.rb
simple_jsonapi_rails-1.1.1 test/test_helpers_test.rb