Sha256: d9370352e690fcf1fe4fe197f46e679e7aef46e1bc4b47206a205e9aa178b8bf

Contents?: true

Size: 936 Bytes

Versions: 5

Compression:

Stored size: 936 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(200)
      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(400)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-0.2.2 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.2.1 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.2.0 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.1.0 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb
solidus_paypal_commerce_platform-0.0.1 spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb