diff options
author | Jerome Dalbert <jerome@rentify.com> | 2014-01-18 19:07:00 +0000 |
---|---|---|
committer | Jerome Dalbert <jerome@rentify.com> | 2014-01-18 19:15:10 +0000 |
commit | 2e3f250d4516c92adce5511747419d7f1fe04b97 (patch) | |
tree | bdf7a0dc744a55a3b96a10131baebd996e5b9d79 /spec | |
parent | dba982403b7b894d2096ea61b89a247060eefe57 (diff) | |
download | gitlab-ce-2e3f250d4516c92adce5511747419d7f1fe04b97.tar.gz |
Add website url to user
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 94bd19f5900..c33b6879cec 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -41,6 +41,8 @@ # confirmed_at :datetime # confirmation_sent_at :datetime # unconfirmed_email :string(255) +# hide_no_ssh_key :boolean default(FALSE) +# website_url :string(255) default(""), not null # require 'spec_helper' @@ -293,4 +295,48 @@ describe User do user.avatar_type.should == ["only images allowed"] end end + + describe '#full_website_url' do + let(:user) { create(:user) } + + it 'begins with http if website url omits it' do + user.website_url = 'test.com' + + expect(user.full_website_url).to eq 'http://test.com' + end + + it 'begins with http if website url begins with http' do + user.website_url = 'http://test.com' + + expect(user.full_website_url).to eq 'http://test.com' + end + + it 'begins with https if website url begins with https' do + user.website_url = 'https://test.com' + + expect(user.full_website_url).to eq 'https://test.com' + end + end + + describe '#short_website_url' do + let(:user) { create(:user) } + + it 'does not begin with http if website url omits it' do + user.website_url = 'test.com' + + expect(user.short_website_url).to eq 'test.com' + end + + it 'does not begin with http if website url begins with http' do + user.website_url = 'http://test.com' + + expect(user.short_website_url).to eq 'test.com' + end + + it 'does not begin with https if website url begins with https' do + user.website_url = 'https://test.com' + + expect(user.short_website_url).to eq 'test.com' + end + end end |