Class: Specific::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/specific/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = 'features') ⇒ Loader

Returns a new instance of Loader.



5
6
7
8
9
10
# File 'lib/specific/loader.rb', line 5

def initialize(path = 'features')
  base_path = File.join(Dir.pwd, path)

  @path = File.join(base_path, '**', '*.feature')
  @spec = Specific::Base.new(base_path)
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



3
4
5
# File 'lib/specific/loader.rb', line 3

def spec
  @spec
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/specific/loader.rb', line 12

def run
  Dir[@path].each do |feature_file|
    feature_definition = File.read(feature_file)
    ast = GherkinRuby.parse(feature_definition)

    processor = Specific::Processor::Gherkin.new(@spec)
    processor.execute(ast)
  end
end