Sha256: 0dd1ce376d83bba821f3ac516b01ebe3a0638e7d87c1d74d27c78da3d02d8398

Contents?: true

Size: 1.52 KB

Versions: 48

Compression:

Stored size: 1.52 KB

Contents

@rspec
Feature: Grouping on RSpec using a custom filter class

  Next to passing a block or a string to define a group, you can also pass
  a filter class. The filter class inherits from SimpleCov::Filter and
  must implement the matches? method, which is used to determine whether
  or not a file should be added to the group.

  Scenario:
    Given SimpleCov for RSpec is configured with:
      """
      require 'simplecov'
      class CoverageFilter < SimpleCov::Filter
        def matches?(source_file)
          source_file.covered_percent < filter_argument
        end
      end
      SimpleCov.start do
        add_group 'By filter class', CoverageFilter.new(90)
        add_group 'By string', 'project/meta_magic'
      end
      """

    When I open the coverage report generated with `bundle exec rspec spec`
    Then I should see the groups:
      | name             | coverage | files |
      | All Files        | 90.74%   | 6     |
      | By filter class  | 78.26%   | 2     |
      | By string        | 100.0%   | 1     |
      | Ungrouped        | 100.0%   | 3     |

    And I should see the source files:
      | name                                    | coverage |
      | lib/faked_project/framework_specific.rb | 75.0 %   |
      | lib/faked_project/some_class.rb         | 80.0 %   |
      | lib/faked_project.rb                    | 100.0 %  |
      | lib/faked_project/meta_magic.rb         | 100.0 %  |
      | spec/meta_magic_spec.rb                 | 100.0 %  |
      | spec/some_class_spec.rb                 | 100.0 %  |

Version data entries

48 entries across 38 versions & 6 rubygems

Version Path
simplecov-0.8.2 features/rspec_groups_using_filter_class.feature
simplecov-0.8.1 features/rspec_groups_using_filter_class.feature
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
candlepin-api-0.4.0 bundle/ruby/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
simplecov-0.8.0.pre2 features/rspec_groups_using_filter_class.feature
challah-1.0.0 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-1.0.0.beta3 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-1.0.0.beta2 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-1.0.0.beta vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
simplecov-0.8.0.pre features/rspec_groups_using_filter_class.feature
challah-0.9.1.beta.3 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
devise_sociable-0.1.0 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-0.9.1.beta vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-0.9.0 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.6.4/features/rspec_groups_using_filter_class.feature
challah-rolls-0.2.0 vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/simplecov-0.6.4/features/rspec_groups_using_filter_class.feature
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/simplecov-0.7.1/features/rspec_groups_using_filter_class.feature