Merge branch master into tests

This commit is contained in:
Joshua Arts
2018-06-26 16:48:02 -04:00
66 changed files with 1494 additions and 234 deletions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rails_helper"
describe User, type: :model do
@ -23,8 +25,8 @@ describe User, type: :model do
it { should allow_value("", nil).for(:image) }
it "should convert email to downcase on save" do
user = create(:user, email: "EXAMPLE@EXAMPLE.COM")
expect(user.email).to eq("example@example.com")
user = create(:user, email: "DOWNCASE@DOWNCASE.COM")
expect(user.email).to eq("downcase@downcase.com")
end
context 'is greenlight account' do
@ -57,21 +59,21 @@ describe User, type: :model do
end
context '#from_omniauth' do
let(:auth) {
auth = {
let(:auth) do
{
"uid" => "123456789",
"provider" => "twitter",
"info" => {
"name" => "Test Name",
"nickname" => "username",
"email" => "test@example.com",
"image" => "example.png"
}
"image" => "example.png",
},
}
}
end
it "should create user from omniauth" do
expect {
expect do
user = User.from_omniauth(auth)
expect(user.name).to eq("Test Name")
@ -79,9 +81,7 @@ describe User, type: :model do
expect(user.image).to eq("example.png")
expect(user.provider).to eq("twitter")
expect(user.social_uid).to eq("123456789")
}.to change {
User.count
}.by(1)
end.to change { User.count }.by(1)
end
end