提交 dab0de4a 编写于 作者: A Akira Matsuda

Use Enumerable#with_index. We're on Ruby > 1.8.7 (part II)

上级 49bf8597
...@@ -178,11 +178,9 @@ def test_omap_fixtures ...@@ -178,11 +178,9 @@ def test_omap_fixtures
assert_nothing_raised do assert_nothing_raised do
fixtures = ActiveRecord::Fixtures.new(Account.connection, 'categories', 'Category', FIXTURES_ROOT + "/categories_ordered") fixtures = ActiveRecord::Fixtures.new(Account.connection, 'categories', 'Category', FIXTURES_ROOT + "/categories_ordered")
i = 0 fixtures.each.with_index do |(name, fixture), i|
fixtures.each do |name, fixture|
assert_equal "fixture_no_#{i}", name assert_equal "fixture_no_#{i}", name
assert_equal "Category #{i}", fixture['name'] assert_equal "Category #{i}", fixture['name']
i += 1
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册