Commit af2a416ac6de912ed50357ccb9c55f3b67c061d7
1 parent
f97ba599
Exists in
master
and in
29 other branches
ActionItem16: finding pending validations with conditions
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@859 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
9 additions
and
3 deletions
Show diff stats
app/models/organization.rb
@@ -24,7 +24,7 @@ class Organization < Profile | @@ -24,7 +24,7 @@ class Organization < Profile | ||
24 | restrictions || ('<em>' + _('(not informed)') + '</em>') | 24 | restrictions || ('<em>' + _('(not informed)') + '</em>') |
25 | end | 25 | end |
26 | 26 | ||
27 | - def pending_validations | ||
28 | - CreateEnterprise.pending_for(self) | 27 | + def pending_validations(conditions = nil) |
28 | + CreateEnterprise.pending_for(self, conditions) | ||
29 | end | 29 | end |
30 | end | 30 | end |
test/unit/organization_test.rb
@@ -62,8 +62,14 @@ class OrganizationTest < Test::Unit::TestCase | @@ -62,8 +62,14 @@ class OrganizationTest < Test::Unit::TestCase | ||
62 | 62 | ||
63 | should 'list pending enterprise validations' do | 63 | should 'list pending enterprise validations' do |
64 | org = Organization.new | 64 | org = Organization.new |
65 | - CreateEnterprise.expects(:pending_for).with(org).returns([]) | 65 | + CreateEnterprise.expects(:pending_for).with(org, nil).returns([]) |
66 | assert_equal [], org.pending_validations | 66 | assert_equal [], org.pending_validations |
67 | end | 67 | end |
68 | 68 | ||
69 | + should 'accept an optional conditions hash for pending_validations' do | ||
70 | + org = Organization.new | ||
71 | + CreateEnterprise.expects(:pending_for).with(org, { :lala => 'lele'}).returns([]) | ||
72 | + assert_equal [], org.pending_validations({ :lala => 'lele'}) | ||
73 | + end | ||
74 | + | ||
69 | end | 75 | end |