Commit d262a9ed039ec3bb2e98ce24e5d53cf12d1169a6
1 parent
a8c2d855
Exists in
master
and in
29 other branches
ActionItem16: added units an functional tests to the new functionalities
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@400 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
27 additions
and
0 deletions
Show diff stats
app/controllers/enterprise_controller.rb
app/views/enterprise/show.rhtml
... | ... | @@ -23,3 +23,9 @@ |
23 | 23 | <%= help _('Be a member of the enterprise') %> |
24 | 24 | <%= link_to _('Activate'), :action => 'activate', :id => @enterprise if @my_pending_enterprises.include?(@enterprise) %> |
25 | 25 | <%= help _('Activate an approved enterprise') if @my_pending_enterprises.include?(@enterprise) %> |
26 | +<% unless @enterprise.approved? %> | |
27 | + <%= link_to _('Approve'), :action => 'approve', :id => @enterprise %> | |
28 | + <%= help _('Approve a submitted enterprise profile') %> | |
29 | + <%= link_to _('Reject'), :action => 'reject', :id => @enterprise %> | |
30 | + <%= help _('Reject a submitted enterprise profile') %> | |
31 | +<% end %> | ... | ... |
test/functional/enterprise_controller_test.rb
... | ... | @@ -137,4 +137,10 @@ class EnterpriseControllerTest < Test::Unit::TestCase |
137 | 137 | assert_kind_of Enterprise, assigns(:enterprise) |
138 | 138 | assert assigns(:enterprise).active |
139 | 139 | end |
140 | + | |
141 | + def test_approve | |
142 | + logins_as 'ze' | |
143 | + post :approve, :id => 5 | |
144 | + assert assigns(:em) | |
145 | + end | |
140 | 146 | end | ... | ... |
test/unit/enterprise_test.rb
... | ... | @@ -46,6 +46,20 @@ class EnterpriseTest < Test::Unit::TestCase |
46 | 46 | end |
47 | 47 | end |
48 | 48 | |
49 | + def test_approve | |
50 | + e = Enterprise.create(:identifier => 'bli', :name => 'Bli') | |
51 | + assert !e.approved? | |
52 | + e.approve | |
53 | + assert e.approved? | |
54 | + end | |
55 | + | |
56 | + def test_reject | |
57 | + e = Enterprise.create(:identifier => 'bli', :name => 'Bli') | |
58 | + assert !e.rejected? | |
59 | + e.reject | |
60 | + assert e.rejected? | |
61 | + end | |
62 | + | |
49 | 63 | def test_cannot_be_activated_without_approval |
50 | 64 | e = Enterprise.create(:identifier => 'bli', :name => 'Bli') |
51 | 65 | assert !e.approved | ... | ... |