简单的Sinatra应用程序:
require 'rubygems'
require 'sinatra/base'
require 'haml'
class InfoController < Sinatra::Base
get "/" do
haml :index
end
end
我的测试:
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
但是我不想测试haml方法是否有效,我只想测试索引视图是否被呈现。
你要怎么测试?重新定义
haml
方法?嘲笑
不知怎么的?