Ruby on rails 运行整个规范时Rspec失败
当我写rspec并用行号逐行运行时。 它工作良好,通过 当我运行整个rspec时,它失败了Ruby on rails 运行整个规范时Rspec失败,ruby-on-rails,rspec,Ruby On Rails,Rspec,当我写rspec并用行号逐行运行时。 它工作良好,通过 当我运行整个rspec时,它失败了 context "scope" do before do @current_user = User.current = User.first end it "should have user" do @current_user.should_not be_nil e
context "scope" do
before do
@current_user = User.current = User.first
end
it "should have user" do
@current_user.should_not be_nil
end
end
我花了几个小时来找出它失败的原因。我很确定你的测试有问题 使用databasecleaner在每次测试之间自动重置所有内容 参见此处的ref: