spec/spork_spec.rb in spork-0.9.0.rc vs spec/spork_spec.rb in spork-0.9.0.rc2

- old
+ new

@@ -1,21 +1,23 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') Spork.class_eval do def self.reset! @state = nil + @using_spork = false @already_ran = nil + @each_run_procs = nil end end describe Spork do before(:each) do Spork.reset! + @ran = [] end def spec_helper_simulator - @ran ||= [] Spork.prefork do @ran << :prefork end Spork.each_run do @@ -61,18 +63,18 @@ end describe "#using_spork?" do it "returns true if Spork is being used" do Spork.using_spork?.should be_false - Spork.using_spork! + Spork.exec_prefork { } Spork.using_spork?.should be_true end end describe "#trap_method" do before(:each) do - Spork.using_spork! + Spork.exec_prefork { } Object.class_eval do class TrapTest def self.output @output ||= [] @@ -97,11 +99,11 @@ after(:each) do Object.send(:remove_const, :TrapTest) end it "delays execution of a method until after Spork.exec_each_run is called" do - Spork.using_spork! + Spork.exec_prefork { } Spork.trap_method(TrapTest, :hello) @trap_test.hello @trap_test.goodbye Spork.exec_each_run TrapTest.output.should == ['goodbye', 'hello'] @@ -138,10 +140,10 @@ after(:each) do Object.send(:remove_const, :TrapTest) end it "delays execution of a method until after Spork.exec_each_run is called" do - Spork.using_spork! + Spork.exec_prefork { } Spork.trap_class_method(TrapTest, :hello) TrapTest.hello TrapTest.goodbye Spork.exec_each_run TrapTest.output.should == ['goodbye', 'hello']