Sha256: 379c260ccb54badd0618c3da34d132f9c02f682a8ea2bff6c1ce08ab3f48e844

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe "Variants", type: :feature, js: true do
  stub_authorization!

  let(:product) { create(:product_with_option_types, price: "1.99", cost_price: "1.00", weight: "2.5", height: "3.0", width: "1.0", depth: "1.5") }

  context "creating a new variant" do
    it "should allow an admin to create a new variant" do
      product.options.each do |option|
        create(:option_value, option_type: option.option_type)
      end

      visit spree.admin_products_path
      within_row(1) { click_icon :edit }
      click_link "Variants"
      click_on "Add One"
      expect(find('input#variant_price').value).to eq("1.99")
      expect(find('input#variant_cost_price').value).to eq("1.00")
      expect(find('input#variant_weight').value).to eq("2.50")
      expect(find('input#variant_height').value).to eq("3.00")
      expect(find('input#variant_width').value).to eq("1.00")
      expect(find('input#variant_depth').value).to eq("1.50")
      expect(page).to have_select('variant[tax_category_id]')
    end
  end

  context "listing variants" do
    context "currency displaying" do
      context "using Russian Rubles" do
        before do
          Spree::Config[:currency] = "RUB"
        end

        let!(:variant) do
          create(:variant, product: product, price: 19.99)
        end

        # Regression test for #2737
        context "uses руб as the currency symbol" do
          it "on the products listing page" do
            visit spree.admin_product_variants_path(product)
            within_row(1) { expect(page).to have_content("19.99 ₽") }
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_backend-3.0.7 spec/features/admin/products/variant_spec.rb
spree_backend-3.0.6.1 spec/features/admin/products/variant_spec.rb
spree_backend-3.0.6 spec/features/admin/products/variant_spec.rb