File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11def login_user
2- @user = User . create! ( username : "test_user" ,
2+ @user = User . create! ( username : "test_user" ,
33 email : "test_user@example.com" ,
44 password : "foobar" ,
55 password_confirmation : "foobar" )
@@ -20,6 +20,13 @@ def create_other_user
2020 login_user unless @user
2121end
2222
23+ Given /^a steve exists$/ do
24+ @steve = User . create! ( username : "steve" ,
25+ email : "steve_user@example.com" ,
26+ password : "foobar" ,
27+ password_confirmation : "foobar" )
28+ end
29+
2330When /^I go to look at my profile page$/ do
2431 visit user_path ( @user )
2532end
@@ -73,3 +80,7 @@ def create_other_user
7380 page . should have_content ( "Test user likes to edit his profile" )
7481end
7582
83+ Then ( /^I should see 'Steve'$/ ) do
84+ @user . following? ( @steve ) . should == true
85+ page . should have_link @steve . username
86+ end
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ Feature: Manage account
33 As a user of this site, I can view and update my profile, see my followers
44
55 Background :
6- Given a logged in user
6+ Given a steve exists
7+ And a logged in user
78
89 Scenario : View my profile
910 When I go to look at my profile page
@@ -23,4 +24,7 @@ Feature: Manage account
2324 When I am following someone
2425 And I click on the number of people I am following on my profile
2526 Then I should see someone I'm following
26-
27+
28+ Scenario : I should always follow steve and vice versa
29+ When I click on the number of people I am following on my profile
30+ Then I should see 'Steve'
Original file line number Diff line number Diff line change 11require 'spec_helper'
22
33describe User do
4-
5- let ( :bob ) { Fabricate ( :user ) }
4+ let ( :bob ) { Fabricate ( :user , :username => 'hacker' ) }
65 let ( :mozart ) { Fabricate ( :user ) }
7-
6+ let ( :hello_world ) { Fabricate ( :program , :author_username => bob . username ) }
7+
88 it 'can be created validly' do
99 bob . should be_valid
1010 mozart . should be_valid
1717 bob . reload
1818 bob . following? ( mozart ) . should be_false
1919 end
20+
21+ describe 'programs' do
22+ it 'should return programs list' do
23+ bob . programs . class . should == Plucky ::Query
24+ hello_world . author_username . should == 'hacker'
25+ bob . username . should == 'hacker'
26+ bob . programs . count . should == 1
27+ bob . programs . first . should == hello_world
28+ end
29+ end
2030end
You can’t perform that action at this time.
0 commit comments