spec/helper.rb in flipper-0.7.1 vs spec/helper.rb in flipper-0.7.2
- old
+ new
@@ -12,29 +12,29 @@
require 'flipper-ui'
Dir[FlipperRoot.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
- config.before(:each) do
+ config.before(:example) do
Flipper.unregister_groups
end
end
-shared_examples_for 'a percentage' do
+RSpec.shared_examples_for 'a percentage' do
it "initializes with value" do
percentage = described_class.new(12)
- percentage.should be_instance_of(described_class)
+ expect(percentage).to be_instance_of(described_class)
end
it "converts string values to integers when initializing" do
percentage = described_class.new('15')
- percentage.value.should eq(15)
+ expect(percentage.value).to eq(15)
end
it "has a value" do
percentage = described_class.new(19)
- percentage.value.should eq(19)
+ expect(percentage.value).to eq(19)
end
it "raises exception for value higher than 100" do
expect {
described_class.new(101)
@@ -48,27 +48,27 @@
end
end
shared_examples_for 'a DSL feature' do
it "returns instance of feature" do
- feature.should be_instance_of(Flipper::Feature)
+ expect(feature).to be_instance_of(Flipper::Feature)
end
it "sets name" do
- feature.name.should eq(:stats)
+ expect(feature.name).to eq(:stats)
end
it "sets adapter" do
- feature.adapter.name.should eq(dsl.adapter.name)
+ expect(feature.adapter.name).to eq(dsl.adapter.name)
end
it "sets instrumenter" do
- feature.instrumenter.should eq(dsl.instrumenter)
+ expect(feature.instrumenter).to eq(dsl.instrumenter)
end
it "memoizes the feature" do
- dsl.send(method_name, :stats).should equal(feature)
+ expect(dsl.send(method_name, :stats)).to equal(feature)
end
it "raises argument error if not string or symbol" do
expect {
dsl.send(method_name, Object.new)
@@ -77,13 +77,13 @@
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)
+ expect(result).to be_instance_of(Flipper::Types::Boolean)
+ expect(result.value).to be(true)
result = subject.send(method_name, false)
- result.should be_instance_of(Flipper::Types::Boolean)
- result.value.should be(false)
+ expect(result).to be_instance_of(Flipper::Types::Boolean)
+ expect(result.value).to be(false)
end
end