我对如何组织我的集成测试有点困惑。现在,它们是根据页面结构组织的:
post_pages_spec.rb:
require 'spec_helper'
describe "Post pages" do
describe "show page" do
describe "post destruction" do
end
describe "edit" do
end
end
describe "post creation" do
end
end
如您所见,删除和编辑在显示操作中,因为它们出现在显示页面中。
这是组织它们的另一种方式(基于 REST 操作):
post_pages_spec.rb:
require 'spec_helper'
describe "Post pages" do
describe "show page" do
end
describe "post destruction" do
end
describe "post creation" do
end
describe "edit" do
end
end
哪种结构更清晰、更易于维护?