Sha256: 444225e27bb9e111c80c75684a18d4d619409b31fc9b4ac5bfcd64a372c1cebe

Contents?: true

Size: 651 Bytes

Versions: 4

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Spree::BaseHelper, type: :helper do
  include described_class

  context 'volume pricing' do
    before do
      @variant = create :variant, price: 10
      @variant.volume_prices.create! amount: 1, discount_type: 'dollar', range: '(10+)'
    end

    it 'gives discounted price' do
      expect(display_volume_price(@variant, 10)).to eq '$9.00'
    end

    it 'gives discount percent' do
      expect(display_volume_price_earning_percent(@variant, 10)).to eq '10'
    end

    it 'gives discount amount' do
      expect(display_volume_price_earning_amount(@variant, 10)).to eq '$1.00'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_volume_pricing-1.2.0 spec/helpers/base_helper_spec.rb
solidus_volume_pricing-1.1.1 spec/helpers/base_helper_spec.rb
solidus_volume_pricing-1.1.0 spec/helpers/base_helper_spec.rb
solidus_volume_pricing-1.0.0 spec/helpers/base_helper_spec.rb