massimo 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/massimo/site.rb +3 -4
- data/lib/massimo/version.rb +1 -1
- data/spec/massimo/site_spec.rb +28 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/massimo/site.rb
CHANGED
@@ -79,7 +79,7 @@ module Massimo
|
|
79
79
|
|
80
80
|
def add_template_scope_extensions(scope)
|
81
81
|
@template_scope_extensions.each do |extension|
|
82
|
-
scope.extend(extension)
|
82
|
+
scope.extend(extension) if extension.instance_of?(Module)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -92,9 +92,8 @@ module Massimo
|
|
92
92
|
|
93
93
|
if constants = cache[:constants]
|
94
94
|
constants.each do |const|
|
95
|
-
|
96
|
-
|
97
|
-
end
|
95
|
+
helper = const.to_s.constantize rescue nil
|
96
|
+
scope.extend(helper) if helper.instance_of?(Module)
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
data/lib/massimo/version.rb
CHANGED
data/spec/massimo/site_spec.rb
CHANGED
@@ -184,6 +184,18 @@ describe Massimo::Site do
|
|
184
184
|
Massimo.site.template_scope.cycle.should == 'even'
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
188
|
+
context 'with a Class' do
|
189
|
+
it 'does not extend the template scope' do
|
190
|
+
class CycleClass
|
191
|
+
def does_not_cycle
|
192
|
+
'even'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
Massimo.site.helpers CycleClass
|
196
|
+
Massimo.site.template_scope.should_not respond_to(:does_not_cycle)
|
197
|
+
end
|
198
|
+
end
|
187
199
|
end
|
188
200
|
|
189
201
|
describe '#process' do
|
@@ -294,6 +306,22 @@ describe Massimo::Site do
|
|
294
306
|
}.to raise_error
|
295
307
|
end
|
296
308
|
end
|
309
|
+
|
310
|
+
context 'with a class' do
|
311
|
+
it 'does not extend the template scope' do
|
312
|
+
content = <<-CONTENT.unindent
|
313
|
+
class SomeClass
|
314
|
+
def not_a_helper_method
|
315
|
+
'working'
|
316
|
+
end
|
317
|
+
end
|
318
|
+
CONTENT
|
319
|
+
with_file 'helpers/some_class.rb', content do
|
320
|
+
Massimo.site.process
|
321
|
+
Massimo.site.template_scope.should_not respond_to(:not_a_helper_method)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
297
325
|
end
|
298
326
|
end
|
299
327
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 1
|
9
|
+
version: 0.8.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Pete Browne
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-26 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|