<commit_before>require "spec_helper"

RSpec.describe GameMailer, :type => :mailer do
  describe "game finished" do
    it "should send an email if the game is finished" do
      # Create the email and store it for further assertions
      charities = [
          {
              :name => 'Against Malaria Foundation',
              :description => "blah",
              :ein => '20-3069841',
              :image_link => 'http://www.againstmalaria.com/images/logo_AMF_Square.png',
              :homepage_link => 'https://www.againstmalaria.com/Default.aspx',
              :donation_link => 'https://www.againstmalaria.com/donate.aspx?GroupID=81'
          },
          {
              :name => 'Schistosomiasis Control Initiative (SCI)',
              :description => "blah",
              :ein => '20-8625442',
              :image_link => 'http://www.goodventures.org/images/grants/SCI-treatment.jpeg',
              :homepage_link => 'https://www.imperial.ac.uk/schistosomiasis-control-initiative',
              :donation_link => 'http://www.imperial.ac.uk/schistosomiasis-control-initiative/donate/'
          }
      ]
      charity_a = Charity.create!(charities[0])
      charity_b = Charity.create!(charities[1])
      game = GivingGame.new(:title => 'Expired Game 1',
                        :description =>'This is an expired game',
                        :tutorial => false,
                        :show_results => false,
                        :expired => true,
                        :is_private => false,
                        :resource_id => "e1",
                        :charity_a_id => charity_a.id,
                        :charity_b_id => charity_b.id)
      game.save!
                         
      user = User.create!(:password => '<PASSWORD>',
                   :password_confirmation => '<PASSWORD>',
                   :giving_games => GivingGame.all,
                   :email => '<EMAIL>',
                   :username => 'Trader_Joe123')

      user.add_to_created_giving_games(game)
<commit_msg>expired must be set to false when first created<commit_after>require "spec_helper"

RSpec.describe GameMailer, :type => :mailer do
  describe "game finished" do
    it "should send an email if the game is finished" do
      # Create the email and store it for further assertions
      charities = [
          {
              :name => 'Against Malaria Foundation',
              :description => "blah",
              :ein => '20-3069841',
              :image_link => 'http://www.againstmalaria.com/images/logo_AMF_Square.png',
              :homepage_link => 'https://www.againstmalaria.com/Default.aspx',
              :donation_link => 'https://www.againstmalaria.com/donate.aspx?GroupID=81'
          },
          {
              :name => 'Schistosomiasis Control Initiative (SCI)',
              :description => "blah",
              :ein => '20-8625442',
              :image_link => 'http://www.goodventures.org/images/grants/SCI-treatment.jpeg',
              :homepage_link => 'https://www.imperial.ac.uk/schistosomiasis-control-initiative',
              :donation_link => 'http://www.imperial.ac.uk/schistosomiasis-control-initiative/donate/'
          }
      ]
      charity_a = Charity.create!(charities[0])
      charity_b = Charity.create!(charities[1])
      game = GivingGame.create!(:title => 'Expired Game 1',
                        :description =>'This is an expired game',
                        :tutorial => false,
                        :show_results => false,
                        :expired => false,
                        :is_private => false,
                        :resource_id => "e1",
                        :charity_a_id => charity_a.id,
                        :charity_b_id => charity_b.id)
                         
      user = User.create!(:password => '<PASSWORD>',
                   :password_confirmation => '<PASSWORD>',
                   :giving_games => GivingGame.all,
                   :email => '<EMAIL>',
                   :username => 'Trader_Joe123')

      user.add_to_created_giving_games(game)

{'fraction_non_alphanumeric': 0.125366568914956, 'fraction_numerical': 0.013196480938416423, 'mean_word_length': 1.6804191224623444, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 63, 'https://': 6, 'lorem ipsum': 0, 'www.': 12, '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': '5503817', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1138, 'n_words': 213}