rubotium 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98f8adacba06f733bb479e15adb159d6e0e3573d
4
- data.tar.gz: ab84bac5542cf856854244aeb94dae7d93e862da
3
+ metadata.gz: 9e9781a5ba16f5293e432aae0106505dbfc12dfd
4
+ data.tar.gz: 57ddec45936548bd2951f3e9ab6508a506fd9ac8
5
5
  SHA512:
6
- metadata.gz: 4836e4d8406b5e1c73d41649c9342b6a4cb9a510cf813d1f0d37bedde6f3c1323c1aa42d1b81f26be3b83e26b080d57b9e0f47e10d874dc3d58890184edbcfa4
7
- data.tar.gz: f7ab6265fb21fc7919db3a5fb938801afcf37e7995bf829e852d4298eb6a31257f00ef205445bc38887677d9a253950845c122611fc4af14fe44e9c98d15f87d
6
+ metadata.gz: bd989f92d2004b97869b55f74c70b550dcbbfccab8316af538ed1fc7f56e76c655bffb7bcf5856a5e77534a84691d28cc7b82d1fa463f3e8bc2fb55228a10cad
7
+ data.tar.gz: c9604c4c2eceef8c520dc08cbca2b63fd9b08efd802a346fc940c4810127aca477adb98cb9644806432ca39481984d4b4e28e1d8476430dbd645950e9712b521
@@ -7,27 +7,27 @@ module Rubotium
7
7
  end
8
8
 
9
9
  def clean_logcat
10
- execute(logcat_command(:clean => true))
10
+ execute(logcat_command(:clean => true)).result
11
11
  end
12
12
 
13
13
  def logcat
14
- execute(logcat_command(:dump => true))
14
+ execute(logcat_command(:dump => true)).result
15
15
  end
16
16
 
17
17
  def install(apk_path)
18
- execute(install_command(apk_path))
18
+ execute(install_command(apk_path)).result
19
19
  end
20
20
 
21
21
  def uninstall(package_name)
22
- execute(uninstall_command(package_name))
22
+ execute(uninstall_command(package_name)).result
23
23
  end
24
24
 
25
25
  def pull(files_glob)
26
- execute(pull_command(files_glob))
26
+ execute(pull_command(files_glob)).result
27
27
  end
28
28
 
29
29
  def push(local_glob, remote_dest)
30
- execute(push_command(local_glob, remote_dest))
30
+ execute(push_command(local_glob, remote_dest)).result
31
31
  end
32
32
 
33
33
  def shell(command)
@@ -44,7 +44,7 @@ module Rubotium
44
44
  end
45
45
  rescue NoMethodError
46
46
  CMD.run_command(adb_command + ' ' + commands)
47
- end.result
47
+ end
48
48
  end
49
49
 
50
50
  private
data/lib/rubotium/cmd.rb CHANGED
@@ -13,7 +13,7 @@ module Rubotium
13
13
  new(command_to_run).execute
14
14
  }
15
15
  rescue Timeout::Error
16
- ""
16
+ CmdResult.new(1, '')
17
17
  end
18
18
  end
19
19
  end
@@ -6,11 +6,11 @@ module Rubotium
6
6
  end
7
7
 
8
8
  def name
9
- @name ||= adb_command.shell('getprop ro.product.model').strip
9
+ @name ||= adb_command.shell('getprop ro.product.model').result.strip
10
10
  end
11
11
 
12
12
  def sdk
13
- @sdk ||= adb_command.shell('getprop ro.build.version.sdk').strip
13
+ @sdk ||= adb_command.shell('getprop ro.build.version.sdk').result.strip
14
14
  end
15
15
 
16
16
  def clean_logcat
@@ -7,7 +7,7 @@ module Rubotium
7
7
  end
8
8
 
9
9
  def read_tests
10
- result = device.shell(instrument_command)
10
+ result = device.shell(instrument_command).result
11
11
  Rubotium::Adb::Parsers::TestResultsParser.new(result).test_results.map{|test|
12
12
  create_runnable_test(test)
13
13
  }
@@ -21,11 +21,21 @@ module Rubotium
21
21
  attr_reader :device, :test_package
22
22
 
23
23
  def execute(command)
24
- Rubotium::Adb::Parsers::TestResultsParser.new(device.shell(command))
24
+ cmd_result = device.shell(command)
25
+ if (cmd_result.status_code == 1)
26
+ Struct.new(
27
+ test_results: [],
28
+ count: 0,
29
+ failed?: true,
30
+ successful?: false,
31
+ time: 0,
32
+ message: "test timed out"
33
+ )
34
+ else
35
+ Rubotium::Adb::Parsers::TestResultsParser.new(cmd_result.result)
36
+ end
25
37
  end
26
38
 
27
-
28
-
29
39
  def instrument_command (runnable_test)
30
40
  "am instrument -w -r -e class #{runnable_test.name} #{test_package.name}/#{test_package.test_runner}"
31
41
  end
@@ -1,3 +1,3 @@
1
1
  module Rubotium
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -16,7 +16,7 @@ describe Rubotium::Adb::Commands::Command do
16
16
  let(:shell_command) { "adb #{adb_command}" }
17
17
 
18
18
  it 'executes the command without a serial' do
19
- expect(subject.execute(command_to_run)).to eq 'result'
19
+ expect(subject.execute(command_to_run).result).to eq 'result'
20
20
  end
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ describe Rubotium::Adb::Commands::Command do
25
25
  let(:shell_command) { "adb #{adb_command}" }
26
26
 
27
27
  it 'executes the command without a serial' do
28
- expect(subject.execute(command_to_run)).to eq 'result'
28
+ expect(subject.execute(command_to_run).result).to eq 'result'
29
29
  end
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ describe Rubotium::Adb::Commands::Command do
34
34
  let(:shell_command) { "adb -s #{serial} #{adb_command}" }
35
35
 
36
36
  it 'executes the command with a serial' do
37
- expect(subject.execute(command_to_run)).to eq 'result'
37
+ expect(subject.execute(command_to_run).result).to eq 'result'
38
38
  end
39
39
  end
40
40
  end
@@ -19,8 +19,8 @@ shared_examples 'a Rubotium::Device' do
19
19
  device.pull(files_to_pull)
20
20
  end
21
21
 
22
- it "knows it's name" do
23
- expect(command).to receive(:shell).with("getprop ro.product.model").and_return('MyNameIs')
22
+ it 'knows its name' do
23
+ expect(command).to receive(:shell).with('getprop ro.product.model').and_return(result)
24
24
  expect(device.name).to eql('MyNameIs')
25
25
  end
26
26
 
@@ -33,7 +33,8 @@ end
33
33
 
34
34
  describe Rubotium::Device do
35
35
  let(:device) { described_class.new(serial) }
36
- let(:command) { double(Rubotium::Adb::Commands::Command)}
36
+ let(:command) { double(Rubotium::Adb::Commands::Command) }
37
+ let(:result) { (OpenStruct.new(:status_code => 0, :result => 'MyNameIs')) }
37
38
 
38
39
  before do
39
40
  device.stub(:adb_command).and_return(command)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubotium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slawomir Smiechura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-16 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler