<commit_before>require 'rails_helper'

RSpec.describe 'User creates Pendant', js: true do
  let!(:artist) { FactoryGirl.create :artist, name: 'Artist Name' }
  let(:user) { FactoryGirl.create(:user, :with_personal_collection) }

  scenario 'with required info from home page' do
    visit root_path(as: user)
    click_link 'Pendants'
    click_link 'New Pendant'

    fill_select_and_take_first_result 'Who made this pendant?', 'Artist Name'
    fill_select_and_take_first_result 'Select Collection...', 'Personal Collection'
    fill_in 'glass_art_piece_name', with: 'Cool Pendy'
    expect { click_button 'Create Glass art piece' }.to change { GlassArtPiece.count }.by(1)

    expect(page).to have_link 'Cool Pendy'
  end

  context 'when colors exist' do
    let!(:color) { FactoryGirl.create :color, name: 'Fun Color' }

    scenario 'with the color availible' do
      visit root_path(as: user)
      click_link 'Pendants'
      click_link 'New Pendant'

      fill_select_and_take_first_result 'Who made this pendant?', 'Artist Name'
      fill_select_and_take_first_result 'Select Collection...', 'Personal Collection'
      fill_select_and_take_first_result 'What colors is this piece made of?', ''
      fill_in 'glass_art_piece_name', with: 'Cool Pendy'
      expect { click_button 'Create Glass art piece' }.to change { GlassArtPiece.count }.by(1)

      expect(page).to have_link 'Cool Pendy'
      click_link 'Cool Pendy'

      expect(page).to have_content 'Artist Name'
      expect(page).to have_content 'Fun Color'
    end
  end

  private

  def fill_select_and_take_first_result(placeholder, query)
    page.find('.Select-placeholder', text: placeholder).click
    page.find('*:focus').send_keys query
    page.find('.Select-option.is-focused').click
  end
end
<commit_msg>Cut out some link clicks in pendant color spec<commit_after>require 'rails_helper'

RSpec.describe 'User creates Pendant', js: true do
  let!(:artist) { FactoryGirl.create :artist, name: '<NAME>' }
  let(:user) { FactoryGirl.create(:user, :with_personal_collection) }

  scenario 'with required info from home page' do
    visit root_path(as: user)
    click_link 'Pendants'
    click_link 'New Pendant'

    fill_select_and_take_first_result 'Who made this pendant?', 'Artist Name'
    fill_select_and_take_first_result 'Select Collection...', 'Personal Collection'
    fill_in 'glass_art_piece_name', with: 'Cool Pendy'
    expect { click_button 'Create Glass art piece' }.to change { GlassArtPiece.count }.by(1)

    expect(page).to have_link 'Cool Pendy'
  end

  context 'when colors exist' do
    let!(:color) { FactoryGirl.create :color, name: 'Fun Color' }

    scenario 'with the color availible' do
      visit new_my_pendant_path(as: user)

      fill_select_and_take_first_result 'Who made this pendant?', 'Artist Name'
      fill_select_and_take_first_result 'Select Collection...', 'Personal Collection'
      fill_select_and_take_first_result 'What colors is this piece made of?', ''
      fill_in 'glass_art_piece_name', with: 'Cool Pendy'
      expect { click_button 'Create Glass art piece' }.to change { GlassArtPiece.count }.by(1)

      expect(page).to have_link 'Cool Pendy'
      click_link 'Cool Pendy'

      expect(page).to have_content 'Artist Name'
      expect(page).to have_content 'Fun Color'
    end
  end

  private

  def fill_select_and_take_first_result(placeholder, query)
    page.find('.Select-placeholder', text: placeholder).click
    page.find('*:focus').send_keys query
    page.find('.Select-option.is-focused').click
  end
end

{'fraction_non_alphanumeric': 0.10378681626928471, 'fraction_numerical': 0.0011220196353436186, 'mean_word_length': 4.087018544935806, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1547180', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1126, 'n_words': 312}