<commit_before>require File.expand_path('../../spec_helper', __FILE__)

module Pod::PushApp
  describe "Owner" do
    before do
      @owner = Owner.create(:email => '<EMAIL>', :name => 'Jenny')
    end

    it "coerces to YAML" do
      yaml = YAML.load(@owner.to_yaml)
      yaml.keys.sort.should == %w(created_at email id name)
    end
  end<commit_msg>[App] Make sure find or create for owners works properly.<commit_after>require File.expand_path('../../spec_helper', __FILE__)

module Pod::PushApp
  describe "Owner" do
    before do
      @owner = Owner.create(:email => '<EMAIL>', :name => 'Jenny')
    end

    it "coerces to YAML" do
      yaml = YAML.load(@owner.to_yaml)
      yaml.keys.sort.should == %w(created_at email id name)
    end

    it "finds itself with an email address" do
      owner = Owner.find_or_create_by_email(@owner.email)
      owner.should.not.be.new
      owner.email.should == @owner.email
    end

    it "creates itself with an email address" do
      email = '<EMAIL>'
      owner = Owner.find_or_create_by_email(email)
      owner.should.not.be.new
      owner.email.should == email
    end

    it "normalizes the email address when finding by email address" do
      owner = Owner.find_or_create_by_email(" #{@owner.email.upcase} ")
      owner.should.not.be.new
      owner.email.should == @owner.email
    end

    it "normalizes the email address when creating by email address" do
      email = '<EMAIL>'
      owner = Owner.find_or_create_by_email(" #{email.upcase} ")
      owner.should.not.be.new
      owner.email.should == email
    end
  end
{'fraction_non_alphanumeric': 0.12225705329153605, 'fraction_numerical': 0.0, 'mean_word_length': 2.8090692124105012, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '6309033', 'n_tokens_mistral': 531, 'n_tokens_neox': 509, 'n_words': 136}