Sha256: 53ebc44fffc7bdc3a61855e76b8a8d96f2ad40d653ce409dbbc3045a95042509

Contents?: true

Size: 1.11 KB

Versions: 47

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'Order Risk Analysis', type: :feature do
  stub_authorization!

  let!(:order) do
    create(:completed_order_with_pending_payment)
  end

  def visit_order
    visit spree.admin_path
    click_link 'Orders'
    within_row(1) do
      click_link order.number
    end
  end

  context "the order is considered risky" do
    before do
      allow_any_instance_of(Spree::Admin::BaseController).to receive_messages try_spree_current_user: create(:user)

      order.payments.first.update_column(:avs_response, 'N')
      visit_order
    end

    it "displays 'Risk Analysis' box" do
      expect(page).to have_content 'Risk Analysis'
    end

    it "can be approved" do
      click_button('Approve')
      expect(page).to have_content 'Approver'
      expect(page).to have_content 'Approved at'
      expect(page).to have_content 'Status: Complete'
    end
  end

  context "the order is not considered risky" do
    before do
      visit_order
    end

    it "does not display 'Risk Analysis' box" do
      expect(page).to_not have_content 'Risk Analysis'
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.8.4 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.8.3 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.7.2 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.6.4 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.8.2 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.8.1 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.6.3 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.8.0 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.7.1 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend-2.6.2 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.14 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.13 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.12 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.11 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.10 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.9 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.8 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.7 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.6 spec/features/admin/orders/risk_analysis_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.5 spec/features/admin/orders/risk_analysis_spec.rb