0
@@ -7,102 +7,102 @@ require 'mspec/runner/context'
0
describe ContextState, "#describe" do
0
- @state = ContextState.new
0
+ @state = ContextState.new
"C#m"0
@proc = lambda { ScratchPad.record :a }
0
it "evaluates the passed block" do
0
- @state.describe(
Object, &@proc)
0
+ @state.describe(
&@proc)
0
ScratchPad.recorded.should == :a
0
- it "sets the description string" do
0
- @state.description.should be_nil
0
- @state.describe("Object#to_s") { }
0
- @state.description.should == "Object#to_s"
0
+ it "evaluates the passed block via #protect" do
0
+ @state.should_receive(:protect).with("C#m", @proc, false)
0
+ @state.describe(&@proc)
0
it "registers #parent as the current MSpec ContextState" do
0
- parent = ContextState.new
0
+ parent = ContextState.new
""0
MSpec.should_receive(:register_current).with(parent)
0
- @state.describe
("C#m") { }
0
- it "registers nil as the current MSpec ContextState if it has no parent" do
0
- MSpec.should_receive(:register_current).with(nil)
0
- @state.describe("C#m") { }
0
+ it "registers self with MSpec when #shared? is true" do
0
+ state = ContextState.new "something shared", :shared => true
0
+ MSpec.should_receive(:register_shared).with(state)
0
-describe ContextState, "#description when there are no parents" do
0
- @state = ContextState.new
0
+describe ContextState, "#shared?" do
0
+ it "returns false when the ContextState is not shared" do
0
+ ContextState.new("").shared?.should be_false
0
+ it "returns true when the ContextState is shared" do
0
+ ContextState.new("", {:shared => true}).shared?.should be_true
0
+describe ContextState, "#to_s" do
0
it "returns a description string for self when passed a Module" do
0
- @state.describe(Object) { }
0
- @state.description.should == "Object"
0
+ ContextState.new(Object).to_s.should == "Object"
0
it "returns a description string for self when passed a String" do
0
- @state.describe("SomeClass") { }
0
- @state.description.should == "SomeClass"
0
+ ContextState.new("SomeClass").to_s.should == "SomeClass"
0
it "returns a description string for self when passed a Module, String" do
0
- @state.describe(Object, "when empty") { }
0
- @state.description.should == "Object when empty"
0
+ ContextState.new(Object, "when empty").to_s.should == "Object when empty"
0
it "returns a description string for self when passed a Module and String beginning with '#'" do
0
- @state.describe(Object, "#to_s") { }
0
- @state.description.should == "Object#to_s"
0
+ ContextState.new(Object, "#to_s").to_s.should == "Object#to_s"
0
it "returns a description string for self when passed a Module and String beginning with '.'" do
0
- @state.describe(Object, ".to_s") { }
0
- @state.description.should == "Object.to_s"
0
+ ContextState.new(Object, ".to_s").to_s.should == "Object.to_s"
0
it "returns a description string for self when passed a Module and String beginning with '::'" do
0
- @state.describe(Object, "::to_s") { }
0
- @state.description.should == "Object::to_s"
0
+ ContextState.new(Object, "::to_s").to_s.should == "Object::to_s"
0
-describe ContextState, "#description
when there are parents" do
0
+describe ContextState, "#description
" do
0
- @state = ContextState.new
0
- @parent = ContextState.new
0
- @state.parent = @parent
0
+ @state = ContextState.new "when empty"
0
+ @parent = ContextState.new "Toplevel"
0
it "returns a composite description string from self and all parents" do
0
- @parent.describe("Toplevel") { }
0
- @state.describe("when empty") { }
0
+ @parent.description.should == "Toplevel"
0
+ @state.description.should == "when empty"
0
+ @state.parent = @parent
0
@state.description.should == "Toplevel when empty"
0
describe ContextState, "#it" do
0
- @state = ContextState.new
0
+ @state = ContextState.new
""0
it "creates an ExampleState instance for the block" do
0
ex = ExampleState.new("", "", &@proc)
0
- ExampleState.should_receive(:new).with("describe", "it", @proc).and_return(ex)
0
- @state.describe("describe", &@proc)
0
+ ExampleState.should_receive(:new).with(@state, "it", @proc).and_return(ex)
0
+ @state.describe(&@proc)
0
@state.it("it", &@proc)
0
describe ContextState, "#examples" do
0
- @state = ContextState.new
0
+ @state = ContextState.new
""0
it "returns a list of all examples in this ContextState" do
0
describe ContextState, "#before" do
0
- @state = ContextState.new