Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created June 21, 2012 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agibralter/2964094 to your computer and use it in GitHub Desktop.
Save agibralter/2964094 to your computer and use it in GitHub Desktop.
rspec-rails hack for *not* rendering rabl views (no longer necessary as of rabl 0.7.0)
# -*- encoding : utf-8 -*-
# HACK:
# https://github.com/rspec/rspec-rails/issues/565#issuecomment-6474362
module RSpec
module Rails
module ViewRendering
class EmptyTemplatePathSetDecorator < ::ActionView::Resolver
def find_all(*args)
original_path_set.find_all(*args).collect do |template|
::ActionView::Template.new(
" ",
template.identifier,
template.handler,
{
:virtual_path => template.virtual_path,
:format => template.formats
}
)
end
end
end
end
end
end
# HACK:
# https://github.com/rspec/rspec-rails/issues/565#issuecomment-6474362
module RSpec
module Rails
module ViewRendering
class HackyHandler
def self.call(template)
""
end
end
class EmptyTemplatePathSetDecorator < ::ActionView::Resolver
def find_all(*args)
original_path_set.find_all(*args).collect do |template|
::ActionView::Template.new(
"",
template.identifier,
HackyHandler, # template.handler,
{
:virtual_path => template.virtual_path,
:format => template.formats
}
)
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment