deas 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/deas/template.rb +4 -0
- data/lib/deas/version.rb +1 -1
- data/test/unit/template_tests.rb +6 -4
- metadata +3 -3
data/lib/deas/template.rb
CHANGED
@@ -8,6 +8,10 @@ module Deas
|
|
8
8
|
Deas::Template::RenderScope.class_eval{ include *helper_modules }
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.helper?(helper_module)
|
12
|
+
Deas::Template::RenderScope.included_modules.include?(helper_module)
|
13
|
+
end
|
14
|
+
|
11
15
|
attr_reader :name, :options
|
12
16
|
|
13
17
|
def initialize(sinatra_call, name, options = nil)
|
data/lib/deas/version.rb
CHANGED
data/test/unit/template_tests.rb
CHANGED
@@ -13,7 +13,7 @@ class Deas::Template
|
|
13
13
|
subject{ @template }
|
14
14
|
|
15
15
|
should have_instance_methods :name, :options, :render
|
16
|
-
should have_class_methods :helpers
|
16
|
+
should have_class_methods :helpers, :helper?
|
17
17
|
|
18
18
|
should "symbolize it's name" do
|
19
19
|
assert_equal :"users/index", subject.name
|
@@ -30,12 +30,15 @@ class Deas::Template
|
|
30
30
|
assert_equal subject.options, return_value[1]
|
31
31
|
end
|
32
32
|
|
33
|
-
should "include modules on the RenderScope using helpers class method"
|
33
|
+
should "include modules on the RenderScope using `helpers` class method"\
|
34
|
+
" and know if a given modules has been included in the RenderScope" do
|
34
35
|
helper_module = Module.new
|
35
36
|
Deas::Template.helpers(helper_module)
|
36
37
|
|
37
38
|
included_modules = Deas::Template::RenderScope.included_modules
|
38
39
|
assert_includes helper_module, included_modules
|
40
|
+
|
41
|
+
assert Deas::Template.helper?(helper_module)
|
39
42
|
end
|
40
43
|
|
41
44
|
end
|
@@ -69,8 +72,7 @@ class Deas::Template
|
|
69
72
|
end
|
70
73
|
subject{ @render_scope }
|
71
74
|
|
72
|
-
should
|
73
|
-
:render
|
75
|
+
should have_imeths :partial, :escape_html, :h, :escape_url, :u, :render
|
74
76
|
|
75
77
|
should "call the sinatra_call's erb method with #partial" do
|
76
78
|
return_value = subject.partial('part', :something => true)
|
metadata
CHANGED