Skip to content

Commit

Permalink
Default strict=false in production
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Dec 5, 2023
1 parent 54ccbc2 commit 443742b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/flipper/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def default_strict_value
value.to_sym
elsif value
Typecast.to_boolean(value) ? :raise : false
elsif Rails.env.production?
false
else
# Warn for now. Future versions will default to :raise in development and test
:warn
Expand Down
10 changes: 8 additions & 2 deletions spec/flipper/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@
end
end

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

%w(development test).each do |env|
it "defaults to strict=warn in RAILS_ENV=#{env}" do
Rails.env = env
expect(Rails.env).to eq(env)
Expand Down Expand Up @@ -160,7 +167,6 @@

it_behaves_like 'config.strict' do
let(:adapter) do
puts "WAT?"

This comment has been minimized.

Copy link
@jnunemaker

jnunemaker Dec 5, 2023

Collaborator

😆

dual_write = Flipper.adapter.adapter
poll = dual_write.local
poll.adapter
Expand Down

0 comments on commit 443742b

Please sign in to comment.