Commit 7b774bac1d7447c0f7346be8aba2ea32d04ee5ac
1 parent
d20048b3
Exists in
master
and in
29 other branches
Added MapBalloonControllerTest
Showing
1 changed file
with
43 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | +require 'map_balloon_controller' | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +# Re-raise errors caught by the controller. | ||
| 6 | +class MapBalloonController; def rescue_action(e) raise e end; end | ||
| 7 | + | ||
| 8 | +class MapBalloonControllerTest < ActionController::TestCase | ||
| 9 | + | ||
| 10 | + def setup | ||
| 11 | + @controller = MapBalloonController.new | ||
| 12 | + @request = ActionController::TestRequest.new | ||
| 13 | + @response = ActionController::TestResponse.new | ||
| 14 | + | ||
| 15 | + @profile = create_user('test_profile').person | ||
| 16 | + login_as(@profile.identifier) | ||
| 17 | + end | ||
| 18 | + | ||
| 19 | + should 'find product to show' do | ||
| 20 | + prod = Product.create!(:name => 'Product1', :product_category_id => fast_create(ProductCategory).id, | ||
| 21 | + :enterprise_id => fast_create(Enterprise).id) | ||
| 22 | + get :product, :id => prod.id | ||
| 23 | + assert_equal prod, assigns(:product) | ||
| 24 | + end | ||
| 25 | + | ||
| 26 | + should 'find person to show' do | ||
| 27 | + pers = Person.create!(:name => 'Person1', :user_id => fast_create(User).id, :identifier => 'pers1') | ||
| 28 | + get :person, :id => pers.id | ||
| 29 | + assert_equal pers, assigns(:profile) | ||
| 30 | + end | ||
| 31 | + | ||
| 32 | + should 'find enterprise to show' do | ||
| 33 | + ent = Enterprise.create!(:name => 'Enterprise1', :identifier => 'ent1') | ||
| 34 | + get :enterprise, :id => ent.id | ||
| 35 | + assert_equal ent, assigns(:profile) | ||
| 36 | + end | ||
| 37 | + | ||
| 38 | + should 'find community to show' do | ||
| 39 | + comm = Community.create!(:name => 'Community1', :identifier => 'comm1') | ||
| 40 | + get :community, :id => comm.id | ||
| 41 | + assert_equal comm, assigns(:profile) | ||
| 42 | + end | ||
| 43 | +end |