Sha256: 07c6b6e2ee7d0a7e29e1f573ba0e7221e844c749590418d70da0a9b1cfec68f5

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'

RSpec.describe SolidusPaypalCommercePlatform::OrdersController, type: :request do
  stub_authorization!
  let(:order) { create(:order_with_line_items) }

  describe "GET /solidus_paypal_commerce_platform/verify_total" do
    context "when the amount is correct" do
      it "passes" do
        params = {
          order_id: order.number,
          paypal_total: order.total,
          format: :json
        }

        get solidus_paypal_commerce_platform.verify_total_path, params: params

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

    context "when the amount is incorrect" do
      it "fails" do
        params = {
          order_id: order.number,
          paypal_total: order.total - 1,
          format: :json
        }

        get solidus_paypal_commerce_platform.verify_total_path, params: params

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-0.3.2 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.3.1 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.3.0 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb