Sha256: 22ffbfef5cd7d3256a22e55c1127e551e8f56ef7b3e8692a1cb054010030b0bc

Contents?: true

Size: 1.11 KB

Versions: 16

Compression:

Stored size: 1.11 KB

Contents

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, 'X')
      order.considered_risky!
      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

16 entries across 16 versions & 1 rubygems

Version Path
spree_backend-3.1.5 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.4 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.3 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.2 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.10 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.1 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.0 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.0.rc4 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.9 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.0.rc3 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.0.rc2 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.1.0.rc1 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.8 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.7 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.6.1 spec/features/admin/orders/risk_analysis_spec.rb
spree_backend-3.0.6 spec/features/admin/orders/risk_analysis_spec.rb