Sha256: 9a75975ccdc0a1c7839a404666a74ef2b87df4ceaa61b42a699dd9e5f9fb0dde

Contents?: true

Size: 958 Bytes

Versions: 5

Compression:

Stored size: 958 Bytes

Contents

module SpecTracker
  module SpecParser
    class BaseParser
      def parse(path)
        specifications = []
        if spec_path(path).directory?
          spec_path(path).each_entry do |entry|
            next unless entry.extname == spec_file_extension
            scenarios = parse_single(spec_path(path).join(entry.basename))
            specifications << Specification.new(topic: entry.basename, scenarios: scenarios)
          end
        else
          scenarios = parse_single(spec_path(path))
          specifications << Specification.new(topic: spec_path(path).basename, scenarios: scenarios)
        end
        specifications
      end

      protected

      def spec_file_extension
        raise Error.new('override me!')
      end

      def parse_single(spec_file)
        raise Error.new('override me!')
      end

      private

      def spec_path(path)
        SpecTracker.configuration.local_path.join(path)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spec_tracker-1.2.4 lib/spec_tracker/spec_parser/base_parser.rb
spec_tracker-1.2.3 lib/spec_tracker/spec_parser/base_parser.rb
spec_tracker-1.2.2 lib/spec_tracker/spec_parser/base_parser.rb
spec_tracker-1.2.1 lib/spec_tracker/spec_parser/base_parser.rb
spec_tracker-1.2.0 lib/spec_tracker/spec_parser/base_parser.rb