File: task_spec.rb

package info (click to toggle)
ruby-benchmark-memory 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ruby: 1,121; makefile: 7; sh: 4
file content (22 lines) | stat: -rw-r--r-- 555 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Benchmark::Memory::Job::Task do
  describe '.new' do
    it 'raises an ArgumentError when the action is not a callable' do
      expect do
        described_class.new('label', nil)
      end.to raise_error(ArgumentError)
    end
  end

  describe '#call' do
    it 'returns a measurement of the memory usage in the action' do
      action = -> {}
      entry = described_class.new('empty proc', action)

      expect(entry.call).to be_a Benchmark::Memory::Measurement
    end
  end
end