Sha256: 9e09ac83d19e8ad63635ddda6e7ee2e6ed8afd54130b83b68a937efaac263157

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

module Learn
  class SpecTypeParser
    attr_reader :spec_type

    def initialize
      @spec_type = parse_spec_type
    end

    private

    def parse_spec_type
      files = Dir.entries('.')

      if files.include?('requires.yml')
        'jasmine'
      elsif files.any? {|f| f.match(/.*.py$/) }
        'python_unittest'
      elsif files.include?('spec')
        spec_files = Dir.entries('./spec')
        if spec_files.include?('spec_helper.rb') || spec_files.include?('rails_helper.rb')
          'rspec'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
learn-co-1.0.4 lib/learn/spec_type_parser.rb
learn-co-1.0.3 lib/learn/spec_type_parser.rb
learn-co-1.0.2 lib/learn/spec_type_parser.rb
learn-co-1.0.1 lib/learn/spec_type_parser.rb
learn-co-1.0.0 lib/learn/spec_type_parser.rb