fixing 1.8 support for new fixture tests
This commit is contained in:
parent
1716da0720
commit
5ec23b95ba
@ -43,7 +43,10 @@ def render(content)
|
||||
|
||||
# Validate our unmarshalled data.
|
||||
def validate(data)
|
||||
raise Fixture::FormatError, 'fixture is not a hash' unless Hash === data
|
||||
unless Hash === data || YAML::Omap === data
|
||||
raise Fixture::FormatError, 'fixture is not a hash'
|
||||
end
|
||||
|
||||
raise Fixture::FormatError unless data.all? { |name, row| Hash === row }
|
||||
data
|
||||
end
|
||||
|
@ -25,13 +25,15 @@ def test_names
|
||||
"rails_core_account",
|
||||
"last_account",
|
||||
"rails_core_account_2",
|
||||
"odegy_account"], fh.to_a.map(&:first)
|
||||
"odegy_account"].sort, fh.to_a.map(&:first).sort
|
||||
end
|
||||
end
|
||||
|
||||
def test_values
|
||||
File.open(::File.join(FIXTURES_ROOT, "accounts.yml")) do |fh|
|
||||
assert_equal [1,2,3,4,5,6], fh.to_a.map(&:last).map { |x| x['id'] }
|
||||
assert_equal [1,2,3,4,5,6].sort, fh.to_a.map(&:last).map { |x|
|
||||
x['id']
|
||||
}.sort
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
--- !!omap
|
||||
--- !omap
|
||||
<% 100.times do |i| %>
|
||||
- fixture_no_<%= i %>:
|
||||
id: <%= i %>
|
||||
|
Loading…
Reference in New Issue
Block a user