Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Serghei Moret committed Mar 20, 2021
1 parent f64fa77 commit f1cb8a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion spec/docker_commander_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
let(:container_name) { 'abcdef123' }

it 'executes commands inside docker if container name is specified' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i abcdef123 bash -l -c "do stuff"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec abcdef123 bash -l -c "do stuff"')
docker_commander.exec(command: 'do stuff')
end
end
Expand Down
18 changes: 9 additions & 9 deletions spec/emulator_commander_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@

describe '#disable_animations' do
it 'disables emulator animation' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb shell settings put global window_animation_scale 0.0"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb shell settings put global transition_animation_scale 0.0"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb shell settings put global animator_duration_scale 0.0"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb shell settings put global window_animation_scale 0.0"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb shell settings put global transition_animation_scale 0.0"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb shell settings put global animator_duration_scale 0.0"')

emulator_commander.disable_animations
end
end

describe '#increase_logcat_storage' do
it 'increases_logcat_storage' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb logcat -G 16m"')
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb logcat -G 16m"')
emulator_commander.increase_logcat_storage
end
end

describe '#emulator_is_healthy?' do
it 'returns true if emulator is healthy' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(emulator_commander.emulator_is_healthy?).to be true
end

it 'returns false if emulator is unhealthy' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb devices"').and_return("emulator_5554 \tunauthorized")
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb devices"').and_return("emulator_5554 \tunauthorized")
expect(emulator_commander.emulator_is_healthy?).to be false
end
end

describe '#check_connection' do
it 'returns false if simulator is unhealthy' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb devices"').and_return("emulator_5554 \tunauthorized")
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb devices"').and_return("emulator_5554 \tunauthorized")
expect(emulator_commander.check_connection).to be false
end

it 'returns true if simulator is healthy' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(emulator_commander.check_connection).to be true
end

it 'prints a success message if simulator is healthy' do
expect(Fastlane::Actions).to receive(:sh).with('docker exec -i a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(Fastlane::Actions).to receive(:sh).with('docker exec a_name bash -l -c "adb devices"').and_return("emulator_5554 \tdevice")
expect(Fastlane::UI).to receive(:success).with('Checking if emulator is connected to ADB.')
expect(Fastlane::UI).to receive(:success).with('Emulator connected successfully')
emulator_commander.check_connection
Expand Down

0 comments on commit f1cb8a6

Please sign in to comment.