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

Disable strict in tests for now #814

Merged
merged 1 commit into from
Jan 11, 2024
Merged
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
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