<commit_before>require 'rails_helper'

RSpec.describe User, type: :model do
  it { should validate_presence_of(:name) }
end
<commit_msg>Add omniauth relate test for user model<commit_after>require 'rails_helper'

RSpec.describe User, type: :model do
  it { should validate_presence_of(:name) }

  context "sign in with omniauth" do
    let(:exists_user) { FactoryGirl.create(:user) }
    let(:auth_info) {
      OmniAuth::AuthHash.new({
        provider: 'github',
        info: {
          email: '<EMAIL>'
        }
      })
    }

    let(:auth_info_exists) {
      OmniAuth::AuthHash.new({
        provider: 'github',
        info: {
          email: exists_user.email
        }
      })
    }

    it "should create new user when not found" do
      user_count = User.count
      User.from_omniauth(auth_info)
      expect(user_count).not_to eq(User.count)
    end

    it "should return exists user when found" do
      expect(User.from_omniauth(auth_info_exists)).to eq(exists_user)
    end
  end

  context "with default information from session" do
    it "should copy github information"
    it "should copy twitter information"
  end
end

{'fraction_non_alphanumeric': 0.09834638816362054, 'fraction_numerical': 0.0, 'mean_word_length': 2.7828947368421053, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2193795', 'n_tokens_mistral': 372, 'n_tokens_neox': 357, 'n_words': 95}