| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |       ENV["XDG_CACHE_HOME"] = (HOMEBREW_CACHE.realpath/"style").to_s | 
					
						
							| 
									
										
										
										
											2018-09-05 00:58:28 +02:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "loads all Formula cops without errors" do | 
					
						
							| 
									
										
										
										
											2020-12-02 10:38:12 +01:00
										 |  |  |       stdout, stderr, status = Open3.capture3(RUBY_PATH, "-W0", "-S", "rubocop", TEST_FIXTURE_DIR/"testball.rb") | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |       expect(stderr).to be_empty | 
					
						
							| 
									
										
										
										
											2020-07-26 07:24:14 +02:00
										 |  |  |       expect(stdout).to include("no offenses detected") | 
					
						
							| 
									
										
										
										
											2018-09-05 00:58:28 +02:00
										 |  |  |       expect(status).to be_a_success | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |