Commit af2a416ac6de912ed50357ccb9c55f3b67c061d7

Authored by AntonioTerceiro
1 parent f97ba599

ActionItem16: finding pending validations with conditions



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@859 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/organization.rb
... ... @@ -24,7 +24,7 @@ class Organization < Profile
24 24 restrictions || ('<em>' + _('(not informed)') + '</em>')
25 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 29 end
30 30 end
... ...
test/unit/organization_test.rb
... ... @@ -62,8 +62,14 @@ class OrganizationTest &lt; Test::Unit::TestCase
62 62  
63 63 should 'list pending enterprise validations' do
64 64 org = Organization.new
65   - CreateEnterprise.expects(:pending_for).with(org).returns([])
  65 + CreateEnterprise.expects(:pending_for).with(org, nil).returns([])
66 66 assert_equal [], org.pending_validations
67 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 75 end
... ...