Sha256: b2e36e248d4c5540ed2e191c087682c5854027d2bb80c967ebee174098170406
Contents?: true
Size: 812 Bytes
Versions: 3
Compression:
Stored size: 812 Bytes
Contents
module Support module TemplateHelpers def stub_template(hash) @controller.view_paths.unshift(ActionView::FixtureResolver.new(hash)) end def templates(&block) klass = Class.new(&block) inst = klass.new config = {}.tap do |hash| inst.public_methods(false).each do |method| content = inst.send(method) hash["products/#{method}.html.erb"] = content.gsub(/^\s+/, '') end end stub_template(config) end def template(config) is_layout = config.delete(:layout) suffix, content = config.flatten if is_layout stub_template("layouts/support/resource_helpers/#{suffix}" => content) else stub_template("support/resource_helpers/#{suffix}" => content) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
emerson-0.1.0.pre.4 | spec/support/helpers/template_helpers.rb |
emerson-0.1.0.pre.3 | spec/support/helpers/template_helpers.rb |
emerson-0.1.0.pre.2 | spec/support/helpers/template_helpers.rb |