Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add failing test

(Note: the first argument of assert_equal is the expected value.)
  • Loading branch information...
commit 3857bc6f551c0939d27e4ef5189b0cab9209c68e 1 parent e8186e7
David James xpe authored
12 test/foreigner/connection_adapters/abstract/table_definition_test.rb
View
@@ -5,9 +5,17 @@ class TestDefinition
include Foreigner::ConnectionAdapters::TableDefinition
end
- test "foreign_key" do
+ test "foreign_key used once" do
definition = TestDefinition.new
definition.foreign_key :poops, and: :one;
- assert_equal definition.foreign_keys[:poops], and: :one
+ assert_equal({ and: :one }, definition.foreign_keys[:poops])
+ end
+
+ test "foreign_key used twice" do
+ definition = TestDefinition.new
+ definition.foreign_key :nodes, column: :from_id
+ definition.foreign_key :nodes, column: :to_id
+ assert_equal [{ column: :from_id }, { column: :to_id }],
+ definition.foreign_keys[:nodes]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.