<commit_before>Given /^I have the following to\-do items:$/ do |table|
  table.hashes.each do |hash|
    ToDoItem.create!(hash)
  end
end


# Extended Web Steps

When /^I fill in the "([^"]*)" of the edited item with "([^"]*)"$/ do |field, new_description|
  with_scope("#edit_row.to_do_item") do
    fill_in("to_do_item[#{field.downcase}]", :with => new_description)
  end
end

When /^I click on the to\-do item "([^"]*)"$/ do |description|
  to_do_item = ToDoItem.find_by_description(description)
  selector = "#to_do_item_#{to_do_item.id}"
  find(selector).click
end

When /^I follow "([^"]*)" within the to\-do item "([^"]*)"$/ do |link, description|
  to_do_item = ToDoItem.find_by_description(description)
  evaluate_script('window.confirm = function() { return true; }') # confirm the modal
  with_scope("#to_do_item_#{to_do_item.id}") do
    click_link(link)
  end
end

Then /^there should be (\d+) To Do Items?$/ do |n|
  with_scope("#to_do_items") do
    assert_equal n.to_i, all('.to_do_item').length
  end
  assert_equal n.to_i, ToDoItem.count
end<commit_msg>wait for the server to do its business<commit_after>Given /^I have the following to\-do items:$/ do |table|
  table.hashes.each do |hash|
    ToDoItem.create!(hash)
  end
end


# Extended Web Steps

When /^I fill in the "([^"]*)" of the edited item with "([^"]*)"$/ do |field, new_description|
  with_scope("#edit_row.to_do_item") do
    fill_in("to_do_item[#{field.downcase}]", :with => new_description)
  end
end

When /^I click on the to\-do item "([^"]*)"$/ do |description|
  to_do_item = ToDoItem.find_by_description(description)
  selector = "#to_do_item_#{to_do_item.id}"
  find(selector).click
end

When /^I follow "([^"]*)" within the to\-do item "([^"]*)"$/ do |link, description|
  to_do_item = ToDoItem.find_by_description(description)
  evaluate_script('window.confirm = function() { return true; }') # confirm the modal
  with_scope("#to_do_item_#{to_do_item.id}") do
    click_link(link)
  end
end

Then /^there should be (\d+) To Do Items?$/ do |n|
  sleep(1.0/5.0)
  with_scope("#to_do_items") do
    assert_equal n.to_i, all('.to_do_item').length
  end
  assert_equal n.to_i, ToDoItem.count
end
{'fraction_non_alphanumeric': 0.1662087912087912, 'fraction_numerical': 0.0018315018315018315, 'mean_word_length': 4.4625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '252121', 'n_tokens_mistral': 836, 'n_tokens_neox': 811, 'n_words': 201}