Sha256: 508d1ecd0d8770bff0906d64cdea36c96163a5eea894cd61d66e4b59b0f8cf79

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

class InstrumentingClass
  include ADB
end

describe ADB::Instrumentation do
  let(:instrumenter) { InstrumentingClass.new }
  let(:runner) { 'com.example/com.example.TestRunner' }
  let(:base_args) { "am instrument " }

  before(:each) do
    instrumenter.stub(:shell)
    instrumenter.stub(:last_stdout).and_return('')
  end

  context "when instrumenting through ADB" do
    it "should be able to run all of the tests" do
      instrumenter.should_receive(:shell).with(*base_args.concat("-w #{runner}"))
      instrumenter.instrument(runner)
    end

    it "should run tests in a single test class only" do
      instrumenter.should_receive(:shell).with(*base_args.concat("-e class com.example.class #{runner}"))
      instrumenter.instrument(runner, :class => 'com.example.class')
    end

    it "should be able to take extra arguments" do
      instrumenter.should_receive(:shell).with(*base_args.concat("-e any thing -e should be -e able to -e be passed -w #{runner}"))
      instrumenter.instrument(runner, :any => 'thing', :should => 'be', :able => 'to', :be => 'passed')
    end

    it "should raise an error if anything is in stderr" do
      instrumenter.stub(:last_stdout).and_return('some problem')
      lambda { instrumenter.instrument(runner) }.should raise_error(exception=ADBError, message="some problem")
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ADB-0.5.6 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5.5 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5.4 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5.3 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5.2 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5.1 spec/lib/ADB/instrumentation_spec.rb
ADB-0.5 spec/lib/ADB/instrumentation_spec.rb