Module: Calabash::Cucumber::Map

Included in:
Core, InstrumentsActions
Defined in:
lib/calabash-cucumber/map.rb

Overview

> Connection

Instance Method Summary collapse

Instance Method Details

#map(query, method_name, *method_args) ⇒ Object



7
8
9
# File 'lib/calabash-cucumber/map.rb', line 7

def map(query, method_name, *method_args)
  raw_map(query,method_name, *method_args)['results']
end

#raw_map(query, method_name, *method_args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/calabash-cucumber/map.rb', line 11

def raw_map(query, method_name, *method_args)
  operation_map = {
      :method_name => method_name,
      :arguments => method_args
  }
  res = http({:method => :post, :path => 'map'},
             {:query => query, :operation => operation_map})
  res = JSON.parse(res)
  if res['outcome'] != 'SUCCESS'
    screenshot_and_raise "map #{query}, #{method_name} failed because: #{res['reason']}\n#{res['details']}"
  end

  res
end