<commit_before>require "test_helper"

class TransactionsControllerTest < ActionController::TestCase

  def setup
    reset_email
    item = create_valid_item
    @order = create_valid_order
    @order_item = OrderItem.create(
      :order_id => @order.id,
      :item_id => item.id,
      :quantity => 1)
  end

  def test_sends_email_on_valid_create
    post(:create, {"transaction"=>{"first_name"=>"FIRST",
                                   "last_name"=>"LAST",
                                   "email"=> "<EMAIL>",
                                   "zipcode"=>"12345",
                                   "result"=>"success"},
                   "stripeToken"=>"tok_<PASSWORD>",
                                  "stripeEmail"=>"<EMAIL>"},
                  {"current_order" => @order})
    assert_equal "Your order is confirmed!", last_email.subject
    assert_equal "<EMAIL>", last_email.to.first
    assert last_email.body.include?("Hello!")
  end

end<commit_msg>fixed nasty email test blowing up build in test teardown/cleanup<commit_after>require_relative "../test_helper"

class TransactionsControllerTest < ActionController::TestCase

  def setup
    Item.destroy_all
    reset_email
    item = create_valid_item(1,"Shazam")
    @order = create_valid_order
    @order_item = OrderItem.create(
      :order_id => @order.id,
      :item_id => item.id,
      :quantity => 1)
  end

  def test_sends_email_on_valid_create
    post(:create, {"transaction"=>{"first_name"=>"FIRST",
                                   "last_name"=>"LAST",
                                   "email"=> "<EMAIL>",
                                   "zipcode"=>"12345",
                                   "result"=>"success"},
                   "stripeToken"=>"tok_<PASSWORD>",
                                  "stripeEmail"=>"<EMAIL>"},
                  {"current_order" => @order})
    assert_equal "Your order is confirmed!", last_email.subject
    assert_equal "<EMAIL>", last_email.to.first
    assert last_email.body.include?("Shazam")
  end

end
{'fraction_non_alphanumeric': 0.1258570029382958, 'fraction_numerical': 0.006366307541625857, 'mean_word_length': 1.9608695652173913, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1881360', 'n_tokens_mistral': 607, 'n_tokens_neox': 574, 'n_words': 103}