simctl 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +16 -7
- data/README.md +4 -4
- data/Rakefile +3 -8
- data/lib/simctl.rb +5 -0
- data/lib/simctl/command.rb +6 -4
- data/lib/simctl/command/install.rb +0 -2
- data/lib/simctl/command/io.rb +23 -0
- data/lib/simctl/command/list.rb +0 -2
- data/lib/simctl/device.rb +12 -8
- data/lib/simctl/executor.rb +1 -1
- data/lib/simctl/version.rb +1 -1
- data/lib/simctl/xcode_version.rb +11 -0
- data/simctl.gemspec +2 -3
- data/{test → spec}/SampleApp/.gitignore +0 -0
- data/{test → spec}/SampleApp/SampleApp.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- data/{test → spec}/SampleApp/SampleApp/AppDelegate.h +0 -0
- data/{test → spec}/SampleApp/SampleApp/AppDelegate.m +0 -0
- data/{test → spec}/SampleApp/SampleApp/Info.plist +0 -0
- data/{test → spec}/SampleApp/SampleApp/main.m +0 -0
- data/spec/simctl/device_interaction_spec.rb +242 -0
- data/spec/simctl/executor_spec.rb +23 -0
- data/spec/simctl/list_spec.rb +97 -0
- data/{test/simctl/readme_test.rb → spec/simctl/readme_spec.rb} +6 -6
- data/spec/spec_helper.rb +36 -0
- metadata +31 -43
- data/test/simctl/crud_test.rb +0 -137
- data/test/simctl/executor_test.rb +0 -22
- data/test/simctl/list_test.rb +0 -86
- data/test/test_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23e929d60bc574b9e16e479b4754d40fa393cda0
|
4
|
+
data.tar.gz: 06d72f6aca738f535b9517bdaacb3606ab17548b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37521cf964d7b1cc61c591beb0a77d2b0f0a54973d5a89ab10694aa9b7cb45329704d89064451ce22e36871bfb4296ca33c92b6894cb588c6cbf67fad43048d5
|
7
|
+
data.tar.gz: 83480c3189051338b6d75fd8601847111a4bf61b1e9d94d9421ab27e6e47d44aece6ea47ff8713a3c81a7ab8ef4a81d807bcc1f78a068c576c77a5a9bdbf24c3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simctl (1.5.
|
4
|
+
simctl (1.5.8)
|
5
5
|
CFPropertyList
|
6
6
|
naturally
|
7
7
|
|
@@ -16,16 +16,14 @@ GEM
|
|
16
16
|
term-ansicolor (~> 1.3)
|
17
17
|
thor (~> 0.19.1)
|
18
18
|
tins (~> 1.6.0)
|
19
|
+
diff-lcs (1.2.5)
|
19
20
|
docile (1.1.5)
|
20
21
|
domain_name (0.5.25)
|
21
22
|
unf (>= 0.0.5, < 1.0.0)
|
22
23
|
http-cookie (1.0.2)
|
23
24
|
domain_name (~> 0.5)
|
24
25
|
json (1.8.3)
|
25
|
-
maxitest (1.5.4)
|
26
|
-
minitest (>= 5.0.0, < 5.9.0)
|
27
26
|
mime-types (2.99)
|
28
|
-
minitest (5.8.5)
|
29
27
|
naturally (2.1.0)
|
30
28
|
netrc (0.11.0)
|
31
29
|
rake (10.4.2)
|
@@ -33,7 +31,19 @@ GEM
|
|
33
31
|
http-cookie (>= 1.0.2, < 2.0)
|
34
32
|
mime-types (>= 1.16, < 3.0)
|
35
33
|
netrc (~> 0.7)
|
36
|
-
|
34
|
+
rspec (3.5.0)
|
35
|
+
rspec-core (~> 3.5.0)
|
36
|
+
rspec-expectations (~> 3.5.0)
|
37
|
+
rspec-mocks (~> 3.5.0)
|
38
|
+
rspec-core (3.5.4)
|
39
|
+
rspec-support (~> 3.5.0)
|
40
|
+
rspec-expectations (3.5.0)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.5.0)
|
43
|
+
rspec-mocks (3.5.0)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.5.0)
|
46
|
+
rspec-support (3.5.0)
|
37
47
|
simplecov (0.11.1)
|
38
48
|
docile (~> 1.1.0)
|
39
49
|
json (~> 1.8)
|
@@ -52,9 +62,8 @@ PLATFORMS
|
|
52
62
|
|
53
63
|
DEPENDENCIES
|
54
64
|
coveralls
|
55
|
-
maxitest
|
56
65
|
rake
|
57
|
-
|
66
|
+
rspec
|
58
67
|
simctl!
|
59
68
|
|
60
69
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/plu/simctl) [](https://badge.fury.io/rb/simctl) [](https://coveralls.io/github/plu/simctl?branch=master)
|
4
4
|
|
5
|
-
Ruby interface to xcrun simctl. Manage your iOS Simulators directly from a ruby script.
|
5
|
+
Ruby interface to xcrun simctl. Manage your iOS Simulators directly from a ruby script.
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
require 'simctl'
|
11
11
|
|
12
|
-
# Select the iOS 9.
|
13
|
-
runtime = SimCtl.runtime(name: 'iOS 9.
|
12
|
+
# Select the iOS 9.3 runtime
|
13
|
+
runtime = SimCtl.runtime(name: 'iOS 9.3')
|
14
14
|
|
15
15
|
# Select the iPhone 5 device type
|
16
16
|
devicetype = SimCtl.devicetype(name: 'iPhone 5')
|
17
17
|
|
18
18
|
# Create a new device
|
19
|
-
device = SimCtl.create_device 'Unit Tests @ iPhone 5 9.
|
19
|
+
device = SimCtl.create_device 'Unit Tests @ iPhone 5 9.3', devicetype, runtime
|
20
20
|
|
21
21
|
# Launch a new Simulator.app instance
|
22
22
|
device.launch!
|
data/Rakefile
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require 'bundler/gem_tasks'
|
3
|
-
require '
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
|
-
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << 'lib' << 'test'
|
8
|
-
t.pattern = 'test/**/*_test.rb'
|
9
|
-
t.verbose = true
|
10
|
-
end
|
5
|
+
RSpec::Core::RakeTask.new(:rspec)
|
11
6
|
|
12
7
|
desc 'Default: Execute simctl tests'
|
13
|
-
task default: :
|
8
|
+
task default: :rspec
|
data/lib/simctl.rb
CHANGED
@@ -3,8 +3,13 @@ require 'simctl/device'
|
|
3
3
|
require 'simctl/device_type'
|
4
4
|
require 'simctl/list'
|
5
5
|
require 'simctl/runtime'
|
6
|
+
require 'simctl/xcode_version'
|
6
7
|
|
7
8
|
module SimCtl
|
9
|
+
class UnsupportedCommandError < StandardError; end
|
10
|
+
class DeviceTypeNotFound < StandardError; end
|
11
|
+
class RuntimeNotFound < StandardError; end
|
12
|
+
|
8
13
|
@@default_timeout = 15
|
9
14
|
|
10
15
|
class << self
|
data/lib/simctl/command.rb
CHANGED
@@ -3,14 +3,15 @@ require 'simctl/command/create'
|
|
3
3
|
require 'simctl/command/delete'
|
4
4
|
require 'simctl/command/erase'
|
5
5
|
require 'simctl/command/install'
|
6
|
-
require 'simctl/command/
|
6
|
+
require 'simctl/command/io'
|
7
7
|
require 'simctl/command/kill'
|
8
8
|
require 'simctl/command/launch'
|
9
9
|
require 'simctl/command/list'
|
10
|
+
require 'simctl/command/openurl'
|
10
11
|
require 'simctl/command/rename'
|
11
12
|
require 'simctl/command/reset'
|
12
13
|
require 'simctl/command/shutdown'
|
13
|
-
require 'simctl/command/
|
14
|
+
require 'simctl/command/uninstall'
|
14
15
|
require 'simctl/executor'
|
15
16
|
require 'shellwords'
|
16
17
|
|
@@ -22,15 +23,16 @@ module SimCtl
|
|
22
23
|
include SimCtl::Command::Create
|
23
24
|
include SimCtl::Command::Delete
|
24
25
|
include SimCtl::Command::Erase
|
26
|
+
include SimCtl::Command::IO
|
25
27
|
include SimCtl::Command::Install
|
26
|
-
include SimCtl::Command::Uninstall
|
27
28
|
include SimCtl::Command::Kill
|
28
29
|
include SimCtl::Command::Launch
|
29
30
|
include SimCtl::Command::List
|
31
|
+
include SimCtl::Command::OpenUrl
|
30
32
|
include SimCtl::Command::Rename
|
31
33
|
include SimCtl::Command::Reset
|
32
34
|
include SimCtl::Command::Shutdown
|
33
|
-
include SimCtl::Command::
|
35
|
+
include SimCtl::Command::Uninstall
|
34
36
|
|
35
37
|
def device_set_path=(device_set_path)
|
36
38
|
@device_set_path = File.expand_path(device_set_path)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
module SimCtl
|
4
|
+
class Command
|
5
|
+
module IO
|
6
|
+
# Saves a screenshot to a file
|
7
|
+
#
|
8
|
+
# @param device [SimCtl::Device] the device the screenshot should be taken from
|
9
|
+
# @param file Path where the screenshot should be saved to
|
10
|
+
# @param opts Optional hash that supports two keys:
|
11
|
+
# * type: Can be png, tiff, bmp, gif, jpeg (default is png)
|
12
|
+
# * display: Can be main or tv for iOS, tv for tvOS and main for watchOS
|
13
|
+
# @return [void]
|
14
|
+
def screenshot(device, file, opts={})
|
15
|
+
unless XcodeVersion.gte? '8.2'
|
16
|
+
raise UnsupportedCommandError.new('Needs at least Xcode 8.2')
|
17
|
+
end
|
18
|
+
optional_args = opts.map {|k,v| "--#{k}=#{Shellwords.shellescape(v)}"}
|
19
|
+
Executor.execute(command_for('io', device.udid, 'screenshot', *optional_args, Shellwords.shellescape(file)))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/simctl/command/list.rb
CHANGED
data/lib/simctl/device.rb
CHANGED
@@ -30,14 +30,6 @@ module SimCtl
|
|
30
30
|
@devicetype ||= SimCtl.devicetype(identifier: plist.deviceType)
|
31
31
|
end
|
32
32
|
|
33
|
-
# <b>DEPRECATED:</b> Please use <tt>device.settings.disable_keyboard_helpers!</tt> instead.
|
34
|
-
# Disables the keyboard helpers
|
35
|
-
#
|
36
|
-
# @return [void]
|
37
|
-
def disable_keyboard_helpers!
|
38
|
-
settings.disable_keyboard_helpers!
|
39
|
-
end
|
40
|
-
|
41
33
|
# Erases the device
|
42
34
|
#
|
43
35
|
# @return [void]
|
@@ -112,6 +104,7 @@ module SimCtl
|
|
112
104
|
# @return [void]
|
113
105
|
def rename!(name)
|
114
106
|
SimCtl.rename_device(self, name)
|
107
|
+
@name = name
|
115
108
|
end
|
116
109
|
|
117
110
|
# Resets the device
|
@@ -128,6 +121,17 @@ module SimCtl
|
|
128
121
|
@runtime ||= SimCtl.runtime(identifier: plist.runtime)
|
129
122
|
end
|
130
123
|
|
124
|
+
# Saves a screenshot to a file
|
125
|
+
#
|
126
|
+
# @param file Path where the screenshot should be saved to
|
127
|
+
# @param opts Optional hash that supports two keys:
|
128
|
+
# * type: Can be png, tiff, bmp, gif, jpeg (default is png)
|
129
|
+
# * display: Can be main or tv for iOS, tv for tvOS and main for watchOS
|
130
|
+
# @return [void]
|
131
|
+
def screenshot!(file, opts={})
|
132
|
+
SimCtl.screenshot(self, file, opts)
|
133
|
+
end
|
134
|
+
|
131
135
|
# Returns the settings object
|
132
136
|
#
|
133
137
|
# @ return [SimCtl::DeviceSettings]
|
data/lib/simctl/executor.rb
CHANGED
data/lib/simctl/version.rb
CHANGED
data/simctl.gemspec
CHANGED
@@ -18,10 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
|
-
s.add_development_dependency 'rake'
|
22
|
-
s.add_development_dependency 'maxitest'
|
23
|
-
s.add_development_dependency 'shoulda-context'
|
24
21
|
s.add_development_dependency 'coveralls'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'rspec'
|
25
24
|
|
26
25
|
s.add_dependency 'CFPropertyList'
|
27
26
|
s.add_dependency 'naturally'
|
File without changes
|
File without changes
|
data/{test → spec}/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,242 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe SimCtl, order: :defined do
|
5
|
+
before(:all) do
|
6
|
+
@name = SecureRandom.hex
|
7
|
+
@devicetype = SimCtl.devicetype(name: 'iPhone 5')
|
8
|
+
@runtime = SimCtl::Runtime.latest(:ios)
|
9
|
+
@device = SimCtl.create_device @name, @devicetype, @runtime
|
10
|
+
@device.wait! {|d| d.state == :shutdown}
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
with_rescue { @device.kill! }
|
15
|
+
with_rescue { @device.wait! {|d| d.state == :shutdown} }
|
16
|
+
with_rescue { @device.delete! }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'creating a device' do
|
20
|
+
it 'raises exception if devicetype lookup failed' do
|
21
|
+
expect { SimCtl.create_device @name, 'invalid devicetype', @runtime }.to raise_error SimCtl::DeviceTypeNotFound
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'raises exception if runtime lookup failed' do
|
25
|
+
expect { SimCtl.create_device @name, @devicetype, 'invalid runtime' }.to raise_error SimCtl::RuntimeNotFound
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'device properties' do
|
30
|
+
it 'is a device' do
|
31
|
+
expect(@device).to be_kind_of SimCtl::Device
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'has a name property' do
|
35
|
+
expect(@device.name).to be == @name
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'has a devicetype property' do
|
39
|
+
expect(@device.devicetype).to be == @devicetype
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'has a runtime property' do
|
43
|
+
expect(@device.runtime).to be == @runtime
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'has a availability property' do
|
47
|
+
expect(@device.availability).not_to be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'has a os property' do
|
51
|
+
expect(@device.os).not_to be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'state is shutdown' do
|
55
|
+
expect(@device.state).to be == :shutdown
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'device settings' do
|
60
|
+
describe 'update hardware keyboard' do
|
61
|
+
it 'creates the preferences plist' do
|
62
|
+
File.delete(@device.path.preferences_plist) if File.exists?(@device.path.preferences_plist)
|
63
|
+
@device.settings.update_hardware_keyboard!(false)
|
64
|
+
expect(File).to exist(@device.path.preferences_plist)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'disable keyboard helpers' do
|
69
|
+
it 'creates the preferences plist' do
|
70
|
+
File.delete(@device.path.preferences_plist) if File.exists?(@device.path.preferences_plist)
|
71
|
+
@device.settings.disable_keyboard_helpers!
|
72
|
+
expect(File).to exist(@device.path.preferences_plist)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'setting the device language' do
|
77
|
+
it 'sets the device language' do
|
78
|
+
@device.settings.set_language('de')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'finding the device' do
|
84
|
+
it 'finds the device by udid' do
|
85
|
+
expect(SimCtl.device(udid: @device.udid)).to be == @device
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'finds the device by name' do
|
89
|
+
expect(SimCtl.device(name: @device.name)).to be == @device
|
90
|
+
end
|
91
|
+
|
92
|
+
unless SimCtl.device_set_path.nil?
|
93
|
+
it 'finds the device by runtime' do
|
94
|
+
expect(SimCtl.device(runtime: @device.runtime)).to be == @device
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'finds the device by devicetype' do
|
98
|
+
expect(SimCtl.device(devicetype: @device.devicetype)).to be == @device
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'finds the device by all given properties' do
|
102
|
+
expect(SimCtl.device(udid: @device.udid, name: @device.name, runtime: @device.runtime, devicetype: @device.devicetype)).to be == @device
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe 'renaming the device' do
|
108
|
+
it 'renames the device' do
|
109
|
+
@device.rename!('new name')
|
110
|
+
expect(@device.name).to be == 'new name'
|
111
|
+
expect(SimCtl.device(udid: @device.udid).name).to be == 'new name'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'erasing the device' do
|
116
|
+
it 'erases the device' do
|
117
|
+
@device.erase!
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe 'launching the device' do
|
122
|
+
it 'launches the device' do
|
123
|
+
@device.launch!
|
124
|
+
@device.wait!{|d| d.state == :booted}
|
125
|
+
expect(@device.state).to be == :booted
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe 'launching a system app' do
|
130
|
+
it 'launches Safari' do
|
131
|
+
@device.launch_app!('com.apple.mobilesafari')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe 'taking a screenshot' do
|
136
|
+
if SimCtl::XcodeVersion.gte? '8.2'
|
137
|
+
it 'takes a screenshot' do
|
138
|
+
file = File.join(Dir.mktmpdir, 'screenshot.png')
|
139
|
+
@device.screenshot!(file)
|
140
|
+
expect(File).to exist(file)
|
141
|
+
end
|
142
|
+
else
|
143
|
+
it 'raises exception' do
|
144
|
+
expect { @device.screenshot!('/tmp/foo.png') }.to raise_error SimCtl::UnsupportedCommandError
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'installing an app' do
|
150
|
+
before(:all) do
|
151
|
+
system 'cd spec/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'installs SampleApp' do
|
155
|
+
@device.install!('spec/SampleApp/build/Release-iphonesimulator/SampleApp.app')
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe 'launching an app' do
|
160
|
+
it 'launches SampleApp' do
|
161
|
+
@device.launch_app!('com.github.plu.simctl.SampleApp')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe 'uninstall an app' do
|
166
|
+
it 'uninstalls SampleApp' do
|
167
|
+
@device.uninstall!('com.github.plu.simctl.SampleApp')
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe 'opening a url' do
|
172
|
+
it 'opens some url' do
|
173
|
+
@device.open_url!('https://www.github.com')
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe 'killing the device' do
|
178
|
+
it 'state is booted' do
|
179
|
+
expect(@device.state).to be == :booted
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'kills the device' do
|
183
|
+
@device.kill!
|
184
|
+
@device.wait!{|d| d.state == :shutdown}
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'state is shutdown' do
|
188
|
+
expect(@device.state).to be == :shutdown
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe 'booting the device' do
|
193
|
+
it 'state is shutdown' do
|
194
|
+
expect(@device.state).to be == :shutdown
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'boots the device' do
|
198
|
+
@device.boot!
|
199
|
+
@device.wait! {|d| d.state == :booted}
|
200
|
+
expect(@device.state).to be == :booted
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'state is booted' do
|
204
|
+
expect(@device.state).to be == :booted
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
describe 'shutting down the device' do
|
209
|
+
it 'state is booted' do
|
210
|
+
expect(@device.state).to be == :booted
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'shuts down the device' do
|
214
|
+
@device.shutdown!
|
215
|
+
@device.wait!{|d| d.state == :shutdown}
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'state is shutdown' do
|
219
|
+
expect(@device.state).to be == :shutdown
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
describe 'resetting the device' do
|
224
|
+
it 'deletes the old device and creates a new one' do
|
225
|
+
new_device = @device.reset!
|
226
|
+
expect(new_device.name).to be == @device.name
|
227
|
+
expect(new_device.devicetype).to be == @device.devicetype
|
228
|
+
expect(new_device.runtime).to be == @device.runtime
|
229
|
+
expect(new_device.udid).not_to be == @device.udid
|
230
|
+
expect(SimCtl.device(udid: @device.udid)).to be_nil
|
231
|
+
@device = new_device
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
describe 'deleting the device' do
|
236
|
+
it 'deletes the device' do
|
237
|
+
device = SimCtl.create_device @name, @devicetype, @runtime
|
238
|
+
device.delete!
|
239
|
+
expect(SimCtl.device(udid: @device.udid)).to be_nil
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SimCtl::Executor do
|
4
|
+
describe '#execute' do
|
5
|
+
it 'raises an exception' do
|
6
|
+
expect { SimCtl::Executor.execute(['xcrun simctl asdf']) }.to raise_error RuntimeError
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns json' do
|
10
|
+
json = SimCtl::Executor.execute(["echo '{\"foo\":\"bar\"}'"]) do |result|
|
11
|
+
result
|
12
|
+
end
|
13
|
+
expect(json).to eql({'foo' => 'bar'})
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns a string' do
|
17
|
+
string = SimCtl::Executor.execute(["echo 'hello world'"]) do |result|
|
18
|
+
result
|
19
|
+
end
|
20
|
+
expect(string).to eql('hello world')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SimCtl do
|
4
|
+
describe '#devicetype' do
|
5
|
+
it 'find device type by name' do
|
6
|
+
expect(SimCtl.devicetype(name: 'iPhone 5')).to be_kind_of SimCtl::DeviceType
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'raise exception if device type is not found' do
|
10
|
+
expect { SimCtl.devicetype(name: 'iPhone 1') }.to raise_error SimCtl::DeviceTypeNotFound
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#list_devicetypes' do
|
15
|
+
it 'contains some devicetypes' do
|
16
|
+
expect(SimCtl.list_devicetypes.count).to be > 0
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is a SimCtl::DeviceType object' do
|
20
|
+
expect(SimCtl.list_devicetypes.first).to be_kind_of SimCtl::DeviceType
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'parses identifier property' do
|
24
|
+
expect(SimCtl.list_devicetypes.first.identifier).not_to be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'parses name property' do
|
28
|
+
expect(SimCtl.list_devicetypes.first.name).not_to be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#list_runtimes' do
|
33
|
+
it 'contains some runtimes' do
|
34
|
+
expect(SimCtl.list_runtimes.count).to be > 0
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'is a SimCtl::Runtime object' do
|
38
|
+
expect(SimCtl.list_runtimes.first).to be_kind_of SimCtl::Runtime
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'parses availability property' do
|
42
|
+
expect(SimCtl.list_runtimes.first.availability).not_to be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'parses buildversion property' do
|
46
|
+
expect(SimCtl.list_runtimes.first.buildversion).not_to be_nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'parses identifier property' do
|
50
|
+
expect(SimCtl.list_runtimes.first.identifier).not_to be_nil
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'parses name property' do
|
54
|
+
expect(SimCtl.list_runtimes.first.name).not_to be_nil
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'return latest ios runtime' do
|
58
|
+
expect(SimCtl::Runtime.latest(:ios)).to be_kind_of SimCtl::Runtime
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'return latest tvos runtime' do
|
62
|
+
expect(SimCtl::Runtime.latest(:tvos)).to be_kind_of SimCtl::Runtime
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'return latest watchos runtime' do
|
66
|
+
expect(SimCtl::Runtime.latest(:watchos)).to be_kind_of SimCtl::Runtime
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#runtime' do
|
71
|
+
it 'find runtime by name' do
|
72
|
+
expect(SimCtl.runtime(name: 'iOS 9.3')).to be_kind_of SimCtl::Runtime
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'raise exception if runtime is not found' do
|
76
|
+
expect { SimCtl.runtime(name: 'iOS 17.0') }.to raise_error SimCtl::RuntimeNotFound
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'finds the latest runtime' do
|
80
|
+
if SimCtl::XcodeVersion.gte?('8.2')
|
81
|
+
expect(SimCtl::Runtime.latest(:ios).version).to be == '10.2'
|
82
|
+
elsif SimCtl::XcodeVersion.gte?('8.1')
|
83
|
+
expect(SimCtl::Runtime.latest(:ios).version).to be == '10.1'
|
84
|
+
elsif SimCtl::XcodeVersion.gte?('8.0')
|
85
|
+
expect(SimCtl::Runtime.latest(:ios).version).to be == '10.0'
|
86
|
+
elsif SimCtl::XcodeVersion.gte?('7.3')
|
87
|
+
expect(SimCtl::Runtime.latest(:ios).version).to be == '9.3'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'unknown method' do
|
93
|
+
it 'raise an exception' do
|
94
|
+
expect { SimCtl.foo }.to raise_error NoMethodError
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# Select the iOS 9.
|
6
|
-
runtime = SimCtl.runtime(name: 'iOS 9.
|
3
|
+
RSpec.describe SimCtl do
|
4
|
+
it 'executes example code from readme' do
|
5
|
+
# Select the iOS 9.3 runtime
|
6
|
+
runtime = SimCtl.runtime(name: 'iOS 9.3')
|
7
7
|
|
8
8
|
# Select the iPhone 5 device type
|
9
9
|
devicetype = SimCtl.devicetype(name: 'iPhone 5')
|
10
10
|
|
11
11
|
# Create a new device
|
12
|
-
device = SimCtl.create_device 'Unit Tests @ iPhone 5 9.
|
12
|
+
device = SimCtl.create_device 'Unit Tests @ iPhone 5 9.3', devicetype, runtime
|
13
13
|
|
14
14
|
# Launch a new Simulator.app instance
|
15
15
|
device.launch!
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec'
|
5
|
+
end
|
6
|
+
Coveralls.wear!
|
7
|
+
|
8
|
+
$LOAD_PATH.push File.expand_path("../../lib", __FILE__)
|
9
|
+
require File.dirname(__FILE__) + '/../lib/simctl.rb'
|
10
|
+
|
11
|
+
if ENV['TRAVIS']
|
12
|
+
SimCtl.default_timeout = 300
|
13
|
+
end
|
14
|
+
|
15
|
+
unless ENV['CUSTOM_DEVICE_SET_PATH'] == 'false'
|
16
|
+
SimCtl.device_set_path = Dir.mktmpdir 'foo bar'
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.tty = true
|
21
|
+
|
22
|
+
config.expect_with :rspec do |c|
|
23
|
+
c.syntax = :expect
|
24
|
+
end
|
25
|
+
|
26
|
+
config.mock_with :rspec do |c|
|
27
|
+
c.syntax = :expect
|
28
|
+
end
|
29
|
+
|
30
|
+
def with_rescue(&block)
|
31
|
+
begin
|
32
|
+
block.class
|
33
|
+
rescue
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,31 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Plunien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: maxitest
|
14
|
+
name: coveralls
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
@@ -39,7 +25,7 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
@@ -53,7 +39,7 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: rspec
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
@@ -117,6 +103,7 @@ files:
|
|
117
103
|
- lib/simctl/command/delete.rb
|
118
104
|
- lib/simctl/command/erase.rb
|
119
105
|
- lib/simctl/command/install.rb
|
106
|
+
- lib/simctl/command/io.rb
|
120
107
|
- lib/simctl/command/kill.rb
|
121
108
|
- lib/simctl/command/launch.rb
|
122
109
|
- lib/simctl/command/list.rb
|
@@ -134,19 +121,20 @@ files:
|
|
134
121
|
- lib/simctl/object.rb
|
135
122
|
- lib/simctl/runtime.rb
|
136
123
|
- lib/simctl/version.rb
|
124
|
+
- lib/simctl/xcode_version.rb
|
137
125
|
- simctl.gemspec
|
138
|
-
-
|
139
|
-
-
|
140
|
-
-
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
145
|
-
-
|
146
|
-
-
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
126
|
+
- spec/SampleApp/.gitignore
|
127
|
+
- spec/SampleApp/SampleApp.xcodeproj/project.pbxproj
|
128
|
+
- spec/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
129
|
+
- spec/SampleApp/SampleApp/AppDelegate.h
|
130
|
+
- spec/SampleApp/SampleApp/AppDelegate.m
|
131
|
+
- spec/SampleApp/SampleApp/Info.plist
|
132
|
+
- spec/SampleApp/SampleApp/main.m
|
133
|
+
- spec/simctl/device_interaction_spec.rb
|
134
|
+
- spec/simctl/executor_spec.rb
|
135
|
+
- spec/simctl/list_spec.rb
|
136
|
+
- spec/simctl/readme_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
150
138
|
homepage: https://github.com/plu/simctl
|
151
139
|
licenses:
|
152
140
|
- MIT
|
@@ -172,15 +160,15 @@ signing_key:
|
|
172
160
|
specification_version: 4
|
173
161
|
summary: Ruby interface to xcrun simctl
|
174
162
|
test_files:
|
175
|
-
-
|
176
|
-
-
|
177
|
-
-
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
163
|
+
- spec/SampleApp/.gitignore
|
164
|
+
- spec/SampleApp/SampleApp.xcodeproj/project.pbxproj
|
165
|
+
- spec/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
166
|
+
- spec/SampleApp/SampleApp/AppDelegate.h
|
167
|
+
- spec/SampleApp/SampleApp/AppDelegate.m
|
168
|
+
- spec/SampleApp/SampleApp/Info.plist
|
169
|
+
- spec/SampleApp/SampleApp/main.m
|
170
|
+
- spec/simctl/device_interaction_spec.rb
|
171
|
+
- spec/simctl/executor_spec.rb
|
172
|
+
- spec/simctl/list_spec.rb
|
173
|
+
- spec/simctl/readme_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
data/test/simctl/crud_test.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class SimCtl::CRUDTest < Minitest::Test
|
5
|
-
order_dependent!
|
6
|
-
|
7
|
-
udid = nil
|
8
|
-
name = SecureRandom.hex
|
9
|
-
devicetype = 'iPhone 5'
|
10
|
-
|
11
|
-
should 'raise exception if devicetype lookup failed' do
|
12
|
-
assert_raises { SimCtl.create_device SecureRandom.hex, 'invalid devicetype', SimCtl::Runtime.latest(:ios) }
|
13
|
-
end
|
14
|
-
|
15
|
-
should 'raise exception if runtime lookup failed' do
|
16
|
-
assert_raises { SimCtl.create_device name, SimCtl::DeviceType.find(name: devicetype), 'invalid runtime' }
|
17
|
-
end
|
18
|
-
|
19
|
-
should '0100. create a new device' do
|
20
|
-
device = SimCtl.create_device name, devicetype, SimCtl::Runtime.latest(:ios)
|
21
|
-
device.wait! {|d| d.state == :shutdown}
|
22
|
-
udid = device.udid
|
23
|
-
end
|
24
|
-
|
25
|
-
should '0200. find the device by udid' do
|
26
|
-
device = SimCtl.device(udid: udid)
|
27
|
-
assert_kind_of SimCtl::Device, device
|
28
|
-
assert device.availability != nil
|
29
|
-
assert device.name == name
|
30
|
-
assert device.os != nil
|
31
|
-
assert device.state != nil
|
32
|
-
assert device.udid != nil
|
33
|
-
end
|
34
|
-
|
35
|
-
should '0300. find the device by name' do
|
36
|
-
assert SimCtl.device(name: name).udid == udid
|
37
|
-
assert SimCtl.device(name: name) == SimCtl.device(udid: udid)
|
38
|
-
end
|
39
|
-
|
40
|
-
should '0400. have devicetype property' do
|
41
|
-
assert SimCtl.device(udid: udid).devicetype == SimCtl.devicetype(name: devicetype)
|
42
|
-
end
|
43
|
-
|
44
|
-
should '0500. have runtime property' do
|
45
|
-
assert SimCtl.device(udid: udid).runtime == SimCtl::Runtime.latest(:ios)
|
46
|
-
end
|
47
|
-
|
48
|
-
should '0600. rename the device' do
|
49
|
-
SimCtl.device(udid: udid).rename!('new name')
|
50
|
-
assert SimCtl.device(udid: udid).name == 'new name'
|
51
|
-
end
|
52
|
-
|
53
|
-
should '0700. erase the device' do
|
54
|
-
SimCtl.device(udid: udid).erase!
|
55
|
-
end
|
56
|
-
|
57
|
-
should '0800. launch the device' do
|
58
|
-
device = SimCtl.device(udid: udid)
|
59
|
-
device.launch!
|
60
|
-
device.wait!{|d| d.state == :booted}
|
61
|
-
end
|
62
|
-
|
63
|
-
should '0810. launch safari' do
|
64
|
-
device = SimCtl.device(udid: udid)
|
65
|
-
device.launch_app!('com.apple.mobilesafari')
|
66
|
-
end
|
67
|
-
|
68
|
-
should '0820. install SampleApp' do
|
69
|
-
system 'cd test/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
|
70
|
-
device = SimCtl.device(udid: udid)
|
71
|
-
device.install!('test/SampleApp/build/Release-iphonesimulator/SampleApp.app')
|
72
|
-
end
|
73
|
-
|
74
|
-
should '0830. launch SampleApp' do
|
75
|
-
system 'cd test/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
|
76
|
-
device = SimCtl.device(udid: udid)
|
77
|
-
device.launch_app!('com.github.plu.simctl.SampleApp')
|
78
|
-
end
|
79
|
-
|
80
|
-
should '0840. open some url' do
|
81
|
-
device = SimCtl.device(udid: udid)
|
82
|
-
device.open_url!('https://www.github.com')
|
83
|
-
end
|
84
|
-
|
85
|
-
should '0850. uninstall SampleApp' do
|
86
|
-
system 'cd test/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
|
87
|
-
device = SimCtl.device(udid: udid)
|
88
|
-
device.install!('test/SampleApp/build/Release-iphonesimulator/SampleApp.app')
|
89
|
-
device.uninstall!('com.github.plu.simctl.SampleApp')
|
90
|
-
end
|
91
|
-
|
92
|
-
should '0900. kill the device' do
|
93
|
-
device = SimCtl.device(udid: udid)
|
94
|
-
assert device.kill!
|
95
|
-
device.wait!{|d| d.state == :shutdown}
|
96
|
-
end
|
97
|
-
|
98
|
-
should '1000. boot the device' do
|
99
|
-
device = SimCtl.device(udid: udid)
|
100
|
-
device.boot!
|
101
|
-
device.wait!{|d| d.state == :booted}
|
102
|
-
end
|
103
|
-
|
104
|
-
should '1100. shutdown the device' do
|
105
|
-
device = SimCtl.device(udid: udid)
|
106
|
-
device.shutdown!
|
107
|
-
device.wait!{|d| d.state == :shutdown}
|
108
|
-
end
|
109
|
-
|
110
|
-
should '1200. disable keyboard helpers' do
|
111
|
-
device = SimCtl.device(udid: udid)
|
112
|
-
device.settings.disable_keyboard_helpers!
|
113
|
-
assert File.exists?(device.path.preferences_plist)
|
114
|
-
end
|
115
|
-
|
116
|
-
should '1300. update hardware keyboard' do
|
117
|
-
device = SimCtl.device(udid: udid)
|
118
|
-
device.settings.update_hardware_keyboard!(false)
|
119
|
-
assert File.exists?(device.path.preferences_plist)
|
120
|
-
end
|
121
|
-
|
122
|
-
should '9800. reset the device' do
|
123
|
-
old_device = SimCtl.device(udid: udid)
|
124
|
-
new_device = old_device.reset!
|
125
|
-
assert old_device.name == new_device.name
|
126
|
-
assert old_device.devicetype == new_device.devicetype
|
127
|
-
assert old_device.runtime == new_device.runtime
|
128
|
-
assert old_device.udid != new_device.udid
|
129
|
-
udid = new_device.udid
|
130
|
-
end
|
131
|
-
|
132
|
-
should '9900. delete the device' do
|
133
|
-
device = SimCtl.device(udid: udid)
|
134
|
-
device.delete!
|
135
|
-
assert_nil SimCtl.device(udid: udid)
|
136
|
-
end
|
137
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class SimCtl::ExecutorTest < Minitest::Test
|
5
|
-
should 'raise exception' do
|
6
|
-
assert_raises { SimCtl::Executor.execute(['xcrun simctl asdf']) }
|
7
|
-
end
|
8
|
-
|
9
|
-
should 'return json' do
|
10
|
-
json = SimCtl::Executor.execute(["echo '{\"foo\":\"bar\"}'"]) do |result|
|
11
|
-
result
|
12
|
-
end
|
13
|
-
assert json == {'foo' => 'bar'}
|
14
|
-
end
|
15
|
-
|
16
|
-
should 'return string' do
|
17
|
-
string = SimCtl::Executor.execute(["echo 'hello world'"]) do |result|
|
18
|
-
result
|
19
|
-
end
|
20
|
-
assert string == 'hello world'
|
21
|
-
end
|
22
|
-
end
|
data/test/simctl/list_test.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SimCtl::ListTest < Minitest::Test
|
4
|
-
context 'devicetype' do
|
5
|
-
should 'find device type by name' do
|
6
|
-
assert_kind_of SimCtl::DeviceType, SimCtl.devicetype(name: 'iPhone 5')
|
7
|
-
end
|
8
|
-
|
9
|
-
should 'raise exception if device type is not found' do
|
10
|
-
assert_raises { SimCtl.devicetype(name: 'iPhone 1') }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'list_devicetypes' do
|
15
|
-
should 'contain some devicetypes' do
|
16
|
-
assert SimCtl.list_devicetypes.count > 0
|
17
|
-
end
|
18
|
-
|
19
|
-
should 'be a SimCtl::DeviceType object' do
|
20
|
-
assert_kind_of SimCtl::DeviceType, SimCtl.list_devicetypes.first
|
21
|
-
end
|
22
|
-
|
23
|
-
should 'parse identifier property' do
|
24
|
-
assert SimCtl.list_devicetypes.first.identifier != nil
|
25
|
-
end
|
26
|
-
|
27
|
-
should 'parse name property' do
|
28
|
-
assert SimCtl.list_devicetypes.first.name != nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'list_runtimes' do
|
33
|
-
should 'contain some runtimes' do
|
34
|
-
assert SimCtl.list_runtimes.count > 0
|
35
|
-
end
|
36
|
-
|
37
|
-
should 'be a SimCtl::Runtime object' do
|
38
|
-
assert_kind_of SimCtl::Runtime, SimCtl.list_runtimes.first
|
39
|
-
end
|
40
|
-
|
41
|
-
should 'parse availability property' do
|
42
|
-
assert SimCtl.list_runtimes.first.availability != nil
|
43
|
-
end
|
44
|
-
|
45
|
-
should 'parse buildversion property' do
|
46
|
-
assert SimCtl.list_runtimes.first.buildversion != nil
|
47
|
-
end
|
48
|
-
|
49
|
-
should 'parse identifier property' do
|
50
|
-
assert SimCtl.list_runtimes.first.identifier != nil
|
51
|
-
end
|
52
|
-
|
53
|
-
should 'parse name property' do
|
54
|
-
assert SimCtl.list_runtimes.first.name != nil
|
55
|
-
end
|
56
|
-
|
57
|
-
should 'return latest ios runtime' do
|
58
|
-
assert_kind_of SimCtl::Runtime, SimCtl::Runtime.latest(:ios)
|
59
|
-
end
|
60
|
-
|
61
|
-
should 'return latest tvos runtime' do
|
62
|
-
assert_kind_of SimCtl::Runtime, SimCtl::Runtime.latest(:tvos)
|
63
|
-
end
|
64
|
-
|
65
|
-
should 'return latest watchos runtime' do
|
66
|
-
assert_kind_of SimCtl::Runtime, SimCtl::Runtime.latest(:watchos)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'runtime' do
|
71
|
-
should 'find runtime by name' do
|
72
|
-
assert_kind_of SimCtl::Runtime, SimCtl.runtime(name: 'iOS 9.3')
|
73
|
-
end
|
74
|
-
|
75
|
-
should 'raise exception if runtime is not found' do
|
76
|
-
assert_raises { SimCtl.runtime(name: 'iOS 17.0') }
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'unknown method' do
|
81
|
-
should 'raise an exception' do
|
82
|
-
assert_raises { SimCtl.foo }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'coveralls'
|
2
|
-
Coveralls.wear!
|
3
|
-
|
4
|
-
require 'maxitest/autorun'
|
5
|
-
require 'shoulda-context'
|
6
|
-
|
7
|
-
$LOAD_PATH.push File.expand_path("../../lib", __FILE__)
|
8
|
-
require File.dirname(__FILE__) + '/../lib/simctl.rb'
|
9
|
-
|
10
|
-
if ENV['TRAVIS']
|
11
|
-
SimCtl.default_timeout = 300
|
12
|
-
end
|
13
|
-
|
14
|
-
unless ENV['CUSTOM_DEVICE_SET_PATH'] == 'false'
|
15
|
-
SimCtl.device_set_path = Dir.mktmpdir 'foo bar'
|
16
|
-
end
|