From cba678616f4d2a0e2e22e64984578f107abdf4ec Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Mon, 17 Feb 2014 23:38:35 -0600 Subject: [PATCH] fixed broken test from refactoring of followers --- ruby/lib/jam_ruby/models/user.rb | 4 ++-- web/spec/requests/musician_search_api_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 327e790b2..63b24f471 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -1091,8 +1091,8 @@ module JamRuby end def top_followings - @topf ||= User.joins("INNER JOIN follows ON follows.followable_id = users.id") - .where(['follows.user_id = ?',self.id]) + @topf ||= User.joins("INNER JOIN follows ON follows.user_id = users.id AND follows.followable_type = '#{self.class.to_s}'") + .where(['follows.followable_id = ?',self.id]) .order('follows.created_at DESC') .limit(3) end diff --git a/web/spec/requests/musician_search_api_spec.rb b/web/spec/requests/musician_search_api_spec.rb index dd2bf759b..7cf8becd3 100644 --- a/web/spec/requests/musician_search_api_spec.rb +++ b/web/spec/requests/musician_search_api_spec.rb @@ -108,7 +108,7 @@ describe "Musician Search API", :type => :api do musician = json["musicians"][0] expect(musician["id"]).to eq(@user4.id) followings = musician['followings'] - # expect(followings.length).to be 3 + expect(followings.length).to be 3 expect(musician['follow_count'].to_i).to be > 0 end