<commit_before>require 'spec_helper'

describe User do
  describe "user functions" do

    it "tells me what is my most recent application" do
      #create user
      app_year = stub_app_year 2015
      user = FactoryGirl.create(:user)
      app1 = user.applications.create :completed => true, :year => 2014
      app2 = user.applications.create :year => app_year
      expect(user.get_most_recent_application).to be == app2
    end

    it "should return the most recent app for the current year" do
      app_year = stub_app_year 2015
      user = FactoryGirl.create(:user)

      app1 = user.applications.create :year => app_year
      expect(user.get_most_recent_application).to be == app1

      app_year = stub_app_year 2016
      expect(user.get_most_recent_application).to be_nil
    end

  end
end<commit_msg>Rspec tests for sorting users<commit_after>require 'spec_helper'

describe User do
  describe "user functions" do

    it "tells me what is my most recent application" do
      #create user
      app_year = stub_app_year 2015
      user = FactoryGirl.create(:user)
      app1 = user.applications.create :completed => true, :year => 2014
      app2 = user.applications.create :year => app_year
      expect(user.get_most_recent_application).to be == app2
    end

    it "should return the most recent app for the current year" do
      app_year = stub_app_year 2015
      user = FactoryGirl.create(:user)

      app1 = user.applications.create :year => app_year
      expect(user.get_most_recent_application).to be == app1

      app_year = stub_app_year 2016
      expect(user.get_most_recent_application).to be_nil
    end

    it "should return list of users in the correct order" do
      users = [FactoryGirl.create(:user, :email => "<EMAIL>"), FactoryGirl.create(:user, :email => "<EMAIL>"), FactoryGirl.create(:user, :email => "<EMAIL>")]
      expect(User.get_users_by_order(:email)).to be == [users[1], users[2], users[0]]
    end

    it "should format the telephone number in the correct format" do
      user = FactoryGirl.create( :user, :email => "<EMAIL>")
      user.telephone = "5105121234"
      expect(user.format_phone_number).to be == "(510) 512-1234"
    end
  end
end
{'fraction_non_alphanumeric': 0.09873188405797101, 'fraction_numerical': 0.029438405797101448, 'mean_word_length': 3.2893203883495143, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '1518368', 'n_tokens_mistral': 738, 'n_tokens_neox': 662, 'n_words': 197}