Commit
e59c8ae2a2c1366e562831c6b6d15d87c71b99f4
Exists in
staging
and in
42 other branches
all_pending_tasks_api, api-articles-period, api_roles, caching-rails4, captcha_serpro_plugin, comments_permissions, content-manager-hostspot, elasticsearch, elasticsearch_api, elasticsearch_categories, elasticsearch_filter, elasticsearch_sort, elasticsearch_to_merge, elasticsearch_view, environment-exposes-api, export-comment-api, export-comment-paragraph, export_data, external_followers, federation-webfinger, federation_followers, federation_followers_backend, federation_oauth_provider, federation_webfinger, fix_event_date_issue, fix_notification_email, fix_string_downcase_and_upcase, follower_permition, json_cookie_serializer, login-captcha, master, master_profile_followers, oauth_external_login, oauth_login, private-scraps, private-scraps-rebase, production, production-vendorized, profile_api_improvements, tasks_keep_filter_params, user_mention, webfinger_server
product-categories-block: not visible when products are disabled on the environment
|
| @@ -33,4 +33,8 @@ class ProductCategoriesBlock < Block |
| @@ -33,4 +33,8 @@ class ProductCategoriesBlock < Block |
|
33
| end |
33
| end |
|
34
| end |
34
| end |
|
35
| |
35
| |
|
| |
36
| + def visible?(context=nil) |
|
| |
37
| + box.environment.enabled?('products_for_enterprises') |
|
| |
38
| + end |
|
| |
39
| + |
|
36
| end |
40
| end |
|
| @@ -0,0 +1,16 @@ |
| @@ -0,0 +1,16 @@ |
|
| |
1
| +require File.dirname(__FILE__) + '/../test_helper' |
|
| |
2
| + |
|
| |
3
| +class ProductCategoriesBlockTest < ActiveSupport::TestCase |
|
| |
4
| + should 'not be visible if products are disabled on the environment ' do |
|
| |
5
| + enterprise = fast_create(Enterprise) |
|
| |
6
| + box = fast_create(Box, :owner_id => enterprise.id, :owner_type => 'Profile') |
|
| |
7
| + block = ProductCategoriesBlock.new |
|
| |
8
| + block.box = box |
|
| |
9
| + |
|
| |
10
| + block.box.environment.enable('products_for_enterprises') |
|
| |
11
| + assert block.visible? |
|
| |
12
| + |
|
| |
13
| + block.box.environment.disable('products_for_enterprises') |
|
| |
14
| + assert !block.visible? |
|
| |
15
| + end |
|
| |
16
| +end |