Sha256: b8a2e46e7561081fe5645e7533e2ba36b7fbbb8953ebf2e141aee90f47d17bc5

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

# encoding: UTF-8

module CucumberMonitor

  class StepDefinitionFile

    attr_accessor :file

    def self.keywords
      [I18n.t("given"), I18n.t("when"), I18n.t("then"), I18n.t("and"), I18n.t("but")].collect{|c| c[2..-1]}
    end

    def initialize(file)
      @file = file
    end

    def name
      file[0..-9]
    end

    def lines
      f = open(CucumberMonitor::Base.step_definitions_path + '/' + file)
      file_lines = f.readlines
      f.close
      file_lines
    end

    def definitions
      df = []
      lines.each do |line|
        if self.class.keywords.any?{|k| line.include?(k)}
          df << Definition.new(line.strip,self)
        end
      end
      df
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_monitor-0.0.7 lib/cucumber_monitor/step_definition_file.rb