我正在尝试测试 rails helper 中的 html 块方法:
def dashboard_widget(header, &proc)
concat('<div class="dashboard-widget">')
etc
end
代码在开发环境中完美运行,但以下测试失败:
it "should be created" do
helper.dashboard_widget('My widget') do
"hello world"
end.should be_true
end
使用以下堆栈跟踪:
d:/s/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_view/helpers/text_helper.rb:32:in `concat'
D:/makabu/medved/winvest/master/app/helpers/dashboards_helper.rb:6:in `dashboard_widget'
./spec\helpers\dashboards_helper_spec.rb:13:
d:/s/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `instance_eva
l'
d:/s/ruby/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:40:in `execute'
请建议我做错了什么?
谢谢。