$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)

unless ENV['CI']
  require 'simplecov'

  CoverageGroup = Struct.new(:name, :regex)

  SimpleCov.start do
    add_filter '/test/'

    groups = [
      CoverageGroup.new('Generator', %r{lib/generator}),
      CoverageGroup.new('Tasks', %r{tasks}),
      CoverageGroup.new('Cases', %r{exercises/.*_case.rb$})
    ]

    groups.each do |group|
      add_group group.name do |file|
        file.filename.match(group.regex)
      end
    end

    add_group 'Other' do |file|
      groups.none? { |group| file.filename.match(group.regex) }
    end
  end
end

require 'minitest/autorun'

# So we can be sure we have coverage on the whole lib directory:
Dir.glob('lib/*.rb').each { |file| require file.gsub(%r{(^lib\/|\.rb$)}, '') }

$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)

unless ENV['CI']
  require 'simplecov'

  CoverageGroup = Struct.new(:name, :regex)

  SimpleCov.start do
    add_filter '/test/'

    groups = [
      CoverageGroup.new('Generator', %r{lib/generator}),
      CoverageGroup.new('Tasks', %r{tasks}),
      CoverageGroup.new('Cases', %r{exercises/.*_case.rb$})
    ]

    groups.each do |group|
      add_group group.name do |file|
        file.filename.match(group.regex)
      end
    end

    add_group 'Other' do |file|
      groups.none? { |group| file.filename.match(group.regex) }
    end
  end
end

require 'minitest/autorun'

# So we can be sure we have coverage on the whole lib directory:
Dir.glob('lib/**/*.rb').each { |file| require file.gsub(%r{(^lib\/|\.rb$)}, '') }

Make sure we're including subdirectories as well.
Make sure we're including subdirectories as well.

The commit that removed require_all didn't include the subdirectories of
`lib` in the test_helper.

This wasn't obvious because if you're testing everything at once it
worked fine because all the files include each other in a useful order.

If you are only testing one file you can run into problems.

Fix this by including files from the subdirectories of `lib/` too.
