Trivial Sinatra application:
require 'rubygems'
require 'sinatra/base'
require 'haml'
class InfoController < Sinatra::Base
get "/" do
haml :index
end
end
And my test:
describe InfoController do
include Rack::Test::Methods
def app
InfoController
end
it "should return the index page when visiting the root of the site" do
get '/'
last_response.should be_ok
end
end
But I do not want to test whether or not the haml method worked, I just want to test that the index view was rendered.
How would you test that? Redefine the haml
method? Mock the haml
method somehow?