Skip to content

Commit bc3cda6

Browse files
committed
First version where it's fixed
1 parent 0ad74ae commit bc3cda6

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

app/controllers/users_controller.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,20 @@ def unfollow
2323
end
2424

2525
def following
26-
@user = User.first(:id => params[:user_id])
26+
puts "called"
27+
@user = User.first(:username => params[:user_id])
28+
puts "@user: #{@user}"
2729
end
2830

2931
def followers
30-
@user = User.first(:id => params[:user_id])
32+
@user = User.first(:username => params[:user_id])
3133
end
3234

3335
#################
3436

3537
def resource
3638
@user ||= end_of_association_chain.find_by_username(params[:id])
3739
end
38-
40+
3941
end
42+

features/step_definitions/user_steps.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ def login_user
2929
click_button "Update"
3030
end
3131

32+
When /^I click on the number of followers on my profile$/ do
33+
step 'I go to look at my profile page'
34+
first('.user-followers').click
35+
end
36+
37+
When /^I click on the number of people I am following on my profile$/ do
38+
step 'I go to look at my profile page'
39+
first('.user-following').click
40+
end
41+
42+
Then /^I should see a list of the people I'm following$/ do
43+
page.should have_content "#{@user.username} is following"
44+
end
45+
46+
Then /^I should see a list of my followers$/ do
47+
page.should have_content "#{@user.username}'s followers"
48+
end
49+
3250
Then /^I should be notified that my profile was updated$/ do
3351
page.should have_content("updated your account")
3452
end
@@ -37,3 +55,4 @@ def login_user
3755
visit("/users/#{@user.username}")
3856
page.should have_content("Test user likes to edit his profile")
3957
end
58+

features/users.feature

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Feature: Manage account
22

3-
As a user of this site, I can view and update my profile
3+
As a user of this site, I can view and update my profile, see my followers
44

55
Background: The user is logged in
66
Given a logged in user
@@ -12,4 +12,13 @@ Feature: Manage account
1212
Scenario: Edit my profile
1313
When I edit my profile
1414
Then I should be notified that my profile was updated
15-
And I should see my changes reflected on my profile page
15+
And I should see my changes reflected on my profile page
16+
17+
Scenario: See my followers
18+
When I click on the number of followers on my profile
19+
Then I should see a list of my followers
20+
21+
Scenario: See who is following me
22+
When I click on the number of people I am following on my profile
23+
Then I should see a list of the people I'm following
24+

0 commit comments

Comments
 (0)