Sha256: 2f833fe8da10e9c447b7fc336293c730d464363d1cd727b4f14275427f79cc33

Contents?: true

Size: 566 Bytes

Versions: 6

Compression:

Stored size: 566 Bytes

Contents

module Defekt
  class Collection
    def initialize(klass)
      @klass = klass
    end

    def all
      @all ||= @klass.descendants.flat_map do |klass|
        klass.instance_methods.grep(/^test_/).map do |methot|
          Test.new(klass.instance_method(methot))
        end
      end
    end

    def passed
      @passed ||= all.select(&:passed?)
    end

    def failed
      @failed ||= all.select(&:failed?)
    end

    def errored
      @errored ||= all.select(&:errored?)
    end

    def broken
      @broken ||= all.select(&:broken?)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
defekt-0.0.7 lib/defekt/collection.rb
defekt-0.0.6 lib/defekt/collection.rb
defekt-0.0.5 lib/defekt/collection.rb
defekt-0.0.4 lib/defekt/collection.rb
defekt-0.0.3 lib/defekt/collection.rb
defekt-0.0.2 lib/defekt/collection.rb