spec/flipper/gates/boolean_spec.rb in flipper-0.9.2 vs spec/flipper/gates/boolean_spec.rb in flipper-0.10.0
- old
+ new
@@ -5,10 +5,18 @@
subject {
described_class.new
}
+ def context(bool)
+ Flipper::FeatureCheckContext.new(
+ feature_name: feature_name,
+ values: Flipper::GateValues.new({boolean: bool}),
+ thing: Flipper::Types::Actor.new(Struct.new(:flipper_id).new(1)),
+ )
+ end
+
describe "#enabled?" do
context "for true value" do
it "returns true" do
expect(subject.enabled?(true)).to eq(true)
end
@@ -22,16 +30,16 @@
end
describe "#open?" do
context "for true value" do
it "returns true" do
- expect(subject.open?(Object.new, true, feature_name: feature_name)).to eq(true)
+ expect(subject.open?(context(true))).to be(true)
end
end
context "for false value" do
it "returns false" do
- expect(subject.open?(Object.new, false, feature_name: feature_name)).to eq(false)
+ expect(subject.open?(context(false))).to be(false)
end
end
end
describe "#protects?" do