Sha256: 3047bcf44921276eaa4113d4929dac8729d03cc6e42589e2e0a3ec4cab676aa2
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') Spork.class_eval do def self.reset! @state = nil @already_run = nil @already_preforked = nil end end describe Spork do before(:each) do Spork.reset! end def spec_helper_simulator ran = [] Spork.prefork do ran << :prefork end Spork.each_run do ran << :each_run end ran end it "only runs the preload block when preforking" do ran = [] Spork.preforking! spec_helper_simulator.should == [:prefork] end it "only runs the each_run block when running" do Spork.preforking! spec_helper_simulator Spork.running! spec_helper_simulator.should == [:each_run] end it "runs both blocks when Spork not activated" do spec_helper_simulator.should == [:prefork, :each_run] end it "prevents blocks from being ran twice" do spec_helper_simulator.should == [:prefork, :each_run] spec_helper_simulator.should == [] end it "runs multiple prefork and each_run blocks at different locations" do Spork.prefork { } Spork.each_run { } spec_helper_simulator.should == [:prefork, :each_run] end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
timcharper-spork-0.4.4 | spec/spork_spec.rb |
spork-0.4.4 | spec/spork_spec.rb |