我真的希望你能帮我重构这个:
context "a deactivated resource" do
before(:each)
@resource = FactoryGirl.create(:deactivatedresource)
end
it "does not show in the search (as registred User)" do
as_user # does the log in
visit path_to_search_page
page.should_not have_content @resource.name
end
it "is visible to the resource owner" do
as_resource_owner(@resource)
visit path_to_search_page
page.should_have content @resource.name
end
it "as unregistred user" do
as_unregistred_user # checks for log out and logs out if necessary
visit path_to_search_page
page.should_not have_content @resource.name
end
我真的很想将visit
andshould(not) have
部分放在 en extraafter(:each)
块中,但这会产生令人讨厌的输出。你会怎么做?