spec/bogus/fakes/fake_configuration_spec.rb in bogus-0.1.4 vs spec/bogus/fakes/fake_configuration_spec.rb in bogus-0.1.5
- old
+ new
@@ -2,11 +2,11 @@
describe Bogus::FakeConfiguration do
let(:config) { Bogus::FakeConfiguration.new }
it "does not contain not configured fakes" do
- config.include?(:foo).should be_false
+ expect(config.include?(:foo)).to be_false
end
def class_block(name)
config.get(name).class_block
end
@@ -24,57 +24,57 @@
fake(:foo, as: :class, class: proc{Samples::Foo}) do
bar "the bar"
end
end
- config.include?(:foo).should be_true
- config.include?(:bar).should be_false
+ expect(config.include?(:foo)).to be_true
+ expect(config.include?(:bar)).to be_false
end
it "returns the configuration for a fake" do
config.evaluate do
fake(:foo, as: :class, class: proc{Samples::Foo}) do
bar "the bar"
end
end
- opts(:foo).should == {as: :class}
- stubs(:foo).should == {bar: "the bar"}
- class_block(:foo).call.should == Samples::Foo
+ expect(opts(:foo)).to eq ({ as: :class} )
+ expect(stubs(:foo)).to eq ({ bar: "the bar"} )
+ expect(class_block(:foo).call).to eq Samples::Foo
end
context "with no class" do
it "does not return any class block" do
config.evaluate do
fake(:foo, as: :class) { bar "bar" }
end
- opts(:foo).should == {as: :class}
- stubs(:foo).should == {bar: "bar"}
- class_block(:foo).should be_nil
+ expect(opts(:foo)).to eq ({ as: :class} )
+ expect(stubs(:foo)).to eq ({ bar: "bar"} )
+ expect(class_block(:foo)).to be_nil
end
end
context "with no options" do
it "does not return any options" do
config.evaluate do
fake(:foo) { bar "bar" }
end
- opts(:foo).should == {}
- stubs(:foo).should == {bar: "bar"}
- class_block(:foo).should be_nil
+ expect(opts(:foo)).to eq ({ } )
+ expect(stubs(:foo)).to eq ({ bar: "bar"} )
+ expect(class_block(:foo)).to be_nil
end
end
context "with block return value definitions" do
it "returns the values, not blocks" do
config.evaluate do
fake(:foo) { bar {"bar"} }
end
- stubs(:foo)[:bar].call.should == "bar"
+ expect(stubs(:foo)[:bar].call).to eq "bar"
end
it "does not evaluate the blocks when getting, nor when setting" do
config.evaluate do
fake(:foo) { bar { raise "gotcha" } }
@@ -89,11 +89,11 @@
it "returns the options" do
config.evaluate do
fake(:foo, as: :class)
end
- opts(:foo).should == {as: :class}
- stubs(:foo).should == {}
- class_block(:foo).should be_nil
+ expect(opts(:foo)).to eq ({ as: :class} )
+ expect(stubs(:foo)).to eq ({ } )
+ expect(class_block(:foo)).to be_nil
end
end
end