Sha256: 8e5d15787cab544b6f7a4612b014d5617fc028c565c8a902cd53bafbd10d0677

Contents?: true

Size: 891 Bytes

Versions: 7

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper'

describe Spree::Admin::ReimbursementsHelper, type: :helper do
  describe '.reimbursement_status_color' do
    subject { helper.reimbursement_status_color(reimbursement) }

    let(:reimbursement) do
      Spree::Reimbursement.new(reimbursement_status: status)
    end

    context 'when status is reimbursed' do
      let(:status) { 'reimbursed' }
      it { is_expected.to eq 'success'}
    end

    context 'when status is pending' do
      let(:status) { 'pending' }
      it { is_expected.to eq 'notice'}
    end

    context 'when status is pending' do
      let(:status) { 'errored' }
      it { is_expected.to eq 'error'}
    end

    context 'when status is not valid' do
      let(:status) { 'noop' }

      it 'should raise an error' do
        expect{ subject }.to raise_error(RuntimeError, "unknown reimbursement status: noop")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_backend-1.2.3 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.2 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.1 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.0 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.0.rc2 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.0.rc1 spec/helpers/admin/reimbursements_helper_spec.rb
solidus_backend-1.2.0.beta1 spec/helpers/admin/reimbursements_helper_spec.rb