我有这个规格文件:
require 'spec_helper'
for i in 1..3
describe file ("/var/tmp/efl_test_0#{i}_link" )do
it { should be_linked_to "/tmp/efl_test_0#{i}" }
end
end
预期结果是:
/var/tmp/efl_test01_link should be_linke_to /tmp/efl_test01
/var/tmp/efl_test02_link should be_linke_to /tmp/efl_test02
/var/tmp/efl_test03_link should be_linke_to /tmp/efl_test03
实际结果是:
Failure/Error: it { should be_linked_to "/tmp/efl_test_0#{i}" }
stat -c %N /var/tmp/efl_test_01_link | egrep -e "-> ./tmp/efl_test_03."
Failure/Error: it { should be_linked_to "/tmp/efl_test_0#{i}" }
stat -c %N /var/tmp/efl_test_02_link | egrep -e "-> ./tmp/efl_test_03."
Failure/Error: it { should be_linked_to "/tmp/efl_test_0#{i}" }
stat -c %N /var/tmp/efl_test_03_link | egrep -e "-> ./tmp/efl_test_03."
每个链接都与03
目标进行比较。我猜这个问题是关于循环的。
我做错了什么?