Commit b6e19656fa2a4d99b96ca925f00768d6de879891
1 parent
45799bf1
Exists in
master
and in
3 other branches
Add slug to ranking item
Showing
3 changed files
with
9 additions
and
2 deletions
Show diff stats
lib/ext/entities.rb
... | ... | @@ -18,7 +18,8 @@ module Noosfero |
18 | 18 | class RankingItem < Entity |
19 | 19 | root :proposals, :proposal |
20 | 20 | expose :id, :position, :abstract, :body, :votes_for, :votes_against |
21 | - expose :hits, :effective_support, :proposal_id, :created_at, :updated_at | |
21 | + expose :hits, :effective_support, :proposal_id, :created_at | |
22 | + expose :updated_at, :slug | |
22 | 23 | end |
23 | 24 | |
24 | 25 | end | ... | ... |
lib/proposals_discussion_plugin/ranking_item.rb
test/unit/ranking_item_test.rb
... | ... | @@ -22,4 +22,10 @@ class RankingItemTest < ActiveSupport::TestCase |
22 | 22 | assert_equal 'body', proposal.ranking_item.body |
23 | 23 | end |
24 | 24 | |
25 | + should 'return slug of a proposal' do | |
26 | + proposal = ProposalsDiscussionPlugin::Proposal.create!(:name => 'test', :abstract => 'abstract', :body => 'body', :profile => profile, :parent => discussion) | |
27 | + discussion.update_ranking | |
28 | + assert_equal proposal.slug, proposal.ranking_item.slug | |
29 | + end | |
30 | + | |
25 | 31 | end | ... | ... |