<commit_before>Given(/^I have the course ([A-Z]+) (\d+) in my wishlist$/) do |course_dept, course_number|
  course = Course.where(department: course_dept, course_number: course_number).first ||
           FactoryGirl.create(:course, department: course_dept, course_number: course_number)
  WishlistItem.exists?(course: course, user: @current_user) ||
    FactoryGirl.create(:wishlist_item, course: course, user: @current_user)
end

Given(/^I have a course in my wishlist$/) do
  wishlist_item = WishlistItem.where(user: @current_user).first ||
    FactoryGirl.create(:wishlist_item, user: @current_user)
  @course = wishlist_item.course
end

When(/^I view my wishlist$/) do
  step 'I visit "/wishlist"'
end

When(/^I select a course via wishlist search$/) do
  @course = Course.first || FactoryGirl.create(:course)
  step "I fill in \"course_title\" with \"#{@course.to_param}\""
  step 'I click the hidden button "#submit"'
end

When(/^I add it to my wishlist$/) do
  WishlistItem.create(user: @current_user, course: @course)
end

Then(/^I should see that course in my wishlist$/) do
  expect(page).to have_content(@course)
end

Given(/^I do not have the course ([A-Z]+) (\d+) in my wishlist$/) do |course_dept, course_number|<commit_msg>invoke the action, don't touch the db directly<commit_after>Given(/^I have the course ([A-Z]+) (\d+) in my wishlist$/) do |course_dept, course_number|
  course = Course.where(department: course_dept, course_number: course_number).first ||
           FactoryGirl.create(:course, department: course_dept, course_number: course_number)
  WishlistItem.exists?(course: course, user: @current_user) ||
    FactoryGirl.create(:wishlist_item, course: course, user: @current_user)
end

Given(/^I have a course in my wishlist$/) do
  wishlist_item = WishlistItem.where(user: @current_user).first ||
    FactoryGirl.create(:wishlist_item, user: @current_user)
  @course = wishlist_item.course
end

When(/^I view my wishlist$/) do
  step 'I visit "/wishlist"'
end

When(/^I select a course via wishlist search$/) do
  @course = Course.first || FactoryGirl.create(:course)
  step "I fill in \"course_title\" with \"#{@course.to_param}\""
  step 'I click the hidden button "#submit"'
end

When(/^I add it to my wishlist$/) do
  step 'I click the link "Add to my wishlist"'
end

Then(/^I should see that course in my wishlist$/) do
  expect(page).to have_content(@course)
end

Given(/^I do not have the course ([A-Z]+) (\d+) in my wishlist$/) do |course_dept, course_number|
{'fraction_non_alphanumeric': 0.13931144915932747, 'fraction_numerical': 0.0, 'mean_word_length': 4.731651376146789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390897', 'n_tokens_mistral': 858, 'n_tokens_neox': 830, 'n_words': 257}