Merge pull request #2123 from reitermarkus/spec-unlinkapps
Convert `brew unlinkapps` test to spec.
This commit is contained in:
		
						commit
						798e8ec45b
					
				
							
								
								
									
										24
									
								
								Library/Homebrew/test/cmd/unlinkapps_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Library/Homebrew/test/cmd/unlinkapps_spec.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
describe "brew unlinkapps", :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 "unlinks symlinked applications" do
 | 
			
		||||
    apps_dir.mkpath
 | 
			
		||||
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    source_app = HOMEBREW_CELLAR/"testball/0.1/TestBall.app"
 | 
			
		||||
    source_app.mkpath
 | 
			
		||||
 | 
			
		||||
    FileUtils.ln_s source_app, apps_dir/"TestBall.app"
 | 
			
		||||
 | 
			
		||||
    expect { brew "unlinkapps", "--local", "HOME" => home_dir }
 | 
			
		||||
      .to output(%r{Unlinking: #{Regexp.escape(apps_dir)}/TestBall.app}).to_stdout
 | 
			
		||||
      .and output(/`brew unlinkapps` has been deprecated/).to_stderr
 | 
			
		||||
      .and be_a_success
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@ -1,19 +0,0 @@
 | 
			
		||||
require "testing_env"
 | 
			
		||||
 | 
			
		||||
class IntegrationCommandTestUnlinkapps < IntegrationCommandTestCase
 | 
			
		||||
  def test_unlinkapps
 | 
			
		||||
    home_dir = Pathname.new(mktmpdir)
 | 
			
		||||
    apps_dir = home_dir/"Applications"
 | 
			
		||||
    apps_dir.mkpath
 | 
			
		||||
 | 
			
		||||
    setup_test_formula "testball"
 | 
			
		||||
 | 
			
		||||
    source_app = (HOMEBREW_CELLAR/"testball/0.1/TestBall.app")
 | 
			
		||||
    source_app.mkpath
 | 
			
		||||
 | 
			
		||||
    FileUtils.ln_s source_app, "#{apps_dir}/TestBall.app"
 | 
			
		||||
 | 
			
		||||
    assert_match "Unlinking: #{apps_dir}/TestBall.app",
 | 
			
		||||
      cmd("unlinkapps", "--local", "HOME" => home_dir)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user