Commit 862ea7b076349dd6d375027363789a7516e28e10
1 parent
3599b17b
Exists in
master
and in
29 other branches
Adding tests for communities templates
ActionItem2608 Note: tests for users templates were made in the previous commit.
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
test/functional/memberships_controller_test.rb
@@ -154,6 +154,22 @@ class MembershipsControllerTest < ActionController::TestCase | @@ -154,6 +154,22 @@ class MembershipsControllerTest < ActionController::TestCase | ||
154 | assert_equal 1, assigns(:community).boxes[0].blocks.size | 154 | assert_equal 1, assigns(:community).boxes[0].blocks.size |
155 | end | 155 | end |
156 | 156 | ||
157 | + should 'display only templates of the current environment' do | ||
158 | + env2 = fast_create(Environment) | ||
159 | + | ||
160 | + template1 = fast_create(Community, :name => 'template1', :environment_id => Environment.default.id, :is_template => true) | ||
161 | + template2 = fast_create(Community, :name => 'template2', :environment_id => Environment.default.id, :is_template => true) | ||
162 | + template3 = fast_create(Community, :name => 'template3', :environment_id => env2.id, :is_template => true) | ||
163 | + | ||
164 | + get :new_community, :profile => profile.identifier | ||
165 | + | ||
166 | + assert_select '#template-options' do |elements| | ||
167 | + assert_match /template1/, elements[0].to_s | ||
168 | + assert_match /template2/, elements[0].to_s | ||
169 | + assert_no_match /template3/, elements[0].to_s | ||
170 | + end | ||
171 | + end | ||
172 | + | ||
157 | should 'display only required fields when register new community' do | 173 | should 'display only required fields when register new community' do |
158 | env = Environment.default | 174 | env = Environment.default |
159 | env.custom_community_fields = { | 175 | env.custom_community_fields = { |