fix rubocop offences
This commit is contained in:
parent
a2074f01a2
commit
96e5b8d9b1
@ -121,17 +121,6 @@ RSpec/RepeatedDescription:
|
|||||||
- 'rubocops/lines_cop_spec.rb'
|
- 'rubocops/lines_cop_spec.rb'
|
||||||
- 'tab_spec.rb'
|
- 'tab_spec.rb'
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
RSpec/RepeatedExample:
|
|
||||||
Exclude:
|
|
||||||
- 'compiler_selector_spec.rb'
|
|
||||||
- 'utils/shell_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
RSpec/ScatteredLet:
|
|
||||||
Exclude:
|
|
||||||
- 'cask/artifact/uninstall_zap_shared_examples.rb'
|
|
||||||
|
|
||||||
# Offense count: 31
|
# Offense count: 31
|
||||||
RSpec/SubjectStub:
|
RSpec/SubjectStub:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
@ -158,6 +158,8 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
|||||||
let(:glob_path1) { Pathname.new("#{dir}/glob_path1") }
|
let(:glob_path1) { Pathname.new("#{dir}/glob_path1") }
|
||||||
let(:glob_path2) { Pathname.new("#{dir}/glob_path2") }
|
let(:glob_path2) { Pathname.new("#{dir}/glob_path2") }
|
||||||
let(:paths) { [absolute_path, path_with_tilde, glob_path1, glob_path2] }
|
let(:paths) { [absolute_path, path_with_tilde, glob_path1, glob_path2] }
|
||||||
|
let(:fake_system_command) { NeverSudoSystemCommand }
|
||||||
|
let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) }
|
||||||
|
|
||||||
around(:each) do |example|
|
around(:each) do |example|
|
||||||
begin
|
begin
|
||||||
@ -171,9 +173,6 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:fake_system_command) { NeverSudoSystemCommand }
|
|
||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) }
|
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths)
|
allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths)
|
||||||
.and_wrap_original do |method, *args|
|
.and_wrap_original do |method, *args|
|
||||||
|
@ -27,29 +27,10 @@ describe CompilerSelector do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#compiler" do
|
describe "#compiler" do
|
||||||
it "raises an error if no matching compiler can be found" do
|
|
||||||
software_spec.fails_with(:clang)
|
|
||||||
software_spec.fails_with(:gcc_4_2)
|
|
||||||
software_spec.fails_with(gcc: "4.8")
|
|
||||||
software_spec.fails_with(gcc: "4.7")
|
|
||||||
|
|
||||||
expect { subject.compiler }.to raise_error(CompilerSelectionError)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "defaults to cc" do
|
it "defaults to cc" do
|
||||||
expect(subject.compiler).to eq(cc)
|
expect(subject.compiler).to eq(cc)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns gcc if it fails with clang" do
|
|
||||||
software_spec.fails_with(:clang)
|
|
||||||
expect(subject.compiler).to eq(:gcc_4_2)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns clang if it fails with gcc" do
|
|
||||||
software_spec.fails_with(:gcc_4_2)
|
|
||||||
expect(subject.compiler).to eq(:clang)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns clang if it fails with non-Apple gcc" do
|
it "returns clang if it fails with non-Apple gcc" do
|
||||||
software_spec.fails_with(gcc: "4.8")
|
software_spec.fails_with(gcc: "4.8")
|
||||||
expect(subject.compiler).to eq(:clang)
|
expect(subject.compiler).to eq(:clang)
|
||||||
@ -84,23 +65,7 @@ describe CompilerSelector do
|
|||||||
expect(subject.compiler).to eq("gcc-4.7")
|
expect(subject.compiler).to eq("gcc-4.7")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prefers gcc" do
|
it "raises an error when gcc or llvm is missing" do
|
||||||
software_spec.fails_with(:clang)
|
|
||||||
software_spec.fails_with(:gcc_4_2)
|
|
||||||
expect(subject.compiler).to eq("gcc-4.8")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "raises an error when gcc is missing" do
|
|
||||||
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
|
||||||
|
|
||||||
software_spec.fails_with(:clang)
|
|
||||||
software_spec.fails_with(gcc: "4.8")
|
|
||||||
software_spec.fails_with(gcc: "4.7")
|
|
||||||
|
|
||||||
expect { subject.compiler }.to raise_error(CompilerSelectionError)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "raises an error when llvm and gcc are missing" do
|
|
||||||
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
||||||
|
|
||||||
software_spec.fails_with(:clang)
|
software_spec.fails_with(:clang)
|
||||||
|
@ -7,11 +7,6 @@ describe Utils::Shell do
|
|||||||
expect(subject.profile).to eq("~/.bash_profile")
|
expect(subject.profile).to eq("~/.bash_profile")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns ~/.bash_profile for Sh" do
|
|
||||||
ENV["SHELL"] = "/bin/another_shell"
|
|
||||||
expect(subject.profile).to eq("~/.bash_profile")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns ~/.bash_profile for Bash" do
|
it "returns ~/.bash_profile for Bash" do
|
||||||
ENV["SHELL"] = "/bin/bash"
|
ENV["SHELL"] = "/bin/bash"
|
||||||
expect(subject.profile).to eq("~/.bash_profile")
|
expect(subject.profile).to eq("~/.bash_profile")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user