Sha256: 6d82d6080e42fcbbfcc4ade32721d42cae01341ceb311880a791eec8e6e409b1
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' describe Benches::Routine do describe 'initialize' do context 'no method arguments' do let(:bench) { Benches::Routine.new("test_string", 'split', 50000) } it 'assigns instance correctly' do expect(bench.instance_variable_get('@instance')).to eql 'test_string' end it 'assigns method correctly' do expect(bench.instance_variable_get('@method')).to eql 'split' end it 'assigns repetitions correctly' do expect(bench.instance_variable_get('@repetitions')).to eql 50000 end it 'sets args to empty array' do expect(bench.instance_variable_get('@args')).to eql [] end end context 'method has arguments' do let(:bench) { Benches::Routine.new("test_string", 'insert', 50000, 1, 'a') } it 'assigns instance correctly' do expect(bench.instance_variable_get('@instance')).to eql 'test_string' end it 'assigns method correctly' do expect(bench.instance_variable_get('@method')).to eql 'insert' end it 'assigns repetitions correctly' do expect(bench.instance_variable_get('@repetitions')).to eql 50000 end it' assigns args correctly' do expect(bench.instance_variable_get('@args')).to eql [1, 'a'] end end end describe 'call' do context 'no method arguments' do let(:bench) { Benches::Routine.new("test_string", 'split', 20) } it 'performs benchmark' do expect(bench.call).to be_a Benchmark::Tms end end context 'method has arguments' do let(:bench) { Benches::Routine.new("test_string", 'insert', 20, 1, 'a') } it 'performs benchmark' do expect(bench.call).to be_a Benchmark::Tms end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
benches-0.2.0 | spec/routine_spec.rb |