spec/spork_spec.rb in invo-sporknife-0.1.0.1 vs spec/spork_spec.rb in invo-sporknife-0.1.0.2

- old
+ new

@@ -1,23 +1,21 @@ 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 @@ -63,18 +61,18 @@ end describe "#using_spork?" do it "returns true if Spork is being used" do Spork.using_spork?.should be_false - Spork.exec_prefork { } + Spork.using_spork! Spork.using_spork?.should be_true end end describe "#trap_method" do before(:each) do - Spork.exec_prefork { } + Spork.using_spork! Object.class_eval do class TrapTest def self.output @output ||= [] @@ -99,11 +97,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.exec_prefork { } + Spork.using_spork! Spork.trap_method(TrapTest, :hello) @trap_test.hello @trap_test.goodbye Spork.exec_each_run TrapTest.output.should == ['goodbye', 'hello'] @@ -140,10 +138,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.exec_prefork { } + Spork.using_spork! Spork.trap_class_method(TrapTest, :hello) TrapTest.hello TrapTest.goodbye Spork.exec_each_run TrapTest.output.should == ['goodbye', 'hello']