Commit ff21f967f9305bc0f26b264f73c70220341d6166
Committed by
Vasiliy Ermolovich
1 parent
b211da43
Exists in
master
and in
1 other branch
show github login on user page
Showing
2 changed files
with
32 additions
and
0 deletions
Show diff stats
app/views/users/show.html.haml
... | ... | @@ -12,6 +12,10 @@ |
12 | 12 | %tr |
13 | 13 | %th Username |
14 | 14 | %td.main= @user.username |
15 | + - if Errbit::Config.github_authentication && @user.github_login.present? | |
16 | + %tr | |
17 | + %th GitHub | |
18 | + %td.main= link_to @user.github_login, "https://github.com/#{@user.github_login}" | |
15 | 19 | %tr |
16 | 20 | %th Token |
17 | 21 | %td= @user.authentication_token | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +require 'spec_helper' | |
2 | + | |
3 | +describe 'users/show.html.haml' do | |
4 | + let(:user) do | |
5 | + user = stub_model(User, :created_at => Time.now) | |
6 | + end | |
7 | + | |
8 | + context 'with github auth' do | |
9 | + before do | |
10 | + Errbit::Config.stub(:github_authentication) { true } | |
11 | + end | |
12 | + | |
13 | + it 'shows github login' do | |
14 | + user.github_login = 'test_user' | |
15 | + assign :user, user | |
16 | + render | |
17 | + rendered.should match(/GitHub/) | |
18 | + rendered.should match(/test_user/) | |
19 | + end | |
20 | + | |
21 | + it 'does not show github if blank' do | |
22 | + user.github_login = ' ' | |
23 | + assign :user, user | |
24 | + render | |
25 | + rendered.should_not match(/GitHub/) | |
26 | + end | |
27 | + end | |
28 | +end | ... | ... |