0
@@ -61,6 +61,7 @@ describe MSpec, ".protect" do
0
@rs.stub!(:state).and_return(@ss)
0
@exception = Exception.new("Sharp!")
0
+ ScratchPad.record @exception
0
it "rescues any exceptions raised when executing the block argument" do
0
@@ -72,15 +73,15 @@ describe MSpec, ".protect" do
0
it "records the exception in the current.state object's exceptions" do
0
- MSpec.protect("testing") { raise @exception }
0
- @ss.exceptions.should == [["testing", @exception]]
0
+ MSpec.protect("testing") { raise ScratchPad.recorded }
0
+ @ss.exceptions.should == [["testing", ScratchPad.recorded]]
0
it "writes a message to STDERR if current is nil" do
0
STDERR.should_receive(:write).with("\nAn exception occurred in testing:\nException: \"Sharp!\"\n")
0
- MSpec.protect("testing") { raise
@exception}
0
+ MSpec.protect("testing") { raise
ScratchPad.recorded }
0
it "writes a message to STDERR if current.state is nil" do
0
@@ -88,7 +89,7 @@ describe MSpec, ".protect" do
0
STDERR.should_receive(:write).with("\nAn exception occurred in testing:\nException: \"Sharp!\"\n")
0
@rs.stub!(:state).and_return(nil)
0
- MSpec.protect("testing") { raise
@exception}
0
+ MSpec.protect("testing") { raise
ScratchPad.recorded }
0
@@ -110,11 +111,11 @@ end
0
describe MSpec, ".actions" do
0
start_one = mock("one")
0
- start_one.stub!(:start).and_return {
@record << :one }
0
+ start_one.stub!(:start).and_return {
ScratchPad << :one }
0
start_two = mock("two")
0
- start_two.stub!(:start).and_return {
@record << :two }
0
+ start_two.stub!(:start).and_return {
ScratchPad << :two }
0
MSpec.register :start, start_one
0
MSpec.register :start, start_two
0
@@ -126,7 +127,7 @@ describe MSpec, ".actions" do
0
it "runs each action registered as a start action" do
0
-
@record.should == [:one, :two]
0
+
ScratchPad.recorded.should == [:one, :two]
0
@@ -157,14 +158,14 @@ end
0
describe MSpec, ".describe" do
0
it "pushes a new RunState instance on the stack" do
0
- MSpec.describe(Object, "msg") { @record = MSpec.current }
0
- @record.should be_kind_of(RunState)
0
+ MSpec.describe(Object, "msg") { ScratchPad.record MSpec.current }
0
+ ScratchPad.recorded.should be_kind_of(RunState)
0
it "pops the RunState instance off the stack when finished" do
0
- MSpec.describe(Object, "msg") { @record = MSpec.current }
0
- @record.should be_kind_of(RunState)
0
+ MSpec.describe(Object, "msg") { ScratchPad.record MSpec.current }
0
+ ScratchPad.recorded.should be_kind_of(RunState)
0
MSpec.stack.should == []
0
@@ -178,18 +179,18 @@ describe MSpec, ".process" do
0
it "calls all start actions" do
0
- start.stub!(:start).and_return {
@record = :start }
0
+ start.stub!(:start).and_return {
ScratchPad.record :start }
0
MSpec.register :start, start
0
-
@record.should == :start
0
+
ScratchPad.recorded.should == :start
0
it "calls all finish actions" do
0
finish = mock("finish")
0
- finish.stub!(:finish).and_return {
@record = :finish }
0
+ finish.stub!(:finish).and_return {
ScratchPad.record :finish }
0
MSpec.register :finish, finish
0
-
@record.should == :finish
0
+
ScratchPad.recorded.should == :finish
0
it "calls the files method" do
0
@@ -208,10 +209,10 @@ describe MSpec, ".files" do
0
it "calls load actions before each file" do
0
- load.stub!(:load).and_return {
@record = :load }
0
+ load.stub!(:load).and_return {
ScratchPad.record :load }
0
MSpec.register :load, load
0
-
@record.should == :load
0
+
ScratchPad.recorded.should == :load
0
it "registers the current file" do