Sha256: 83d9f5dff897e6bc86bf772549d618e88d29e3136e716399eda12a3fbd003749

Contents?: true

Size: 1.72 KB

Versions: 7

Compression:

Stored size: 1.72 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe "Variants", :type => :feature 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_path
      click_nav "Products"
      within_row(1) { click_icon :edit }
      click_link "Variants"
      click_on "New Variant"
      expect(page).to have_field('variant_price', with: "1.99")
      expect(page).to have_field('variant_cost_price', with: "1.00")
      expect(page).to have_field('variant_weight', with: "2.50")
      expect(page).to have_field('variant_height', with: "3.00")
      expect(page).to have_field('variant_width', with: "1.00")
      expect(page).to have_field('variant_depth', with: "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 https://github.com/spree/spree/issues/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

7 entries across 7 versions & 1 rubygems

Version Path
solidus_backend-1.2.3 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.2 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.1 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.0 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.0.rc2 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.0.rc1 spec/features/admin/products/variant_spec.rb
solidus_backend-1.2.0.beta1 spec/features/admin/products/variant_spec.rb