Sha256: f45774cc404c2acf58790f1eecf3010e38e77f1ef0aeed7b8170689c9af659cc

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
module Viiite
  class Command
    describe Run do

      let(:bench_iteration){ fixtures_folder+'/command/bench_iteration.rb' }
      subject{
        out, err = capture_io { Run.run(argv) }
        rel = Alf::Reader.reader(StringIO.new(out)).to_rel
        rel = rel.project([:tms], {:allbut => true})
      }

      describe "when passed a benchmark file" do
        let(:argv){ [ bench_iteration ] }
        it{ should eq(Alf::Relation[{:bench => :times}]) }
      end

      describe "with --runs" do
        let(:argv){ [ bench_iteration, "--runs=2" ] }
        let(:expected){
          Alf::Relation[{:bench => :times, :run => 0},
                        {:bench => :times, :run => 1}]
        }
        it{ should eq(expected) }
      end

      describe "with --runs and --run-key" do
        let(:argv){ [ bench_iteration, "--runs=2", "--run-key=hello" ] }
        let(:expected){
          Alf::Relation[{:bench => :times, :hello => 0},
                        {:bench => :times, :hello => 1}]
        }
        it{ should eq(expected) }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
viiite-0.2.0 spec/unit/command/test_run.rb