Sha256: 1ce87ce5b933470f8f367554e6fb99f1e555348c640e97050144cf72462036e2
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require_relative "./helpers" describe BigBench::Benchmark do it "should add an empty benchmark with a name" do BigBench.benchmark "a test page" => "http://localhost:3001" BigBench.benchmark "a second test page" => "http://localhost:3001" BigBench.benchmarks.size.should == 0 end it "should add a benchmark block with a get fragment" do BigBench.benchmark "a test page" => "http://localhost:3001" do get "/" end BigBench.benchmarks.size.should == 1 BigBench.benchmarks.first.fragments.size.should == 1 BigBench.benchmarks.first.threads.should == 1 BigBench.benchmarks.first.fragments.first.uri.to_s.should == "http://localhost:3001/" end it "should add a benchmark with custom threads" do BigBench.benchmark "a test page" => "http://localhost:3001", :threads => 20 do get "/" end BigBench.benchmarks.size.should == 1 BigBench.benchmarks.first.fragments.size.should == 1 BigBench.benchmarks.first.threads.should == 20 end it "should return the longest duration of all benchmarks" do BigBench.benchmark "a test page" => "http://localhost:3001", :duration => 1.second do get "/" end BigBench.benchmark "a test page" => "http://localhost:3001", :duration => 3.minutes do get "/" end BigBench.benchmark "a test page" => "http://localhost:3001", :duration => 20.seconds do get "/" end BigBench.duration.should == 3.minutes end context "should run an entire benchmark" do it "make 3 GETs" do benchmark = BigBench.benchmark "a test page" => "http://localhost:3001" do get "/" get "/index" get "/blog" end benchmark.run! benchmark.tracker.trackings.size.should > 100 benchmark.runs.should == 1 benchmark.run! benchmark.tracker.trackings.size.should > 100 benchmark.runs.should == 2 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bigbench-0.0.1 | spec/benchmark_spec.rb |