Sha256: efe3d1bd940b51695a2f18e2dd1d8f212d6af21f68a47c3f2de49eccff617b55

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require_relative "./helpers"

describe BigBench::Runner do
  
  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 load an external test and warn about the missing config" do
    test = File.open("spec/tests/local_invalid.rb", "rb"){ |file| file.read }
    lambda{ BigBench.load_test!(test) }.should raise_error(BigBench::Configuration::InvalidOptions, "At least: #{BigBench::Configuration::Config::VALIDATE_OPTIONS.join(', ')} are required")
  end
  
  it "should successfully load an external test" do
    test = File.open("spec/tests/local.rb", "rb"){ |file| file.read }
    BigBench.load_test!(test)
    
    BigBench.benchmarks.size.should == 2
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bigbench-0.0.4 spec/runner_spec.rb
bigbench-0.0.3 spec/runner_spec.rb
bigbench-0.0.2 spec/runner_spec.rb
bigbench-0.0.1 spec/runner_spec.rb