| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  | require_relative "../../rubocops/conflicts_cop" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe RuboCop::Cop::FormulaAudit::Conflicts do | 
					
						
							|  |  |  |   subject(:cop) { described_class.new } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   context "When auditing formula for conflicts with" do | 
					
						
							|  |  |  |     it "multiple conflicts_with" do | 
					
						
							| 
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 |  |  |       expect_offense(<<~RUBY, "/homebrew-core/Formula/foo@2.0.rb") | 
					
						
							| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  |         class FooAT20 < Formula | 
					
						
							|  |  |  |           url 'http://example.com/foo-2.0.tgz' | 
					
						
							|  |  |  |           conflicts_with "mysql", "mariadb", "percona-server", | 
					
						
							| 
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 |  |  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. | 
					
						
							| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  |                            :because => "both install plugins" | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 |  |  |       RUBY | 
					
						
							| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "no conflicts_with" do | 
					
						
							| 
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 |  |  |       expect_no_offenses(<<~RUBY, "/homebrew-core/Formula/foo@2.0.rb") | 
					
						
							| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  |         class FooAT20 < Formula | 
					
						
							|  |  |  |           url 'http://example.com/foo-2.0.tgz' | 
					
						
							|  |  |  |           desc 'Bar' | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2017-10-21 03:12:50 +02:00
										 |  |  |       RUBY | 
					
						
							| 
									
										
										
										
											2017-05-24 13:04:55 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |