Sha256: 6c04d32274677596226b8337dd22e655da2d1a6209870a6f8d56959b8aa9a9c3

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

RSpec.feature 'Managing volume prices' do
  stub_authorization!

  let(:variant) { create(:variant) }

  scenario 'a admin can create and remove volume prices', :js do
    visit spree.edit_admin_product_path(variant.product)
    click_on 'Volume Pricing'
    expect(page).to have_content('Volume Prices')

    fill_in 'variant_volume_prices_attributes_0_name', with: '5 pieces discount'
    select 'Total price', from: 'variant_volume_prices_attributes_0_discount_type'
    fill_in 'variant_volume_prices_attributes_0_range', with: '1..5'
    fill_in 'variant_volume_prices_attributes_0_amount', with: '1'
    click_on 'Update'

    within 'tr.volume_price.fields' do
      expect(page).to have_field('variant_volume_prices_attributes_0_name', with: '5 pieces discount')
      page.find('a[data-action="remove"]').click
      expect(page).to_not have_field('variant_volume_prices_attributes_0_name', with: '5 pieces discount')
    end
  end

  scenario 'a admin editing a variant has a new volume price already built for her' do
    visit spree.edit_admin_product_variant_path(product_id: variant.product, id: variant)
    within '#volume_prices' do
      expect(page).to have_field('variant_volume_prices_attributes_0_name')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_volume_pricing-0.2.1 spec/features/manage_volume_prices_feature_spec.rb
solidus_volume_pricing-0.1.1 spec/features/manage_volume_prices_feature_spec.rb