adds Identity model and migration

This commit is contained in:
David Gil
2015-08-24 19:42:51 +02:00
parent 88eb8a6cc4
commit f0e47ee787
6 changed files with 70 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
require 'rails_helper'
RSpec.describe Identity, type: :model do
let(:identity) { build(:identity) }
it "should be valid" do
expect(identity).to be_valid
end
end

View File

@@ -50,6 +50,26 @@ describe User do
end
end
describe 'OmniAuth' do
describe '#email_provided?' do
it "is false if the email matchs was temporarely assigned by the OmniAuth process" do
subject.email = 'omniauth@participacion-ABCD-twitter.com'
expect(subject.email_provided?).to eq(false)
end
it "is true if the email is not omniauth-like" do
subject.email = 'manuelacarmena@example.com'
expect(subject.email_provided?).to eq(true)
end
it "is true if the user's real email is pending to be confirmed" do
subject.email = 'omniauth@participacion-ABCD-twitter.com'
subject.unconfirmed_email = 'manuelacarmena@example.com'
expect(subject.email_provided?).to eq(true)
end
end
end
describe "administrator?" do
it "is false when the user is not an admin" do
expect(subject.administrator?).to be false