Sha256: 01d1cbd4090f02a6a16fca86822ef31b176a46182c50e4e623811326eb3011c1

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Rearview::User do
  describe 'factory' do
    it 'should be valid' do
      expect { FactoryGirl.create(:user) }.not_to raise_error
      expect( FactoryGirl.create(:user).valid? ).to be_true
    end
  end
  describe 'validations' do
    let!(:first_user) { FactoryGirl.build(:user) }
    it { should validate_presence_of(:email) }
    it { should validate_uniqueness_of(:email) }
  end
  describe '.valid_google_oauth2_email?' do
    it "should not be valid unless an email is present" do
      expect(Rearview::User.valid_google_oauth2_email?(nil)).to be_false
    end
    it "should not be valid unless :matching_emails is present" do
      Rearview.config.authentication.delete(:matching_emails)
      expect(Rearview::User.valid_google_oauth2_email?("foo@foo.com")).to be_false
    end
    it "should not be valid unless it matches the :matching_emails regexp" do
      Rearview.config.authentication[:matching_emails] = /@mycompany\.com$/
      expect(Rearview::User.valid_google_oauth2_email?("foo@foo.com")).to be_false
      expect(Rearview::User.valid_google_oauth2_email?("foo@mycompany.com")).to be_true
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby spec/models/user_spec.rb
rearview-1.2.2.rc.2-jruby spec/models/user_spec.rb
rearview-1.2.2.rc.1-jruby spec/models/user_spec.rb
rearview-1.2.1-jruby spec/models/user_spec.rb
rearview-1.2.0-jruby spec/models/user_spec.rb
rearview-1.1.2-jruby spec/models/user_spec.rb
rearview-1.1.1-jruby spec/models/user_spec.rb
rearview-1.1.0-jruby spec/models/user_spec.rb
rearview-1.0.3.rc.4-jruby spec/models/user_spec.rb
rearview-1.0.3.rc.3-jruby spec/models/user_spec.rb
rearview-1.0.3.rc.2-jruby spec/models/user_spec.rb
rearview-1.0.3.rc.1-jruby spec/models/user_spec.rb
rearview-1.0.2-jruby spec/models/user_spec.rb
rearview-1.0.2.rc.4-jruby spec/models/user_spec.rb
rearview-1.0.2.rc.3-jruby spec/models/user_spec.rb
rearview-1.0.2.rc.2-jruby spec/models/user_spec.rb
rearview-1.0.2.rc.1-jruby spec/models/user_spec.rb