我有下面的代码将我的模型变量传递给视图
describe "payslips/index.html.erb" do
it "should display the page" do
assign(:income_tax_rates, [
stub_model(IncomeTaxRate.all)
])
render
puts rendered
# expect(rendered).to include()
end
end
然后我有这个:
<% @income_tax_rates.each do |tax_rate| %>
<tr>
<td><%= number_to_currency tax_rate[:income_from], :precision => 0 %></td>
<td><%= number_to_currency tax_rate[:income_to], :precision => 0 %></td>
<td><%= tax_rate[:start] %></td>
<td><%= tax_rate[:finish] %></td>
<td><%= tax_rate[:rate] %></td>
<td><%= number_to_currency tax_rate[:premium], :precision => 0 %></td>
</tr>
<% end %>
但这似乎并没有产生任何东西,而是我得到了 empty td
s
我能做些什么来改善这一点?