zucchini-ios 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/config.rb +14 -1
- data/lib/detector.rb +0 -1
- data/lib/version.rb +1 -1
- data/spec/lib/config_spec.rb +19 -8
- data/spec/sample_setup/support/config.yml +4 -0
- data/spec/sample_setup_2/support/config.yml +15 -0
- metadata +4 -2
data/Gemfile.lock
CHANGED
data/lib/config.rb
CHANGED
@@ -10,10 +10,17 @@ module Zucchini
|
|
10
10
|
def self.base_path=(base_path)
|
11
11
|
@@base_path = base_path
|
12
12
|
@@config = YAML::load_file("#{base_path}/support/config.yml")
|
13
|
+
@@default_device_name = nil
|
14
|
+
devices.each do |device_name, device|
|
15
|
+
if device['default']
|
16
|
+
raise "Default device already provided" if @@default_device_name
|
17
|
+
@@default_device_name = device_name
|
18
|
+
end
|
19
|
+
end
|
13
20
|
end
|
14
21
|
|
15
22
|
def self.app
|
16
|
-
device_name = ENV['ZUCCHINI_DEVICE']
|
23
|
+
device_name = ENV['ZUCCHINI_DEVICE'] || @@default_device_name
|
17
24
|
app_path = File.absolute_path(devices[device_name]['app'] || @@config['app'])
|
18
25
|
|
19
26
|
if device_name == 'iOS Simulator' && !File.exists?(app_path)
|
@@ -30,7 +37,13 @@ module Zucchini
|
|
30
37
|
@@config['devices']
|
31
38
|
end
|
32
39
|
|
40
|
+
def self.default_device_name
|
41
|
+
@@default_device_name
|
42
|
+
end
|
43
|
+
|
33
44
|
def self.device(device_name)
|
45
|
+
device_name ||= @@default_device_name
|
46
|
+
raise "Neither default device nor ZUCCHINI_DEVICE environment variable was set" unless device_name
|
34
47
|
raise "Device not listed in config.yml" unless (device = devices[device_name])
|
35
48
|
{
|
36
49
|
:name => device_name,
|
data/lib/detector.rb
CHANGED
@@ -9,7 +9,6 @@ class Zucchini::Detector < Clamp::Command
|
|
9
9
|
@path = File.expand_path(path)
|
10
10
|
Zucchini::Config.base_path = File.exists?("#{path}/feature.zucchini") ? File.dirname(path) : path
|
11
11
|
|
12
|
-
raise "ZUCCHINI_DEVICE environment variable not set" unless ENV['ZUCCHINI_DEVICE']
|
13
12
|
@device = Zucchini::Config.device(ENV['ZUCCHINI_DEVICE'])
|
14
13
|
|
15
14
|
@template = detect_template
|
data/lib/version.rb
CHANGED
data/spec/lib/config_spec.rb
CHANGED
@@ -4,16 +4,27 @@ describe Zucchini::Config do
|
|
4
4
|
before(:all) { Zucchini::Config.base_path = "spec/sample_setup" }
|
5
5
|
|
6
6
|
describe "device" do
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
context "device present in config.yml" do
|
8
|
+
it "should return the device hash" do
|
9
|
+
Zucchini::Config.device("My iDevice").should eq({:name =>"My iDevice", :udid =>"lolffb28d74a6fraj2156090784avasc50725dd0", :screen =>"ipad_ios5"})
|
10
|
+
end
|
10
11
|
end
|
11
|
-
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
context "device not present in config.yml" do
|
14
|
+
it "should raise an error" do
|
15
|
+
expect { Zucchini::Config.device("My Android Phone")}.to raise_error "Device not listed in config.yml"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "default device" do
|
20
|
+
it "should use default device if device name argument is nil" do
|
21
|
+
Zucchini::Config.device(nil).should eq({:name =>"Default Device", :screen =>"low_ios5", :udid => nil})
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should raise error if no default device provided" do
|
25
|
+
Zucchini::Config.base_path = "spec/sample_setup_2"
|
26
|
+
expect { Zucchini::Config.device(nil) }.to raise_error "Neither default device nor ZUCCHINI_DEVICE environment variable was set"
|
27
|
+
end
|
17
28
|
end
|
18
29
|
end
|
19
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zucchini-ios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: clamp
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- spec/sample_setup/support/lib/helpers.coffee
|
118
118
|
- spec/sample_setup/support/masks/retina_ios5.png
|
119
119
|
- spec/sample_setup/support/screens/splash.coffee
|
120
|
+
- spec/sample_setup_2/support/config.yml
|
120
121
|
- spec/spec_helper.rb
|
121
122
|
- templates/feature/feature.zucchini
|
122
123
|
- templates/feature/masks/retina_ios5/.gitkeep
|
@@ -178,4 +179,5 @@ test_files:
|
|
178
179
|
- spec/sample_setup/support/lib/helpers.coffee
|
179
180
|
- spec/sample_setup/support/masks/retina_ios5.png
|
180
181
|
- spec/sample_setup/support/screens/splash.coffee
|
182
|
+
- spec/sample_setup_2/support/config.yml
|
181
183
|
- spec/spec_helper.rb
|