这个问题是关于我做的一个测试,以验证用户页面中的所有 50 个微博都显示
我有这个 rspec 代码:
before(:all) { 50.times {FactoryGirl.create(:micropost,
user:user, content: "Lorem Ipsum") } }
我想让每个内容更加动态,例如:
"Lorem Ispum 0"
"Lorem Ipsum 1"
"Lorem Ipsum 2"
...
我试着写:
let(:count_helper) { 0 }
before(:all) { 50.times {FactoryGirl.create(:micropost,
user:user,
content: "Lorem Ipsum #{count_helper}")
count_helper += 1} }
它在这里失败了:
count_helper += 1
怎样才能写对?