map_balloon_controller_test.rb
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require_relative "../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 = create(Product, :name => 'Product1', :product_category_id => fast_create(ProductCategory).id,
:profile_id => fast_create(Enterprise).id)
get :product, :id => prod.id
assert_equal prod, assigns(:product)
end
should 'find person to show' do
pers = create(Person, :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