Skip to content

Commit e2b0fb5

Browse files
author
Rhys Powell
committed
Added questions to a user's profile page
1 parent 33c6cfc commit e2b0fb5

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

app/views/users/show.html.haml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
%p
2525
Followers:
2626
= link_to resource.followers.count, resource_path(resource) + "/followers"
27+
%section.questions
28+
%header
29+
%h2 Questions
30+
- @user.questions.each do |question|
31+
%article.question
32+
%h1= question.title
2733
%hr
2834
- if can? :update, resource
2935
= link_to "Change My Settings", edit_registration_path(resource), :class => "btn success"

features/questions.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Feature: CRUD actions for question
66
When I create a new question
77
Then I should be told the question was created
88
And I should be able to see the new question
9+
And I should be able to see the question on my profile page
910

1011
Scenario: Update a question
1112
Given I am a user that has created a question

features/step_definitions/question_steps.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ def create_question_for(user)
4343
page.should have_content('An edited question')
4444
page.should have_content('Just a quick edit')
4545
end
46+
47+
Then /^I should be able to see the question on my profile page$/ do
48+
visit user_path(@user)
49+
page.should have_content("My Question")
50+
end

0 commit comments

Comments
 (0)