Skip to content

Commit

Permalink
Merge pull request #814 from flippercloud/no-strict-test
Browse files Browse the repository at this point in the history
Disable strict in tests for now
  • Loading branch information
bkeepers authored Jan 11, 2024
2 parents 2fd9de7 + b984146 commit b732e5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/flipper/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def self.default_strict_value
elsif Rails.env.production?
false
else
# Warn for now. Future versions will default to :raise in development and test
:warn
# Warn in development for now. Future versions may default to :raise in development and test
Rails.env.development? && :warn
end
end

Expand Down
24 changes: 16 additions & 8 deletions spec/flipper/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,31 @@
expect(adapter).to be_instance_of(Flipper::Adapters::Memory)
end

it "defaults to strict=false in RAILS_ENV=production" do
Rails.env = "production"
it "defaults to strict=:warn in RAILS_ENV=development" do
Rails.env = "development"
subject
expect(config.strict).to eq(false)
expect(adapter).to be_instance_of(Flipper::Adapters::Memory)
expect(config.strict).to eq(:warn)
expect(adapter).to be_instance_of(Flipper::Adapters::Strict)
end

%w(development test).each do |env|
%w(production test).each do |env|
it "defaults to strict=warn in RAILS_ENV=#{env}" do
Rails.env = env
expect(Rails.env).to eq(env)
subject
expect(config.strict).to eq(:warn)
expect(adapter).to be_instance_of(Flipper::Adapters::Strict)
expect(adapter.handler).to be(:warn)
expect(config.strict).to eq(false)
expect(adapter).to be_instance_of(Flipper::Adapters::Memory)
end
end

it "defaults to strict=warn in RAILS_ENV=development" do
Rails.env = "development"
expect(Rails.env).to eq("development")
subject
expect(config.strict).to eq(:warn)
expect(adapter).to be_instance_of(Flipper::Adapters::Strict)
expect(adapter.handler).to be(:warn)
end
end

context 'cloudless' do
Expand Down

0 comments on commit b732e5c

Please sign in to comment.