Commit 7636da3f892862ae61ff9ebbdceca4b9ca12dff5
1 parent
bf8f5477
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
#community dashboard - add unit test
Showing
2 changed files
with
40 additions
and
0 deletions
Show diff stats
plugins/community_hub/test/test_helper.rb
| ... | ... | @@ -5,3 +5,10 @@ def create_hub(name, community, user) |
| 5 | 5 | hub.save! |
| 6 | 6 | hub |
| 7 | 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 | ... | ... |
plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb
0 → 100644
| ... | ... | @@ -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 | ... | ... |