Sha256: 857be508a217798af94925aaffbd81c295733b286c9b931c7606883d249fb303

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'json'
require 'korinthenkacker/filters/flaky'
require 'korinthenkacker/test_case'

module Korinthenkacker
  module Filters
    describe Flaky do
      let(:json_fixture_path) { File.expand_path('../../fixtures/test_cases.json', __FILE__) }
      let(:json_fixture) { JSON.parse(File.read(json_fixture_path)) }
      let(:test_cases) { json_fixture.map { |json_case| TestCase.new(json_case, 1) } }

      context 'with empty TestCases' do
        let(:test_cases) { [] }

        it 'returns and empty array' do
          expect(subject.filter([])).to be_empty
        end
      end

      context 'with non-empty cases' do
        it 'returns the correct number of flaky TestCases' do
          expect(subject.filter(test_cases).count).to eql(2)
        end

        it 'returns only the flaky TestCases' do
          flaky_test_case_names = subject.filter(test_cases).map(&:class_name)
          expect(flaky_test_case_names).to include('Flaky Spec A')
          expect(flaky_test_case_names).to include('Flaky Spec B')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
korinthenkacker-0.0.3 spec/filters/flaky_spec.rb
korinthenkacker-0.0.2 spec/filters/flaky_spec.rb