Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose multi-CV feature downstream #85

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/models/concerns/upstream_only_settings.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Settings to hide in downstream (will return nil for all values)
module UpstreamOnlySettings
class UpstreamOnlySettings
SETTINGS = %w[
allow_multiple_content_views
].freeze

def self.include?(key)
new.include?(key)
def include?(key)
SETTINGS.include?(key.to_s)
end
end
8 changes: 5 additions & 3 deletions test/unit/setting_registry_branding_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ class SettingRegistryBrandingTest < ActiveSupport::TestCase
end

test 'hides upstream-only settings' do
assert_nil Setting['allow_multiple_content_views']
UpstreamOnlySettings.expects(:include?).with('test_setting').returns(true)
assert_nil Setting['test_setting']
end
end
end

class SettingBrandingTest < ActiveSupport::TestCase
test 'replaces warning for upstream-only settings' do
Rails.logger.expects(:debug).with('Setting \'allow_multiple_content_views\' is not available in Satellite; ignoring')
Setting['allow_multiple_content_views']
UpstreamOnlySettings.expects(:include?).with('test_setting').returns(true)
Rails.logger.expects(:debug).with('Setting \'test_setting\' is not available in Satellite; ignoring')
Setting['test_setting']
end
end