sinatra_more 0.3.38 → 0.3.39

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.38
1
+ 0.3.39
@@ -46,7 +46,9 @@ module SinatraMore
46
46
  # yield_content :include
47
47
  # yield_content :head, "param1", "param2"
48
48
  def yield_content(key, *args)
49
- content_blocks[key.to_sym].map { |content|
49
+ blocks = content_blocks[key.to_sym]
50
+ return nil if blocks.empty?
51
+ blocks.map { |content|
50
52
  capture_html(*args, &content)
51
53
  }.join
52
54
  end
data/sinatra_more.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_more}
8
- s.version = "0.3.38"
8
+ s.version = "0.3.39"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Esquenazi"]
12
- s.date = %q{2010-02-10}
12
+ s.date = %q{2010-02-16}
13
13
  s.default_executable = %q{sinatra_gen}
14
14
  s.description = %q{Expands sinatra with standard helpers and tools to allow for complex applications}
15
15
  s.email = %q{nesquena@gmail.com}
@@ -124,6 +124,8 @@ Gem::Specification.new do |s|
124
124
  "test/fixtures/markup_app/views/mail_to.haml",
125
125
  "test/fixtures/markup_app/views/meta_tag.erb",
126
126
  "test/fixtures/markup_app/views/meta_tag.haml",
127
+ "test/fixtures/markup_app/views/yield_content.erb",
128
+ "test/fixtures/markup_app/views/yield_content.haml",
127
129
  "test/fixtures/render_app/app.rb",
128
130
  "test/fixtures/render_app/views/erb/test.erb",
129
131
  "test/fixtures/render_app/views/haml/test.haml",
@@ -17,7 +17,7 @@ class MarkupDemo < Sinatra::Base
17
17
  # show :erb, :index
18
18
  # show :haml, :index
19
19
  def show(kind, template)
20
- eval("#{kind.to_s} #{template.to_sym.inspect}")
20
+ send kind.to_sym, template.to_sym
21
21
  end
22
22
 
23
23
  def captured_content(&block)
@@ -2,7 +2,7 @@
2
2
  <h1>This is content yielded from a content_for</h1>
3
3
  <% end %>
4
4
 
5
- <div class='demo'><%= yield_content :demo %></p>
5
+ <div class='demo'><%= yield_content :demo %></div>
6
6
 
7
7
  <% content_for :demo2 do |fname, lname| %>
8
8
  <h1>This is content yielded with name <%= fname + " " + lname %></h1>
@@ -0,0 +1,3 @@
1
+ <div class='demo'>
2
+ <%= yield_content(:demo) == nil ? 'nil' : 'not nil' %>
3
+ </div>
@@ -0,0 +1 @@
1
+ %div.demo= yield_content(:demo) == nil ? 'nil' : 'not nil'
@@ -19,6 +19,18 @@ class TestOutputHelpers < Test::Unit::TestCase
19
19
  assert_have_selector '.demo2 h1', :content => "This is content yielded with name Johnny Smith"
20
20
  end
21
21
  end
22
+
23
+ context 'for #yield_content method' do
24
+ should 'work for erb templates' do
25
+ visit '/erb/yield_content'
26
+ assert_have_selector '.demo', :content => "nil"
27
+ end
28
+
29
+ should "work for haml templates" do
30
+ visit '/haml/yield_content'
31
+ assert_have_selector '.demo', :content => "nil"
32
+ end
33
+ end
22
34
 
23
35
  context 'for #capture_html method' do
24
36
  should "work for erb templates" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_more
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.38
4
+ version: 0.3.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-10 00:00:00 -08:00
12
+ date: 2010-02-16 00:00:00 -08:00
13
13
  default_executable: sinatra_gen
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -227,6 +227,8 @@ files:
227
227
  - test/fixtures/markup_app/views/mail_to.haml
228
228
  - test/fixtures/markup_app/views/meta_tag.erb
229
229
  - test/fixtures/markup_app/views/meta_tag.haml
230
+ - test/fixtures/markup_app/views/yield_content.erb
231
+ - test/fixtures/markup_app/views/yield_content.haml
230
232
  - test/fixtures/render_app/app.rb
231
233
  - test/fixtures/render_app/views/erb/test.erb
232
234
  - test/fixtures/render_app/views/haml/test.haml