Top Level Namespace

Defined Under Namespace

Modules: KrakenMobile

Instance Method Summary collapse

Instance Method Details

#ensure_feature_has_unique_tags(file_path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kraken-mobile/helpers/feature_analyzer.rb', line 10

def ensure_feature_has_unique_tags file_path
  parser = Gherkin::Parser.new
  file = open(file_path)
  content = file.read
  gherkin_document = parser.parse(content)
  pickles = Gherkin::Pickles::Compiler.new.compile(gherkin_document)
  tag_hash = {}
  pickles.each do |scenario|
    raise "Scenario '#{scenario[:name]}' can't have more than one @user{int} tag." if scenario[:tags].select{ |tag| tag[:name].start_with? "@user" }.count > 1
    scenario[:tags].each do |tag|
      tag_name = tag[:name]
      if tag_hash[tag_name]
        raise "Tag #{tag_name} is duplicated. Each feature can only have one @user{:int} tag assigned to a scenario."
      else
        tag_hash[tag_name] = tag_name
      end
    end
  end
end

#ensure_features_format(files) ⇒ Object



4
5
6
7
8
# File 'lib/kraken-mobile/helpers/feature_analyzer.rb', line 4

def ensure_features_format files
  files.each do |file_path|
    ensure_feature_has_unique_tags file_path
  end
end

#requested_protocolObject



9
10
11
12
13
14
15
16
# File 'lib/kraken-mobile/runners/calabash/android/cucumber.rb', line 9

def requested_protocol
  case ENV["PROTOCOL"]
  when KrakenMobile::Constants::FILE_PROTOCOL
    KrakenMobile::Protocol::FileProtocol
  else
    raise "Invalid Kraken protocol."
  end
end