File: pids_spec.rb

package info (click to toggle)
ruby-parallel-tests 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 760 kB
  • sloc: ruby: 5,446; javascript: 16; makefile: 4
file content (36 lines) | stat: -rw-r--r-- 706 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe ParallelTests::Pids do
  let(:file_path) { Tempfile.new('pidfile').path }
  subject { described_class.new(file_path) }

  before do
    subject.send(:clear)
    subject.add(123)
    subject.add(456)
  end

  describe '#add' do
    specify do
      subject.add(789)
      expect(subject.all).to eq([123, 456, 789])
    end
  end

  describe '#delete' do
    specify do
      subject.add(101)
      subject.delete(123)
      expect(subject.all).to eq([456, 101])
    end
  end

  describe '#count' do
    specify { expect(subject.count).to eq(2) }
  end

  describe '#all' do
    specify { expect(subject.all).to eq([123, 456]) }
  end
end