Permalink
Browse files

add ability to view movies recommended for friends

  • Loading branch information...
1 parent a663d20 commit 610039dd2498c1cb9111b177e9de231396a44720 @drapergeek committed May 19, 2012
@@ -2,4 +2,9 @@ class FriendsController < ApplicationController
def index
@friends = current_user.friends
end
+
+ def show
+ @user = User.find(params[:id])
+ @recommendations = @user.for_me
+ end
end
@@ -0,0 +1,3 @@
+%ul.recommendations
+ -@recommendations.each do |recommendation|
+ %li.recommendation=link_to recommendation.name, recommendation
View
@@ -9,3 +9,14 @@ Feature: Interact with other users
Then I should see links to 5 users
Scenario: View an individual user
+ Given a user "sam@example.com" has the following recommendations:
+ | name |
+ | Iron Man |
+ | The Goonies |
+ And I am signed in as "person@example.com"
+ When I visit my friends page
+ And I click the "sam@example.com" link
+ Then I should see his recommendations as:
+ | name |
+ | Iron Man |
+ | The Goonies |
@@ -7,3 +7,21 @@
page.should have_css("a", count: count)
end
end
+
+Given /^a user "(.*?)" has the following recommendations:$/ do |email, table|
+ user = create(:user, email: email)
+ table.hashes.each do |hash|
+ movie = create(:movie, name: hash[:name])
+ create(:movie_recommendation, recommendee: user, movie: movie)
+ end
+end
+
+Then /^I should see his recommendations as:$/ do |table|
+ within ".recommendations" do
+ table.hashes.each do |hash|
+ page.should have_link(hash[:name])
+ end
+ end
+end
+
+
@@ -1,3 +1,11 @@
Then "show me the page" do
save_and_open_page
end
+
+When /^I click the "(.*?)" link$/ do |link_name|
+ click_link link_name
+end
+
+When /^I click the "(.*?)" button$/ do |button_name|
+ click_button button_name
+end
@@ -8,20 +8,12 @@
fill_in "user_password_confirmation", with: password
end
-When /^I click the "(.*?)" button$/ do |button_name|
- click_button button_name
-end
-
Then /^I should see a link to "(.*?)" in the menu bar$/ do |link_text|
within ".navbar" do
page.should have_link(link_text)
end
end
-When /^I click the "(.*?)" link$/ do |link_name|
- click_link link_name
-end
-
Then /^I should see the "(.*?)" link in the menu bar$/ do |link_name|
within ".navbar" do
page.should have_link link_name
@@ -41,3 +33,4 @@
fill_in "user_password", with: "testtest"
click_button "Sign in"
end
+

0 comments on commit 610039d

Please sign in to comment.