Files
openfoodnetwork/spec/constraints/feature_toggle_constraint_spec.rb
Maikel Linke dcb6f4676d Remove all unnecessary spec_helper require statements
The `.rspec` file is doing this for us.
2026-01-21 12:35:34 +11:00

27 lines
616 B
Ruby

# frozen_string_literal: true
RSpec.describe FeatureToggleConstraint do
subject { described_class.new("baking") }
let(:request) { double(env:) }
let(:env) { {} }
it "constraints an unknown feature" do
expect(subject.matches?(request)).to eq false
end
it "allows an activated feature" do
Flipper.enable("baking")
expect(subject.matches?(request)).to eq true
end
it "negates results" do
subject = described_class.new("baking", negate: true)
expect(subject.matches?(request)).to eq true
Flipper.enable("baking")
expect(subject.matches?(request)).to eq false
end
end