calabash-cucumber 0.9.80.pre.2 → 0.9.80.pre.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- calabash-cucumber (0.9.80.pre.1)
4
+ calabash-cucumber (0.9.80.pre.3)
5
5
  CFPropertyList
6
6
  cucumber
7
7
  json
8
+ location-one (~> 0.0.5)
8
9
  sim_launcher (= 0.3.8)
9
10
  slowhandcuke
10
11
 
@@ -19,9 +20,13 @@ GEM
19
20
  gherkin (~> 2.11.0)
20
21
  json (>= 1.4.6)
21
22
  diff-lcs (1.1.3)
23
+ geocoder (1.1.2)
22
24
  gherkin (2.11.1)
23
25
  json (>= 1.4.6)
24
26
  json (1.7.3)
27
+ location-one (0.0.5)
28
+ geocoder (~> 1.1)
29
+ json
25
30
  rack (1.4.1)
26
31
  rack-protection (1.2.0)
27
32
  rack
@@ -21,5 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency( "CFPropertyList" )
22
22
  s.add_dependency( "sim_launcher", "0.3.8") #Recommended by Pete for now
23
23
  s.add_dependency( "slowhandcuke" )
24
+ s.add_dependency( "location-one", "~>0.0.5")
24
25
 
25
26
  end
@@ -4,3 +4,4 @@ require 'calabash-cucumber/keyboard_helpers'
4
4
  require 'calabash-cucumber/wait_helpers'
5
5
  require 'calabash-cucumber/operations'
6
6
  require 'calabash-cucumber/version'
7
+ require 'calabash-cucumber/location'
@@ -262,6 +262,23 @@ module Calabash
262
262
 
263
263
  else
264
264
  req = Net::HTTP::Get.new url.path
265
+ if data
266
+ if URI.respond_to?:encode_www_form
267
+ url.query = URI.encode_www_form(data)
268
+ else
269
+ ##suport only "safe" ascii params for now
270
+ url.query = enum.map do |k,v|
271
+ "#{k.to_s}=#{v.to_s}"
272
+ end.join('&')
273
+ end
274
+ resp = Net::HTTP.get_response(url)
275
+ if resp.is_a?Net::HTTPSuccess
276
+ return resp.body
277
+ else
278
+ raise "HTTP-level Error #{resp}"
279
+ end
280
+ end
281
+
265
282
  end
266
283
  make_http_request(url, req)
267
284
  end
@@ -3,6 +3,7 @@ require 'calabash-cucumber/tests_helpers'
3
3
  module Calabash
4
4
  module Cucumber
5
5
  module KeyboardHelpers
6
+ include Calabash::Cucumber::Core
6
7
  include Calabash::Cucumber::TestsHelpers
7
8
 
8
9
  KEYPLANE_NAMES = {
@@ -0,0 +1,26 @@
1
+ require 'location-one'
2
+ require 'geocoder'
3
+
4
+ module Calabash
5
+ module Cucumber
6
+ module Location
7
+ include Calabash::Cucumber::Core
8
+
9
+ def set_location(options)
10
+ uri = url_for('uia')
11
+ client = LocationOne::Client.new({:host => uri.host, :port => uri.port, :path => '/uia'}, @http)
12
+ res = client.change_location(options)
13
+ res = JSON.parse(res)
14
+ if res['outcome'] != 'SUCCESS'
15
+ screenshot_and_raise "set_location #{options}, failed because: #{res['reason']}\n#{res['details']}"
16
+ end
17
+ res['results']
18
+ end
19
+
20
+ def location_for_place(place)
21
+ LocationOne::Client.location_by_place place
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -2,6 +2,7 @@ require 'calabash-cucumber/core'
2
2
  require 'calabash-cucumber/tests_helpers'
3
3
  require 'calabash-cucumber/keyboard_helpers'
4
4
  require 'calabash-cucumber/wait_helpers'
5
+ require 'calabash-cucumber/location'
5
6
  require 'net/http'
6
7
  require 'test/unit/assertions'
7
8
  require 'json'
@@ -23,6 +24,7 @@ module Calabash
23
24
  include Calabash::Cucumber::TestsHelpers
24
25
  include Calabash::Cucumber::WaitHelpers
25
26
  include Calabash::Cucumber::KeyboardHelpers
27
+ include Calabash::Cucumber::Location
26
28
 
27
29
 
28
30
  def home_direction
@@ -65,6 +67,29 @@ module Calabash
65
67
  end
66
68
 
67
69
 
70
+ def set_user_pref(key, val)
71
+ res = http({:method => :post, :path => 'userprefs'},
72
+ {:key=> key, :value => val})
73
+ res = JSON.parse(res)
74
+ if res['outcome'] != 'SUCCESS'
75
+ screenshot_and_raise "set_user_pref #{key} = #{val} failed because: #{res['reason']}\n#{res['details']}"
76
+ end
77
+
78
+ res['results']
79
+ end
80
+
81
+ def user_pref(key)
82
+ res = http({:method => :get, :path => 'userprefs'},
83
+ {:key=> key})
84
+ res = JSON.parse(res)
85
+ if res['outcome'] != 'SUCCESS'
86
+ screenshot_and_raise "get user_pref #{key} failed because: #{res['reason']}\n#{res['details']}"
87
+ end
88
+
89
+ res['results'].first
90
+ end
91
+
92
+
68
93
 
69
94
  #not officially supported yet
70
95
  #def change_slider_value_to(q, value)
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.80.pre.2"
4
- FRAMEWORK_VERSION = "0.9.80.pre.2"
3
+ VERSION = "0.9.80.pre.4"
4
+ FRAMEWORK_VERSION = "0.9.80.pre.3"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.80.pre.2
4
+ version: 0.9.80.pre.4
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-24 00:00:00.000000000 Z
12
+ date: 2012-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: location-one
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.0.5
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.5
94
110
  description: calabash-cucumber drives tests for native iOS apps. You must link your
95
111
  app with calabash-ios-server framework to execute tests.
96
112
  email:
@@ -133,6 +149,7 @@ files:
133
149
  - lib/calabash-cucumber/cucumber.rb
134
150
  - lib/calabash-cucumber/keyboard_helpers.rb
135
151
  - lib/calabash-cucumber/launch/simulator_helper.rb
152
+ - lib/calabash-cucumber/location.rb
136
153
  - lib/calabash-cucumber/operations.rb
137
154
  - lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64
138
155
  - lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64