| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  | require "dependable" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-18 15:11:11 -08:00
										 |  |  | RSpec.describe Dependable do | 
					
						
							| 
									
										
										
										
											2017-05-09 23:00:51 +02:00
										 |  |  |   alias_matcher :be_a_build_dependency, :be_build | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 23:14:46 +00:00
										 |  |  |   subject(:dependable) do | 
					
						
							|  |  |  |     Class.new do | 
					
						
							| 
									
										
										
										
											2023-01-22 17:03:27 -08:00
										 |  |  |       include Dependable | 
					
						
							|  |  |  |       def initialize | 
					
						
							|  |  |  |         @tags = ["foo", "bar", :build] | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2023-03-08 23:14:46 +00:00
										 |  |  |     end.new | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   specify "#options" do | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect(dependable.options.as_flags.sort).to eq(%w[--foo --bar].sort) | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#build?" do | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect(dependable).to be_a_build_dependency | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#optional?" do | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect(dependable).not_to be_optional | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#recommended?" do | 
					
						
							| 
									
										
										
										
											2021-01-31 13:14:23 -05:00
										 |  |  |     expect(dependable).not_to be_recommended | 
					
						
							| 
									
										
										
										
											2017-02-27 11:55:14 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end |