| 
									
										
										
										
											2017-02-12 11:58:34 +01:00
										 |  |  | require "requirements/x11_requirement" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe X11Requirement do | 
					
						
							|  |  |  |   let(:default_name) { "x11" } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#name" do | 
					
						
							|  |  |  |     it "defaults to x11" do | 
					
						
							|  |  |  |       expect(subject.name).to eq(default_name) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#eql?" do | 
					
						
							| 
									
										
										
										
											2018-10-19 16:38:41 +01:00
										 |  |  |     it "returns true if the requirements are equal" do | 
					
						
							|  |  |  |       other = described_class.new | 
					
						
							| 
									
										
										
										
											2017-02-12 11:58:34 +01:00
										 |  |  |       expect(subject).to eql(other) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "#modify_build_environment" do | 
					
						
							|  |  |  |     it "calls ENV#x11" do | 
					
						
							|  |  |  |       allow(subject).to receive(:satisfied?).and_return(true) | 
					
						
							|  |  |  |       expect(ENV).to receive(:x11) | 
					
						
							|  |  |  |       subject.modify_build_environment | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-02-27 17:58:42 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   describe "#satisfied?", :needs_macos do | 
					
						
							|  |  |  |     it "returns true if X11 is installed" do | 
					
						
							|  |  |  |       expect(MacOS::XQuartz).to receive(:version).and_return("2.7.5") | 
					
						
							|  |  |  |       expect(MacOS::XQuartz).to receive(:installed?).and_return(true) | 
					
						
							|  |  |  |       expect(subject).to be_satisfied | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "returns false if X11 is not installed" do | 
					
						
							|  |  |  |       expect(MacOS::XQuartz).to receive(:installed?).and_return(false) | 
					
						
							|  |  |  |       expect(subject).not_to be_satisfied | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-02-12 11:58:34 +01:00
										 |  |  | end |