欢迎光临Software MyZone,有问题可留言或到站点论坛发帖,争取第一时间帮忙解决 || 站点论坛:火龙论坛 || 淘宝小店:应小心的易淘屋 【欢迎大家提建设性意见】

rspec views测试

1 、元素自定义的属性:assert_no_tag ‘div’, :attributes => {:class => ‘admin-panel’}

2、 if the response contains two ordered lists, each with four list elements then:

assert_select “ol” do |elements|
elements.each do |element|
assert_select element, “li”, 4
end
end
will pass, as will:

assert_select “ol” do
assert_select “li”, 8
end

3 、Given a file named “spec/views/widgets/new.html.erb_spec.rb” with:
require “spec_helper”

describe “widgets/new” do
it “infers the controller path” do
controller.request.path_parameters[:action].should eq(“new”)
end
end
When I run `rspec spec/views`
Then the examples should all pass