Merge pull request #5119 from javian/fixtodo1
rubocop: fix some rubocop offences
This commit is contained in:
		
						commit
						4231197437
					
				@ -121,17 +121,6 @@ RSpec/RepeatedDescription:
 | 
			
		||||
    - 'rubocops/lines_cop_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
 | 
			
		||||
RSpec/SubjectStub:
 | 
			
		||||
  Exclude:
 | 
			
		||||
 | 
			
		||||
@ -158,6 +158,8 @@ shared_examples "#uninstall_phase or #zap_phase" do
 | 
			
		||||
      let(:glob_path1) { Pathname.new("#{dir}/glob_path1") }
 | 
			
		||||
      let(:glob_path2) { Pathname.new("#{dir}/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|
 | 
			
		||||
        begin
 | 
			
		||||
@ -171,9 +173,6 @@ shared_examples "#uninstall_phase or #zap_phase" do
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      let(:fake_system_command) { NeverSudoSystemCommand }
 | 
			
		||||
      let(:cask) { Cask::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) }
 | 
			
		||||
 | 
			
		||||
      before(:each) do
 | 
			
		||||
        allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths)
 | 
			
		||||
          .and_wrap_original do |method, *args|
 | 
			
		||||
 | 
			
		||||
@ -27,29 +27,10 @@ describe CompilerSelector do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  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
 | 
			
		||||
      expect(subject.compiler).to eq(cc)
 | 
			
		||||
    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
 | 
			
		||||
      software_spec.fails_with(gcc: "4.8")
 | 
			
		||||
      expect(subject.compiler).to eq(:clang)
 | 
			
		||||
@ -84,23 +65,7 @@ describe CompilerSelector do
 | 
			
		||||
      expect(subject.compiler).to eq("gcc-4.7")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "prefers gcc" 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
 | 
			
		||||
    it "raises an error when gcc or llvm is missing" do
 | 
			
		||||
      allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
 | 
			
		||||
 | 
			
		||||
      software_spec.fails_with(:clang)
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,8 @@ describe Utils::Shell do
 | 
			
		||||
      expect(subject.profile).to eq("~/.bash_profile")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns ~/.bash_profile for Sh" do
 | 
			
		||||
      ENV["SHELL"] = "/bin/another_shell"
 | 
			
		||||
    it "returns ~/.bash_profile for sh" do
 | 
			
		||||
      ENV["SHELL"] = "/bin/sh"
 | 
			
		||||
      expect(subject.profile).to eq("~/.bash_profile")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user