| 
									
										
										
										
											2017-03-06 04:31:16 +01:00
										 |  |  | describe Hbc::DSL::StanzaProxy, :cask do | 
					
						
							| 
									
										
										
										
											2018-03-25 13:30:37 +01:00
										 |  |  |   subject { stanza_proxy } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   let(:stanza_proxy) { | 
					
						
							| 
									
										
										
										
											2016-10-14 20:17:25 +02:00
										 |  |  |     described_class.new(Array) { [:foo, :bar, :cake] } | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it { is_expected.to be_a_proxy } | 
					
						
							|  |  |  |   it { is_expected.to respond_to(:pop) } | 
					
						
							|  |  |  |   its(:pop) { is_expected.to eq(:cake) } | 
					
						
							|  |  |  |   its(:type) { is_expected.to eq(Array) } | 
					
						
							|  |  |  |   its(:to_s) { is_expected.to eq("[:foo, :bar, :cake]") } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "when initialized" do | 
					
						
							|  |  |  |     let(:initializing) { | 
					
						
							|  |  |  |       proc { |b| described_class.new(Array, &b) } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "does not evaluate the block" do | 
					
						
							|  |  |  |       expect(&initializing).not_to yield_control | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe "when receiving a message" do | 
					
						
							|  |  |  |     let(:receiving_a_message) { | 
					
						
							|  |  |  |       proc { |b| described_class.new(Array, &b).to_s } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it "evaluates the block" do | 
					
						
							|  |  |  |       expect(&receiving_a_message).to yield_with_no_args | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |