Sha256: 92e3cff9a322e88f4c020373a85b1d4b19a26dc3468885d2e4cdbdfe5f7b4e56

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

require 'json'
require 'korinthenkacker/filters/failed'
require 'korinthenkacker/test_case'

module Korinthenkacker
  module Filters
    describe Failed do
      describe '#filter' do
        let(:report_json_path) { File.expand_path('../../fixtures/test_cases.json', __FILE__) }
        let(:report_json_fixture) { JSON.parse(File.read(report_json_path)) }
        let(:test_cases) { report_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 amount of TestCases' do
            expect(subject.filter(test_cases).count).to eql(8)
          end

          it 'returns only failed TestCases' do
            expect(subject.filter(test_cases).all?(&:failure?)).to be_truthy
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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