Skip to content

Commit

Permalink
use .features_by_namespace instead of .visiable_features_by_namespace (
Browse files Browse the repository at this point in the history
…#150)

* use .features_by_namespace instead of .visiable_features_by_namespace

* runs rspecs as part of GitHub workflow

* reverted change made to .namespace_features_hash method

---------

Co-authored-by: Sai Kumar Kotagiri <[email protected]>
  • Loading branch information
raghuramg and saikumar9 authored Nov 8, 2023
1 parent 02f5493 commit d692b74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
${{ runner.os }}-resource_registry-${{ hashFiles('**/Gemfile.lock') }}
- name: Install Gems
run: |
gem update --system
gem install bundler -v '2.0.2'
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
Expand Down
24 changes: 12 additions & 12 deletions spec/resource_registry/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def call(params)
end

it "the child feature should be disabled" do
expect(registry.feature_enabled?(:trawler)).to be_truthy
expect(registry.feature_enabled?(:trawler)).to be_falsey
end

end
Expand Down Expand Up @@ -445,8 +445,8 @@ def call(params)
)
end

let(:sail_features) { %i[sloop ketch yawl] }
let(:boat_features) { %i[ski trawler] }
let(:sail_features) { [sloop, ketch, yawl] }
let(:boat_features) { [ski, trawler] }

before do
registry.register_feature(vessel)
Expand All @@ -461,10 +461,10 @@ def call(params)

context 'when the boat disabled and sail enabled' do
let(:vessel_enabled) { true }
let(:sail_enabled) { true }
let(:boat_enabled) { false }
let(:sail_enabled) { true }

it 'should return false for all features under vessel namespace' do
it 'should return false for all features with boat namespace' do
expect(registry.feature_enabled?(:vessel)).to be_truthy
expect(registry.feature_enabled?(:boat)).to be_falsey
boat_features.each do |feature|
Expand All @@ -473,17 +473,17 @@ def call(params)

expect(registry.feature_enabled?(:sail)).to be_truthy
sail_features.each do |feature|
expect(registry.feature_enabled?(feature.key)).to be_truthy
expect(registry.feature_enabled?(feature.key)).to be_falsey
end
end
end
end

context 'when the sail enabled and boat disabled' do
context 'when the sail disabled and boat enabled' do
let(:vessel_enabled) { true }
let(:boat_enabled) { true }
let(:sail_enabled) { false }

it 'should return false for all features under boat namespace' do
it 'should return false for all features under sail namespace' do
expect(registry.feature_enabled?(:vessel)).to be_truthy
expect(registry.feature_enabled?(:sail)).to be_falsey
sail_features.each do |feature|
Expand All @@ -494,7 +494,7 @@ def call(params)
boat_features.each do |feature|
expect(registry.feature_enabled?(feature.key)).to be_truthy
end
end
end
end

context 'when the vessel disabled' do
Expand All @@ -503,7 +503,7 @@ def call(params)
let(:sail_enabled) { true }

it 'should return false for all features' do
expect(registry.feature_enabled?(:vessel)).to be_truthy
expect(registry.feature_enabled?(:vessel)).to be_falsey
expect(registry.feature_enabled?(:sail)).to be_falsey
sail_features.each do |feature|
expect(registry.feature_enabled?(feature.key)).to be_falsey
Expand All @@ -513,7 +513,7 @@ def call(params)
boat_features.each do |feature|
expect(registry.feature_enabled?(feature.key)).to be_falsey
end
end
end
end
end
end
Expand Down

0 comments on commit d692b74

Please sign in to comment.