Merge pull request #2115 from reitermarkus/spec-linkapps
Convert `brew linkapps` test to spec.
This commit is contained in:
		
						commit
						e768786f22
					
				
							
								
								
									
										24
									
								
								Library/Homebrew/test/cmd/linkapps_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Library/Homebrew/test/cmd/linkapps_spec.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
describe "brew linkapps", :integration_test do
 | 
			
		||||
  let(:home_dir) { @home_dir = Pathname.new(Dir.mktmpdir) }
 | 
			
		||||
  let(:apps_dir) { home_dir/"Applications" }
 | 
			
		||||
 | 
			
		||||
  after(:each) do
 | 
			
		||||
    home_dir.rmtree unless @home_dir.nil?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "symlinks applications" do
 | 
			
		||||
    apps_dir.mkpath
 | 
			
		||||
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    source_app = HOMEBREW_CELLAR/"testball/0.1/TestBall.app"
 | 
			
		||||
    source_app.mkpath
 | 
			
		||||
 | 
			
		||||
    expect { brew "linkapps", "--local", "HOME" => home_dir }
 | 
			
		||||
      .to output(/Linking: #{Regexp.escape(source_app)}/).to_stdout
 | 
			
		||||
      .and output(/`brew linkapps` has been deprecated/).to_stderr
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
 | 
			
		||||
    expect(apps_dir/"TestBall.app").to be_a_symlink
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
require "testing_env"
 | 
			
		||||
 | 
			
		||||
class IntegrationCommandTestLinkapps < IntegrationCommandTestCase
 | 
			
		||||
  def test_linkapps
 | 
			
		||||
    home_dir = Pathname.new(mktmpdir)
 | 
			
		||||
    (home_dir/"Applications").mkpath
 | 
			
		||||
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    source_dir = HOMEBREW_CELLAR/"testball/0.1/TestBall.app"
 | 
			
		||||
    source_dir.mkpath
 | 
			
		||||
    assert_match "Linking: #{source_dir}",
 | 
			
		||||
      cmd("linkapps", "--local", "HOME" => home_dir)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user