Skip to content

Instantly share code, notes, and snippets.

@ryankbales
Last active August 29, 2015 14:10
Show Gist options
  • Save ryankbales/c532e7a7153ea5d85c62 to your computer and use it in GitHub Desktop.
Save ryankbales/c532e7a7153ea5d85c62 to your computer and use it in GitHub Desktop.
template_exists?
#content_helper, starting at line no. 428
#was
if template_exists?(part.part.partial, "content", true)
#solution
if lookup_context.template_exists?(part.part.partial, ["content"], true)
#spec edit
#content_helper_spec.rb starting on line no. 2303
#was
before do
@client = double(:client)
@store = double(:store)
helper.stub(:template_exists? => true)
end
it "returns an empty string on a deleted partial" do
helper.stub(:template_exists? => false)
helper.content_for_part(part).should == ""
end
#solution, stub_chain template_exists on lookup_context
before do
@client = double(:client)
@store = double(:store)
helper.stub_chain(:lookup_context, :template_exists? => true)
end
it "returns an empty string on a deleted partial" do
helper.stub_chain(:lookup_context, :template_exists? => false)
helper.content_for_part(part).should == ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment