-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
git-fastclone (1.4.1) | ||
git-fastclone (1.4.2) | ||
colorize | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
# Version string for git-fastclone | ||
module GitFastCloneVersion | ||
VERSION = '1.4.1' | ||
VERSION = '1.4.2' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#/bin/bash | ||
|
||
# This script is a sample script used in integration tests that exits with the code passed as the first argument | ||
# Also, it prints all extra arguments | ||
|
||
exit_code="$1" | ||
|
||
if [ $# -gt 1 ]; then | ||
# Skip first argument, which is the exit code | ||
shift | ||
echo "$@" | ||
fi | ||
|
||
exit $exit_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright 2023 Square Inc. | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'spec_helper' | ||
require 'git-fastclone' | ||
|
||
# Integration tests use real demo_tool.sh to inspect the E2E behavior | ||
describe RunnerExecution do | ||
subject { described_class } | ||
let(:external_tool) { "#{__dir__}/../script/spec_demo_tool.sh" } | ||
let(:logger) { double('logger') } | ||
|
||
before do | ||
allow($stdout).to receive(:puts) | ||
allow(logger).to receive(:info) | ||
allow(logger).to receive(:debug) | ||
allow(logger).to receive(:warn) | ||
allow(RunnerExecution).to receive(:logger).and_return(logger) | ||
end | ||
|
||
describe '.fail_on_error' do | ||
it 'should log failure info on command error' do | ||
expect(logger).to receive(:info).with("My error output\n") | ||
|
||
expect do | ||
described_class.fail_on_error(external_tool, '1', 'My error output', quiet: true, | ||
print_on_failure: true) | ||
end.to raise_error(RunnerExecution::RunnerExecutionRuntimeError) | ||
end | ||
|
||
it 'should not log failure output on command success' do | ||
expect($stdout).not_to receive(:info) | ||
|
||
described_class.fail_on_error(external_tool, '0', 'My success output', quiet: true, | ||
print_on_failure: true) | ||
end | ||
|
||
it 'should not log failure output when not in the quiet mode' do | ||
expect($stdout).not_to receive(:info) | ||
|
||
described_class.fail_on_error(external_tool, '0', 'My success output', quiet: false, | ||
print_on_failure: true) | ||
end | ||
end | ||
end |