Sha256: df32e83f911c689046b28a8876ef354942c8f445f6a1dd0b9e84df45af8c097f

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

describe WBench::TimingHash do
  describe '#new' do
    let(:timings) { { :end => 20, :middle => 15, :start => 10, :nope => 0 } }
    subject { described_class.new(timings) }

    it 'removes keys with a value of 0' do
      expect(subject).not_to have_key :nope
    end

    it 'offsets each value by the starting(lowest) value' do
      expect(subject[:start]).to eq(0)
      expect(subject[:middle]).to eq(5)
      expect(subject[:end]).to eq(10)
    end

    it 'orders the hash by value, lowest first' do
      expect(subject.first).to eq([:start, 0])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wbench-1.1.1 spec/wbench/timing_hash_spec.rb