现在我的rpsec是这样的:
describe Ability do
before(:each) do
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
end
有没有办法可以在每个描述块之前定义一个?像这样:
describe Ability do
before(:each) do
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
it "should xxx" do
end
it "should xxx" do
end
end
describe 'xxx' do
before(:each) do
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end
it "should xxx" do
end
it "should xxx" do
end
end
end
由于
答案 0 :(得分:2)
您提供的解决方案应该有效。你试过吗?