<commit_before>require 'spec_helper'

describe "Product Taxons" do
  stub_authorization!

  context "managing taxons" do
    def selected_taxons
      find("#product_taxon_ids").value.map(&:to_i)
    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_link "Edit"
      end

      selected_taxons.should =~ [taxon_1.id]
      select2("#product_taxons_field", "Clothing")
      click_button "Update"
      selected_taxons.should =~ [taxon_1.id, taxon_2.id]
    end
  end
end<commit_msg>Fix products/edit/taxons_spec<commit_after>require 'spec_helper'

describe "Product Taxons" do
  stub_authorization!

  context "managing taxons" do
    def selected_taxons
      find("#product_taxon_ids").value.map(&:to_i)
    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

      selected_taxons.should =~ [taxon_1.id]
      select2("#product_taxons_field", "Clothing")
      click_button "Update"
      selected_taxons.should =~ [taxon_1.id, taxon_2.id]
    end
  end
end
{'fraction_non_alphanumeric': 0.10972404730617609, 'fraction_numerical': 0.009198423127463863, 'mean_word_length': 3.0397877984084882, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '411338', 'n_tokens_mistral': 521, 'n_tokens_neox': 510, 'n_words': 113}