Commit 11eaf495025a11223e3804839bf356f6c458e2b3

Authored by Larissa Reis
1 parent 9d0f27d3

stoa-plugin-tests: fixes person_api tests

  attachment_fu doesn't provide #current_data for filesystem types of
  attachment anymore, so I added the method Image#current_data.

  Also fixes the column name that contains the tags' count for a sql
  query.
app/models/image.rb
... ... @@ -25,4 +25,7 @@ class Image < ActiveRecord::Base
25 25  
26 26 attr_accessible :uploaded_data
27 27  
  28 + def current_data
  29 + File.file?(full_filename) ? File.read(full_filename) : nil
  30 + end
28 31 end
... ...
plugins/stoa/lib/stoa_plugin/person_api.rb
... ... @@ -28,7 +28,7 @@ class StoaPlugin::PersonApi < Noosfero::FieldsDecorator
28 28 end
29 29  
30 30 def tags
31   - articles.published.tag_counts({:order => 'tags.count desc', :limit => 10}).inject({}) do |memo,tag|
  31 + articles.published.tag_counts({:order => 'count desc', :limit => 10}).inject({}) do |memo,tag|
32 32 memo[tag.name] = tag.count
33 33 memo
34 34 end
... ...