Sha256: 3863a1908d5144a556b7e607963b2ef6bbd0d75694dc0cf43c28e8fcaaa32402

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe "Product Taxons", :type => :feature do
  stub_authorization!

  after do
    Capybara.ignore_hidden_elements = true
  end

  before do
    Capybara.ignore_hidden_elements = false
  end

  context "managing taxons" do
    def selected_taxons
      find("#product_taxon_ids").value.split(',').map(&:to_i).uniq
    end

    it "should allow an admin to manage taxons", :js => true do
      taxon_1 = create(:taxon)
      taxon_2 = create(:taxon, :name => 'Clothing')
      product = create(:product)
      product.taxons << taxon_1

      visit spree.admin_path
      click_link "Products"
      within("table.index") do
        click_icon :edit
      end

      expect(find(".select2-search-choice").text).to eq(taxon_1.name)
      expect(selected_taxons).to match_array([taxon_1.id])

      select2_search "Clothing", :from => "Taxons"
      click_button "Update"
      expect(selected_taxons).to match_array([taxon_1.id, taxon_2.id])

      # Regression test for #2139
      expect(page).to have_css(".select2-search-choice", text: taxon_1.name)
      expect(page).to have_css(".select2-search-choice", text: taxon_2.name)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_backend-1.0.4 spec/features/admin/products/edit/taxons_spec.rb
solidus_backend-1.1.2 spec/features/admin/products/edit/taxons_spec.rb
solidus_backend-1.0.3 spec/features/admin/products/edit/taxons_spec.rb
solidus_backend-1.1.1 spec/features/admin/products/edit/taxons_spec.rb