Sha256: 85a561ab590f4a9b8e8a4ddd3146f6601848479898ac2eae771636c2b861f852

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'New Refund creation', :js do
  stub_authorization!

  let(:order) { create :order_ready_to_ship }
  let(:payment) { order.payments.first }
  let(:amount) { '10.99' }
  let!(:reason) { create :refund_reason }

  it 'creates a new refund' do
    visit spree.new_admin_order_payment_refund_path(order, payment)
    expect(page).not_to have_selector 'td', text: amount
    within '.new_refund' do
      fill_in 'refund_amount', with: amount
      select reason.name, from: 'Reason'
      click_button 'Refund'
    end
    expect(page).to have_content 'Refund has been successfully created!'
    expect(page).to have_selector 'td', text: amount
  end

  it 'disables the button at submit' do
    visit spree.new_admin_order_payment_refund_path(order, payment)
    page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
    within '.new_refund' do
      fill_in 'refund_amount', with: amount
      select reason.name, from: 'Reason'
      click_button 'Refund'
      expect(find('input[type="submit"]')).to be_disabled
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_backend-2.9.6 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.6 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.5 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.4 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.5 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.3 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.2 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.1 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.0 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.9.0.rc.1 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.4 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.3 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.2 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.1 spec/features/admin/orders/new_refund_spec.rb
solidus_backend-2.8.0 spec/features/admin/orders/new_refund_spec.rb