fixed broken test from refactoring of followers

This commit is contained in:
Jonathan Kolyer 2014-02-17 23:38:35 -06:00
parent 95519dc450
commit cba678616f
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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