spec/helper.rb in flipper-0.4.0 vs spec/helper.rb in flipper-0.5.0
- old
+ new
@@ -22,11 +22,11 @@
config.alias_example_to :fit, :focused => true
config.alias_example_to :xit, :pending => true
config.run_all_when_everything_filtered = true
config.before(:each) do
- Flipper.groups = nil
+ Flipper.unregister_groups
end
end
shared_examples_for 'a percentage' do
it "initializes with value" do
@@ -65,16 +65,34 @@
it "sets name" do
feature.name.should eq(:stats)
end
it "sets adapter" do
- feature.adapter.should eq(dsl.adapter)
+ feature.adapter.name.should eq(dsl.adapter.name)
end
it "sets instrumenter" do
feature.instrumenter.should eq(dsl.instrumenter)
end
it "memoizes the feature" do
- dsl.feature(:stats).should equal(feature)
+ dsl.send(method_name, :stats).should equal(feature)
+ end
+
+ it "raises argument error if not string or symbol" do
+ expect {
+ dsl.send(method_name, Object.new)
+ }.to raise_error(ArgumentError, /must be a String or Symbol/)
+ end
+end
+
+shared_examples_for "a DSL boolean method" do
+ it "returns boolean with value set" do
+ result = subject.send(method_name, true)
+ result.should be_instance_of(Flipper::Types::Boolean)
+ result.value.should be(true)
+
+ result = subject.send(method_name, false)
+ result.should be_instance_of(Flipper::Types::Boolean)
+ result.value.should be(false)
end
end