| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-11 18:21:30 +01:00
										 |  |  | require "build_environment" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-18 15:11:11 -08:00
										 |  |  | RSpec.describe BuildEnvironment do | 
					
						
							| 
									
										
										
										
											2017-02-11 18:21:30 +01:00
										 |  |  |   let(:env) { described_class.new } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#<<" do | 
					
						
							|  |  |  |     it "returns itself" do | 
					
						
							|  |  |  |       expect(env << :foo).to be env | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#merge" do | 
					
						
							|  |  |  |     it "returns itself" do | 
					
						
							|  |  |  |       expect(env.merge([])).to be env | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#std?" do | 
					
						
							|  |  |  |     it "returns true if the environment contains :std" do | 
					
						
							|  |  |  |       env << :std | 
					
						
							|  |  |  |       expect(env).to be_std | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "returns false if the environment does not contain :std" do | 
					
						
							|  |  |  |       expect(env).not_to be_std | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-09 23:00:51 +02:00
										 |  |  |   describe BuildEnvironment::DSL do | 
					
						
							| 
									
										
										
										
											2022-08-24 23:52:40 +01:00
										 |  |  |     let(:build_environment_dsl) do | 
					
						
							|  |  |  |       klass = described_class | 
					
						
							|  |  |  |       Class.new do | 
					
						
							|  |  |  |         extend(klass) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-02-11 18:21:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-19 23:15:33 +00:00
										 |  |  |     context "with a single argument" do | 
					
						
							| 
									
										
										
										
											2024-03-17 22:47:37 -07:00
										 |  |  |       subject(:build_env) do | 
					
						
							| 
									
										
										
										
											2022-08-24 23:52:40 +01:00
										 |  |  |         Class.new(build_environment_dsl) do | 
					
						
							| 
									
										
										
										
											2021-09-30 14:06:00 -07:00
										 |  |  |           env :std | 
					
						
							| 
									
										
										
										
											2017-05-09 23:00:51 +02:00
										 |  |  |         end | 
					
						
							| 
									
										
										
										
											2017-02-11 18:21:30 +01:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-17 22:47:37 -07:00
										 |  |  |       it(:env) { expect(build_env.env).to be_std } | 
					
						
							| 
									
										
										
										
											2017-05-09 23:00:51 +02:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-02-11 18:21:30 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end |