Commit fc6e26d5649571f5739f0bca3e846829cf8d8794
1 parent
ed3d4a18
Exists in
master
#community dashboard - add unit test
Showing
2 changed files
with
40 additions
and
0 deletions
Show diff stats
test/test_helper.rb
@@ -5,3 +5,10 @@ def create_hub(name, community, user) | @@ -5,3 +5,10 @@ def create_hub(name, community, user) | ||
5 | hub.save! | 5 | hub.save! |
6 | hub | 6 | hub |
7 | end | 7 | end |
8 | + | ||
9 | +def create_mediation(hub, community) | ||
10 | + mediation = CommunityHubPlugin::Mediation.new(:profile => community) | ||
11 | + mediation.name = CommunityHubPlugin::Mediation.timestamp | ||
12 | + mediation.save! | ||
13 | + mediation | ||
14 | +end |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +require File.dirname(__FILE__) + '/../../test_helper' | ||
2 | + | ||
3 | +class MediationTest < ActiveSupport::TestCase | ||
4 | + | ||
5 | + def setup | ||
6 | + @env = fast_create(Environment) | ||
7 | + @user = create_user('testuser', :environment => @env).person | ||
8 | + @comm = fast_create(Community, :environment_id => @env.id) | ||
9 | + @hub = create_hub('hub', @comm, @user) | ||
10 | + @mediation = create_mediation(@hub, @comm) | ||
11 | + end | ||
12 | + | ||
13 | + should 'has setting profile_picture' do | ||
14 | + assert_respond_to @mediation, :profile_picture | ||
15 | + end | ||
16 | + | ||
17 | + should 'default value of setting profile_picture is blank' do | ||
18 | + assert_equal @mediation.profile_picture, "" | ||
19 | + end | ||
20 | + | ||
21 | + should 'generate timestamp for mediation' do | ||
22 | + assert CommunityHubPlugin::Mediation.timestamp | ||
23 | + end | ||
24 | + | ||
25 | + should 'default value of advertise is false' do | ||
26 | + assert !@mediation.advertise | ||
27 | + end | ||
28 | + | ||
29 | + should 'default value of notify comments is false' do | ||
30 | + assert !@mediation.notify_comments | ||
31 | + end | ||
32 | + | ||
33 | +end |