| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 20:28:38 +01:00
										 |  |  | require "build_options" | 
					
						
							|  |  |  | require "options" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe BuildOptions do | 
					
						
							| 
									
										
										
										
											2017-05-09 23:00:51 +02:00
										 |  |  |   alias_matcher :be_built_with, :be_with | 
					
						
							|  |  |  |   alias_matcher :be_built_without, :be_without | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 20:28:38 +01:00
										 |  |  |   subject { described_class.new(args, opts) } | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 20:28:38 +01:00
										 |  |  |   let(:bad_build) { described_class.new(bad_args, opts) } | 
					
						
							|  |  |  |   let(:args) { Options.create(%w[--with-foo --with-bar --without-qux]) } | 
					
						
							|  |  |  |   let(:opts) { Options.create(%w[--with-foo --with-bar --without-baz --without-qux]) } | 
					
						
							|  |  |  |   let(:bad_args) { Options.create(%w[--with-foo --with-bar --without-bas --without-qux --without-abc]) } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#with?" do | 
					
						
							|  |  |  |     expect(subject).to be_built_with("foo") | 
					
						
							|  |  |  |     expect(subject).to be_built_with("bar") | 
					
						
							|  |  |  |     expect(subject).to be_built_with("baz") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#without?" do | 
					
						
							|  |  |  |     expect(subject).to be_built_without("qux") | 
					
						
							|  |  |  |     expect(subject).to be_built_without("xyz") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#used_options" do | 
					
						
							|  |  |  |     expect(subject.used_options).to include("--with-foo") | 
					
						
							|  |  |  |     expect(subject.used_options).to include("--with-bar") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   specify "#unused_options" do | 
					
						
							|  |  |  |     expect(subject.unused_options).to include("--without-baz") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |