lib/spec/rails/matchers/render_template.rb in dchelimsky-rspec-rails-1.1.11.1 vs lib/spec/rails/matchers/render_template.rb in dchelimsky-rspec-rails-1.1.11.2
- old
+ new
@@ -8,12 +8,22 @@
@controller = controller
@expected = expected
end
def matches?(response)
-
if response.respond_to?(:rendered_file)
@actual = response.rendered_file
+ elsif response.respond_to?(:rendered)
+ case template = response.rendered[:template]
+ when nil
+ unless response.rendered[:partials].empty?
+ @actual = path_and_file(response.rendered[:partials].keys.first).join("/_")
+ end
+ when ActionView::Template
+ @actual = template.path
+ when String
+ @actual = template
+ end
else
@actual = response.rendered_template.to_s
end
return false if @actual.blank?
given_controller_path, given_file = path_and_file(@actual)