0ce6785851
Replaces all the explicit include metadata syntax in the specs (tag: true) into the implicit one (:tag). Added a cop to prevent future errors and handle autocorrection.
19 lines
772 B
Ruby
19 lines
772 B
Ruby
require 'spec_helper'
|
|
|
|
describe Gitlab::Checks::ForcePush do
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
context "exit code checking", :skip_gitaly_mock do
|
|
it "does not raise a runtime error if the `popen` call to git returns a zero exit code" do
|
|
allow_any_instance_of(Gitlab::Git::RevList).to receive(:popen).and_return(['normal output', 0])
|
|
|
|
expect { described_class.force_push?(project, 'oldrev', 'newrev') }.not_to raise_error
|
|
end
|
|
|
|
it "raises a runtime error if the `popen` call to git returns a non-zero exit code" do
|
|
allow_any_instance_of(Gitlab::Git::RevList).to receive(:popen).and_return(['error', 1])
|
|
|
|
expect { described_class.force_push?(project, 'oldrev', 'newrev') }.to raise_error(RuntimeError)
|
|
end
|
|
end
|
|
end
|