unobtainium 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unobtainium/drivers/appium.rb +5 -11
- data/lib/unobtainium/drivers/selenium.rb +5 -13
- data/lib/unobtainium/drivers/support/util.rb +36 -0
- data/lib/unobtainium/version.rb +1 -1
- data/lib/unobtainium/world.rb +6 -0
- data/spec/config_spec.rb +11 -0
- data/spec/data/driverconfig.yml +3 -0
- data/spec/world_spec.rb +3 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 234ce137a967d3cbf7343bc5dce74f6a3a606339
|
4
|
+
data.tar.gz: 4bd93c4402adf6a379f1037b70958941018e805f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7899a9aefc8410150b42f930d8a770fff850883284026551b25edd9e30bdf152117b5510e88e192b2e21b097346e5cc8e773ee2bdbe945bf5a72a4641032e683
|
7
|
+
data.tar.gz: f718847acf4c4600caa0f5a7b37dd76c0e5cf468b3d1993582aae3bdfbb2092d4fcc94ece7942c6e906029dbc0cf825a6dc491438981b68c140634be9a3c4846
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,9 @@
|
|
6
6
|
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
|
+
|
10
|
+
require_relative './support/util'
|
11
|
+
|
9
12
|
module Unobtainium
|
10
13
|
module Drivers
|
11
14
|
|
@@ -31,6 +34,8 @@ module Unobtainium
|
|
31
34
|
}.freeze
|
32
35
|
|
33
36
|
class << self
|
37
|
+
include ::Unobtainium::Drivers::Utility
|
38
|
+
|
34
39
|
##
|
35
40
|
# Return true if the given label matches this driver implementation,
|
36
41
|
# false otherwise.
|
@@ -84,17 +89,6 @@ module Unobtainium
|
|
84
89
|
|
85
90
|
private
|
86
91
|
|
87
|
-
##
|
88
|
-
# For a recognized label alias, returns a normalized label.
|
89
|
-
def normalize_label(label)
|
90
|
-
LABELS.each do |normalized, aliases|
|
91
|
-
if label == normalized or aliases.include?(label)
|
92
|
-
return normalized
|
93
|
-
end
|
94
|
-
end
|
95
|
-
return nil
|
96
|
-
end
|
97
|
-
|
98
92
|
##
|
99
93
|
# If the driver options include a request for a browser, we can
|
100
94
|
# supplement some missing specs in the options.
|
@@ -6,6 +6,9 @@
|
|
6
6
|
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
|
+
|
10
|
+
require_relative './support/util'
|
11
|
+
|
9
12
|
module Unobtainium
|
10
13
|
module Drivers
|
11
14
|
|
@@ -23,6 +26,8 @@ module Unobtainium
|
|
23
26
|
}.freeze
|
24
27
|
|
25
28
|
class << self
|
29
|
+
include ::Unobtainium::Drivers::Utility
|
30
|
+
|
26
31
|
##
|
27
32
|
# Return true if the given label matches this driver implementation,
|
28
33
|
# false otherwise.
|
@@ -62,19 +67,6 @@ module Unobtainium
|
|
62
67
|
driver = ::Selenium::WebDriver.for(normalize_label(label), options)
|
63
68
|
return driver
|
64
69
|
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
##
|
69
|
-
# For a recognized label alias, returns a normalized label.
|
70
|
-
def normalize_label(label)
|
71
|
-
LABELS.each do |normalized, aliases|
|
72
|
-
if label == normalized or aliases.include?(label)
|
73
|
-
return normalized
|
74
|
-
end
|
75
|
-
end
|
76
|
-
return nil
|
77
|
-
end
|
78
70
|
end # class << self
|
79
71
|
end # class Selenium
|
80
72
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
#
|
3
|
+
# unobtainium
|
4
|
+
# https://github.com/jfinkhaeuser/unobtainium
|
5
|
+
#
|
6
|
+
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
7
|
+
# All rights reserved.
|
8
|
+
#
|
9
|
+
module Unobtainium
|
10
|
+
module Drivers
|
11
|
+
##
|
12
|
+
# Utility code shared by driver implementations
|
13
|
+
module Utility
|
14
|
+
##
|
15
|
+
# For a recognized label alias, returns a normalized label. Requires
|
16
|
+
# the enclosing class to provide a LABELS connstant that is a hash
|
17
|
+
# where keys are the normalized label, and the value is an array of
|
18
|
+
# aliases:
|
19
|
+
#
|
20
|
+
# LABELS = {
|
21
|
+
# foo: [:alias1, :alias2],
|
22
|
+
# bar: [],
|
23
|
+
# }.freeze
|
24
|
+
#
|
25
|
+
# Empty aliases means that there are no aliases for this label.
|
26
|
+
def normalize_label(label)
|
27
|
+
self::LABELS.each do |normalized, aliases|
|
28
|
+
if label == normalized or aliases.include?(label)
|
29
|
+
return normalized
|
30
|
+
end
|
31
|
+
end
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
end # module Utility
|
35
|
+
end # module Drivers
|
36
|
+
end # module Unobtainium
|
data/lib/unobtainium/version.rb
CHANGED
data/lib/unobtainium/world.rb
CHANGED
@@ -57,6 +57,12 @@ module Unobtainium
|
|
57
57
|
# we need to use.
|
58
58
|
if not options.nil? and not options["base"].nil?
|
59
59
|
label = options["base"]
|
60
|
+
|
61
|
+
# Unfortunately, the "base" key may not be recognized by the drivers,
|
62
|
+
# which could lead to errors down the road. Let's remove it; it's reserved
|
63
|
+
# by the Config class, so drivers can't use it anyhow.
|
64
|
+
options = options.dup
|
65
|
+
options.delete("base")
|
60
66
|
end
|
61
67
|
|
62
68
|
# The driver may modify the options; if so, we should let it do that
|
data/spec/config_spec.rb
CHANGED
@@ -105,4 +105,15 @@ describe ::Unobtainium::Config do
|
|
105
105
|
expect(cfg["drivers.branch2.base"]).to eql 'mock'
|
106
106
|
expect(cfg["drivers.leaf.base"]).to eql 'mock'
|
107
107
|
end
|
108
|
+
|
109
|
+
it "extends configuration hashes when the base does not exist" do
|
110
|
+
config = File.join(@data_path, 'driverconfig.yml')
|
111
|
+
cfg = ::Unobtainium::Config.load_config(config)
|
112
|
+
|
113
|
+
# Ensure the hash contains its own value
|
114
|
+
expect(cfg["drivers.base_does_not_exist.some"]).to eql "value"
|
115
|
+
|
116
|
+
# Also ensure the "base" is set properly
|
117
|
+
expect(cfg["drivers.base_does_not_exist.base"]).to eql "nonexistent_base"
|
118
|
+
end
|
108
119
|
end
|
data/spec/data/driverconfig.yml
CHANGED
data/spec/world_spec.rb
CHANGED
@@ -31,7 +31,8 @@ describe ::Unobtainium::World do
|
|
31
31
|
expect(@tester.driver.passed_options["mockoption"]).to eql 42
|
32
32
|
end
|
33
33
|
|
34
|
-
it "extends driver options" do
|
35
|
-
expect(@tester.
|
34
|
+
it "extends driver options, but doesn't pass 'base' on" do
|
35
|
+
expect(@tester.config["drivers.leaf.base"]).to eql "mock"
|
36
|
+
expect(@tester.driver.passed_options["base"]).to be_nil
|
36
37
|
end
|
37
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unobtainium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Finkhaeuser
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/unobtainium/driver.rb
|
113
113
|
- lib/unobtainium/drivers/appium.rb
|
114
114
|
- lib/unobtainium/drivers/selenium.rb
|
115
|
+
- lib/unobtainium/drivers/support/util.rb
|
115
116
|
- lib/unobtainium/pathed_hash.rb
|
116
117
|
- lib/unobtainium/recursive_merge.rb
|
117
118
|
- lib/unobtainium/runtime.rb
|