Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created February 9, 2013 00:01
Show Gist options
  • Save danielevans/4743016 to your computer and use it in GitHub Desktop.
Save danielevans/4743016 to your computer and use it in GitHub Desktop.
describe "_clip.html.erb" do
let(:context) {
o = Object.new
o.class_eval do
def erb_binding # bypass the fact that binding is private and send(:binding) seems to have wierd side-effects
binding
end
end
o
}
let(:erb) { ERB.new(File.read("app/views/email_templates/_clip.html.erb")) }
let(:result) { erb.result(context.erb_binding) }
before(:each) do
context.stub(:clip_url).and_return("abc")
end
it "renders a link to the clip url" do
result.should match(/<a[^>]*href=\"abc\"/)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment