Commit 6390f13e77a98361e739f406a420541781a6592c
1 parent
f877c228
Exists in
master
and in
1 other branch
refactor user show view spec
don't use iVars simplify github button specs
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
spec/views/users/show.html.haml_spec.rb
| ... | ... | @@ -2,12 +2,12 @@ require 'spec_helper' |
| 2 | 2 | |
| 3 | 3 | describe 'users/show.html.haml' do |
| 4 | 4 | let(:user) do |
| 5 | - user = stub_model(User, :created_at => Time.now) | |
| 5 | + stub_model(User, :created_at => Time.now) | |
| 6 | 6 | end |
| 7 | 7 | |
| 8 | 8 | before do |
| 9 | 9 | Errbit::Config.stub(:github_authentication) { true } |
| 10 | - controller.stub(:current_user) { Fabricate(:user) } | |
| 10 | + controller.stub(:current_user) { stub_model(User) } | |
| 11 | 11 | end |
| 12 | 12 | |
| 13 | 13 | context 'with GitHub authentication' do |
| ... | ... | @@ -39,9 +39,8 @@ describe 'users/show.html.haml' do |
| 39 | 39 | |
| 40 | 40 | context 'viewing own user page' do |
| 41 | 41 | before do |
| 42 | - @user = Fabricate(:user) | |
| 43 | - controller.stub!(:current_user).and_return(@user) | |
| 44 | - assign :user, @user | |
| 42 | + controller.stub(:current_user) { user } | |
| 43 | + assign :user, user | |
| 45 | 44 | end |
| 46 | 45 | |
| 47 | 46 | it 'shows link github button when no login or token' do |
| ... | ... | @@ -50,8 +49,9 @@ describe 'users/show.html.haml' do |
| 50 | 49 | end |
| 51 | 50 | |
| 52 | 51 | it 'shows unlink github button when login and token' do |
| 53 | - @user.github_login = 'test_user' | |
| 54 | - @user.github_oauth_token = 'abcdef' | |
| 52 | + user.github_login = 'test_user' | |
| 53 | + user.github_oauth_token = 'abcdef' | |
| 54 | + | |
| 55 | 55 | render |
| 56 | 56 | view.content_for(:action_bar).should include('Unlink GitHub account') |
| 57 | 57 | end | ... | ... |