Sha256: bfb1da72963853a69a555be5cc1e1d43181e316f6b4a244711b3a5c5cf4d2f16

Contents?: true

Size: 978 Bytes

Versions: 7

Compression:

Stored size: 978 Bytes

Contents

require 'solidus_paypal_commerce_platform_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

7 entries across 7 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-1.0.3 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.2 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.1 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.0 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta3 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta2 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta1 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb