| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-05 00:58:28 +02:00
										 |  |  | require "open3" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe "RuboCop" do | 
					
						
							|  |  |  |   context "when calling `rubocop` outside of the Homebrew environment" do | 
					
						
							|  |  |  |     before do | 
					
						
							| 
									
										
										
										
											2020-02-19 11:18:40 +00:00
										 |  |  |       ENV.each_key do |key| | 
					
						
							| 
									
										
										
										
											2018-09-05 00:58:28 +02:00
										 |  |  |         ENV.delete(key) if key.start_with?("HOMEBREW_") | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       ENV["XDG_CACHE_HOME"] = "#{HOMEBREW_CACHE}/style" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "loads all Formula cops without errors" do | 
					
						
							| 
									
										
										
										
											2020-07-26 07:24:14 +02:00
										 |  |  |       stdout, _, status = Open3.capture3("rubocop", TEST_FIXTURE_DIR/"testball.rb") | 
					
						
							|  |  |  |       expect(stdout).to include("no offenses detected") | 
					
						
							| 
									
										
										
										
											2018-09-05 00:58:28 +02:00
										 |  |  |       expect(status).to be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |