Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created January 23, 2012 20:25
Show Gist options
  • Save leemcalilly/1665365 to your computer and use it in GitHub Desktop.
Save leemcalilly/1665365 to your computer and use it in GitHub Desktop.
index.html.erb_spec.rb
require "spec_helper"
describe "search/index.html.erb" do
context "when search results are empty" do
before do
assign(:results, double('results').as_null_object)
controller.params[:search] = "user query"
template.stub(:paginate).and_return(nil)
end
it "should display 'Sorry - no results' message" do
render
rendered.should match('<p>Sorry - there were no results for "<strong>user query</strong>".</p>
<p><a href="/">Return to your homepage</a>.</p>')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment