Permalink
Browse files

Add test for history entries

Removing individual history entries is still not supported (short of doing
a "set" on the entire set of entries).
  • Loading branch information...
1 parent 6dfdd81 commit aceed00d44d3efeccefff6c6f5ba9b0ec1e7ee9d @scotchi scotchi committed Aug 17, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 Ruby/test/test_directededge.rb
View
15 Ruby/test/test_directededge.rb
@@ -466,4 +466,19 @@ def test_histories
assert(@database.histories.include?(history))
assert(@database.histories.include?(dummy))
end
+
+ def test_history_entries
+ history = DirectedEdge::History.new(:from => :customer, :to => :product)
+ @database.histories = [ history ]
+
+ customer = DirectedEdge::Item.new(@database, 'customer1')
+ product = DirectedEdge::Item.new(@database, 'product1')
+
+ assert(customer.history_entries.empty?)
+
+ customer.history_entries.add(DirectedEdge::HistoryEntry.new(product, :history => history))
+ customer.save
+
+ assert(customer.history_entries.size == 1)
+ end
end

0 comments on commit aceed00

Please sign in to comment.