mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	add tests for calling yield_content more than once
This commit is contained in:
		
							parent
							
								
									3eb5e41529
								
							
						
					
					
						commit
						5360a0d930
					
				
					 5 changed files with 22 additions and 0 deletions
				
			
		
							
								
								
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.erb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.erb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
<%= yield_content :foo %>
 | 
			
		||||
<%= yield_content :foo %>
 | 
			
		||||
<%= yield_content :foo %>
 | 
			
		||||
							
								
								
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.erubis
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.erubis
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
<%= yield_content :foo %>
 | 
			
		||||
<%= yield_content :foo %>
 | 
			
		||||
<%= yield_content :foo %>
 | 
			
		||||
							
								
								
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.haml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.haml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
= yield_content :foo
 | 
			
		||||
= yield_content :foo
 | 
			
		||||
= yield_content :foo
 | 
			
		||||
							
								
								
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.slim
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								sinatra-contrib/spec/content_for/multiple_yields.slim
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
= yield_content :foo
 | 
			
		||||
= yield_content :foo
 | 
			
		||||
= yield_content :foo
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +37,11 @@ describe Sinatra::ContentFor do
 | 
			
		|||
          body.should == "foo"
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        it 'renders blocks more than once' do
 | 
			
		||||
          get('/multiple_yields/same_key').should be_ok
 | 
			
		||||
          body.should == "foofoofoo"
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        it 'does not render a block with a different key' do
 | 
			
		||||
          get('/different_key').should be_ok
 | 
			
		||||
          body.should == ""
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +52,11 @@ describe Sinatra::ContentFor do
 | 
			
		|||
          body.should == "foobarbaz"
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        it 'renders multiple blocks more than once' do
 | 
			
		||||
          get('/multiple_yields/multiple_blocks').should be_ok
 | 
			
		||||
          body.should == "foobarbazfoobarbazfoobarbaz"
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        it 'passes values to the blocks' do
 | 
			
		||||
          get('/passes_values/takes_values').should be_ok
 | 
			
		||||
          body.should == "<i>1</i>2"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue