Ticket #57 (new defect)

Opened 15 months ago

Last modified 9 months ago

[patch] for rails projects using markaby and selenium to write tests in .rsel or .sel format. Or for projects that mix other templating engines like haml with markaby

Reported by: gugod Owned by: somebody
Priority: major Milestone:
Component: lib Version:
Keywords: selenium Cc:

Description (last modified by gugod) (diff)

I discovered that, because markaby override ActionView::Base::render_template to properly calls Template::render of its own, it fails to call the template handlers for .sel and .rsel templates.

I attached a simple patch that get rid of the render_template override, and yet make the interface of Template::render be compatible with others.

Change History

in reply to: ↑ description   Changed 15 months ago by gugod

  • description modified (diff)

I found myself failed to upload the patch here, so I'll just paste it here:

=== lib/markaby/rails.rb ================================================================== --- lib/markaby/rails.rb (revision 17767) +++ lib/markaby/rails.rb (revision 17888) @@ -1,15 +1,15 @@ -module ActionView? # :nodoc: - class Base # :nodoc: - def render_template(template_extension, template, file_path = nil, local_assigns = {}) - if handler = @@template_handlers[template_extension]

- template = read_template_file(file_path, template_extension) - handler.new(self).render(template, local_assigns, file_path) - else - compile_and_render_template(template_extension, template, file_path, local_assigns) - end - end - end -end

module Markaby

module Rails

@@ -28,33 +28,33 @@

def initialize(action_view)

@action_view = action_view

end

- def render(template, local_assigns, file_path) + def render(template, local_assigns, file_path=nil)

template = Template.new(template) template.path = file_path template.render(@action_view.assigns.merge(local_assigns), @action_view)

end

end

  Changed 12 months ago by rchristopher

  • summary changed from [patch] for rails projects using markaby and selenium to write tests in .rsel or .sel format. to [patch] for rails projects using markaby and selenium to write tests in .rsel or .sel format. Or for projects that mix other templating engines like haml with markaby

Had the same problem when mixing haml plugin with markaby plugin. The above fix corrected the problem, now I can have haml templates and markaby templates in the same project

  Changed 9 months ago by randypuro

See ticket #58 for an alternative patch which should better support both markaby template parsing ( including file name error reporting) in conjunction with default rails template rendering for other templating plugins (including potential caching support).

Note: See TracTickets for help on using tickets.