From 7b774bac1d7447c0f7346be8aba2ea32d04ee5ac Mon Sep 17 00:00:00 2001 From: Rafael Martins Date: Fri, 20 Apr 2012 18:54:02 -0300 Subject: [PATCH] Added MapBalloonControllerTest --- test/functional/map_balloon_controller_test.rb | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+), 0 deletions(-) create mode 100644 test/functional/map_balloon_controller_test.rb diff --git a/test/functional/map_balloon_controller_test.rb b/test/functional/map_balloon_controller_test.rb new file mode 100644 index 0000000..66a2b08 --- /dev/null +++ b/test/functional/map_balloon_controller_test.rb @@ -0,0 +1,43 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'map_balloon_controller' + + +# Re-raise errors caught by the controller. +class MapBalloonController; def rescue_action(e) raise e end; end + +class MapBalloonControllerTest < ActionController::TestCase + + def setup + @controller = MapBalloonController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + @profile = create_user('test_profile').person + login_as(@profile.identifier) + end + + should 'find product to show' do + prod = Product.create!(:name => 'Product1', :product_category_id => fast_create(ProductCategory).id, + :enterprise_id => fast_create(Enterprise).id) + get :product, :id => prod.id + assert_equal prod, assigns(:product) + end + + should 'find person to show' do + pers = Person.create!(:name => 'Person1', :user_id => fast_create(User).id, :identifier => 'pers1') + get :person, :id => pers.id + assert_equal pers, assigns(:profile) + end + + should 'find enterprise to show' do + ent = Enterprise.create!(:name => 'Enterprise1', :identifier => 'ent1') + get :enterprise, :id => ent.id + assert_equal ent, assigns(:profile) + end + + should 'find community to show' do + comm = Community.create!(:name => 'Community1', :identifier => 'comm1') + get :community, :id => comm.id + assert_equal comm, assigns(:profile) + end +end -- libgit2 0.21.2