【发布时间】:2014-02-05 01:12:04
【问题描述】:
这是我的场景:
我有一堆 rspec 测试
describe "a bunch of tests" do
let(:my_variable) {something}
context "10 tests" do
...
end
context "another 10 tests" do
...
end
end
我想将 my_variable 设置为别的并进行相同的 20 次测试,我可以再次这样做
describe "a bunch of tests" do
let(:my_variable) {something else}
context "10 tests" do
...
end
context "another 10 tests" do
...
end
end
我想知道有没有更好的方法来做没有那么多重复的测试?
谢谢
【问题讨论】:
标签: ruby-on-rails ruby rspec ruby-on-rails-3.2