[rspec-users] Rails View spec testing for content in <head>

Kristian Mandrup kmandrup.github at gmail.com
Mon Aug 23 10:14:20 EDT 2010


I found this at: http://github.com/rspec/rspec-rails

describe EventsHelper do
  describe "#link_to_event" do
    it "displays the title, and formatted date" do
      event = Event.new("Ruby Kaigi", Date.new(2010, 8, 27))
      # helper is an instance of ActionView::Base configured with the
      # EventsHelper and all of Rails' built-in helpers
      helper.link_to_event.should =~ /Ruby Kaigi, 27 Aug, 2010/
    end
  end
end

So helper is an instance of ActionView::Base. Very useful... I think.
But how do I use it for my scenario I wonder?


More information about the rspec-users mailing list