Sha256: e707fbb7e4f63efa3d8914c54919661a1c9f0224c775bb2f935d55b58ce75920

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require_relative "./helpers"

describe BigBench::Runner do
  
  before(:each) do
    Dir.chdir File.dirname(__FILE__)
  end
  
  it "should raise an exception if no benchmarks were defined" do
    lambda {BigBench.run!}.should raise_error(BigBench::Runner::NoBenchmarksDefined, "Sorry, I couldn't find any benchmarks!")
  end
  
  it "should run all benchmarks" do    
    BigBench.benchmark "index page" => "http://localhost:3001" do
      get "/"
    end
    
    BigBench.benchmark "login and logout" => "http://localhost:3001" do
      post "/login"
      post "/logout"
    end
    
    BigBench.benchmarks.size.should == 2
    BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
    
    BigBench.run!
    
    BigBench.benchmarks.size.should == 2
    BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 1 }
  end
  
  it "should successfully load an external test" do
    test = File.open("tests/local.rb", "rb"){ |file| file.read }
    BigBench.load_test!(test)
    
    BigBench.config.duration.should == 1.second
    BigBench.duration.should == 1.second
    BigBench.benchmarks.size.should == 2
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bigbench-0.0.6 spec/runner_spec.rb
bigbench-0.0.5 spec/runner_spec.rb