Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / spec / scenarios / .svn / text-base / layouts_scenario.rb.svn-base
blob09fa6fe9407c5f55c43daa868a55216a0a1d293b
1 class LayoutsScenario < Scenario::Base
2   
3   def load
4     create_layout "Main", :content => <<-CONTENT
5 <html>
6   <head>
7     <title><r:title /></title>
8   </head>
9   <body>
10     <r:content />
11   </body>
12 </html>
13     CONTENT
14     
15     create_layout "UTF8", :content_type => "text/html;charset=utf8", :content => <<-CONTENT
16 <html>
17   <head>
18     <title><r:title /></title>
19   </head>
20   <body>
21     <r:content />
22   </body>
23 </html>
24     CONTENT
25   end
26   
27   helpers do
28     def create_layout(name, attributes={})
29       create_record :layout, name.symbolize, layout_params(attributes.reverse_merge(:name => name))
30     end
31     
32     def layout_params(attributes={})
33       name = attributes[:name] || unique_layout_name
34       { 
35         :name => name,
36         :content => "<r:content />"
37       }.merge(attributes)
38     end
39     
40     private
41     
42       @@unique_layout_name_call_count = 0
43       def unique_layout_name
44         @@unique_layout_name_call_count += 1
45         "Layout #{@@unique_layout_name_call_count}"
46       end
47   end
48 end