From 0386fbf5a8bce7eeaa08308cd6f33c8722345a76 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Mon, 20 Aug 2007 15:00:33 +0000 Subject: [PATCH] ActionItem2: added integration test to the activation of an enterprise --- app/views/enterprise/show.rhtml | 2 ++ test/integration/activate_enterprise_test.rb | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-) create mode 100644 test/integration/activate_enterprise_test.rb diff --git a/app/views/enterprise/show.rhtml b/app/views/enterprise/show.rhtml index 1b55b1a..4add7dc 100644 --- a/app/views/enterprise/show.rhtml +++ b/app/views/enterprise/show.rhtml @@ -21,3 +21,5 @@ <%= help _('Remove the enterprise from the system') %> <%= link_to _('Affiliate'), :action => 'affiliate' unless @my_enterprises.include?(@enterprise) %> <%= help _('Be a member of the enterprise') %> +<%= link_to _('Activate'), :action => 'activate', :id => @enterprise if @my_pending_enterprises.include?(@enterprise) %> +<%= help _('Activate an approved enterprise') if @my_pending_enterprises.include?(@enterprise) %> diff --git a/test/integration/activate_enterprise_test.rb b/test/integration/activate_enterprise_test.rb new file mode 100644 index 0000000..1c175c5 --- /dev/null +++ b/test/integration/activate_enterprise_test.rb @@ -0,0 +1,25 @@ +require "#{File.dirname(__FILE__)}/../test_helper" + +class ActivateEnterpriseTest < ActionController::IntegrationTest + all_fixtures + + def test_activate_approved_enterprise + login('ze', 'test') + + get '/admin/enterprise' + assert_response :redirect + + follow_redirect! + assert_response :success + assert_tag :tag => 'a', :attributes => {:href => '/admin/enterprise/activate/5'} + + post '/admin/enterprise/activate/5' + assert_response :redirect + + follow_redirect! + assert_response :redirect + + follow_redirect! + assert_response :success + end +end -- libgit2 0.21.2