test/lib/vedeu/models/attributes/coercions_test.rb in vedeu-0.2.0 vs test/lib/vedeu/models/attributes/coercions_test.rb in vedeu-0.2.1
- old
+ new
@@ -7,11 +7,10 @@
attr_reader :attributes
def initialize(attributes = {})
@attributes = attributes
@name = attributes[:name]
- @parent = attributes[:parent]
end
end
describe Coercions do
describe '.coercer' do
@@ -28,26 +27,26 @@
end
it 'returns a collection of models when a single hash' do
coerced = TestClass.coercer({ :name => 'test1' })
coerced.must_be_instance_of(Array)
- coerced.first.attributes.must_equal({ name: "test1", parent: nil })
+ coerced.first.attributes.must_equal({ name: "test1" })
end
it 'returns a collection of models when multiple hashes' do
coerced = TestClass.coercer([
{ :name => 'test1' }, { :name => 'test2' }
])
coerced.size.must_equal(2)
coerced.map(&:attributes).must_equal(
- [{ name: "test1", parent: nil }, { name: "test2", parent: nil }]
+ [{ name: "test1" }, { name: "test2" }]
)
end
it 'returns a collection of models when a single array' do
coerced = TestClass.coercer([{ :name => 'test3' }])
coerced.size.must_equal(1)
- coerced.first.attributes.must_equal({ name: "test3", parent: nil })
+ coerced.first.attributes.must_equal({ name: "test3" })
end
end
end
end