stache 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/stache/handlebars/handler.rb +3 -3
- data/lib/stache/version.rb +1 -1
- data/spec/controllers/handlebars_controller_spec.rb +7 -0
- data/spec/dummy/app/controllers/handlebars_controller.rb +4 -0
- data/spec/dummy/app/views/handlebars/with_missing_data.html.hbs +1 -0
- data/spec/dummy/config/routes.rb +2 -0
- metadata +4 -2
data/CHANGELOG.md
CHANGED
@@ -18,7 +18,9 @@ module Stache
|
|
18
18
|
|
19
19
|
handlebars.register_helper('helperMissing') do |name, *args|
|
20
20
|
meth, *params, options = args
|
21
|
-
if
|
21
|
+
if params.size == 0
|
22
|
+
""
|
23
|
+
elsif self.respond_to?(meth)
|
22
24
|
self.send(meth, *params)
|
23
25
|
else
|
24
26
|
raise "Could not find property '\#\{meth\}'"
|
@@ -33,8 +35,6 @@ module Stache
|
|
33
35
|
options = partial_renderer.instance_variable_get('@options')
|
34
36
|
vars.merge!(options[:context] || {}) if options
|
35
37
|
|
36
|
-
Rails.logger.info vars.inspect
|
37
|
-
|
38
38
|
handlebars.partial_missing do |name|
|
39
39
|
search_path = '#{template.virtual_path}'.split("/")[0..-2]
|
40
40
|
file = (search_path + [name]).join("/")
|
data/lib/stache/version.rb
CHANGED
@@ -31,5 +31,12 @@ describe HandlebarsController do
|
|
31
31
|
response.body.should =~ /Here's a capitalized string: Lowercase/
|
32
32
|
end
|
33
33
|
|
34
|
+
it "doesn't blow up if it is missing data" do
|
35
|
+
get :with_missing_data
|
36
|
+
assert_response 200
|
37
|
+
|
38
|
+
response.body.should =~ /I should not \./
|
39
|
+
end
|
40
|
+
|
34
41
|
|
35
42
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
I should not {{blow_up}}.
|
data/spec/dummy/config/routes.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: stache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Wilson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-17 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mustache
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- spec/dummy/app/views/handlebars/_eaten_by_a.html.hbs
|
144
144
|
- spec/dummy/app/views/handlebars/index.html.hbs
|
145
145
|
- spec/dummy/app/views/handlebars/with_helpers.html.hbs
|
146
|
+
- spec/dummy/app/views/handlebars/with_missing_data.html.hbs
|
146
147
|
- spec/dummy/app/views/handlebars/with_partials.html.hbs
|
147
148
|
- spec/dummy/app/views/layouts/application.html.erb
|
148
149
|
- spec/dummy/app/views/stache/_eaten_by_a.html.mustache
|
@@ -229,6 +230,7 @@ test_files:
|
|
229
230
|
- spec/dummy/app/views/handlebars/_eaten_by_a.html.hbs
|
230
231
|
- spec/dummy/app/views/handlebars/index.html.hbs
|
231
232
|
- spec/dummy/app/views/handlebars/with_helpers.html.hbs
|
233
|
+
- spec/dummy/app/views/handlebars/with_missing_data.html.hbs
|
232
234
|
- spec/dummy/app/views/handlebars/with_partials.html.hbs
|
233
235
|
- spec/dummy/app/views/layouts/application.html.erb
|
234
236
|
- spec/dummy/app/views/stache/_eaten_by_a.html.mustache
|