Skip to content

Commit 49ec4cf

Browse files
test db2 is null fix
1 parent 0bbced2 commit 49ec4cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/db/db2/simple_test.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,21 @@ def test_find_by_sql_WITH_statement
114114
assert_equal db.id, connection.last_insert_id
115115
#assert_equal e.id, connection.last_insert_id('entries')
116116
end
117+
118+
# DB2 does not like "= NULL".
119+
def test_equals_null
120+
Entry.create!(:title => "Foo")
121+
entry = Entry.find(:first, :conditions => ["content = NULL"])
122+
assert_equal "Foo", entry.title
123+
end
124+
125+
# DB2 does not like "!= NULL" or "<> NULL".
126+
def test_not_equals_null
127+
Entry.create!(:title => "Foo", :content => "Bar")
128+
entry = Entry.find_by_title("Foo", :conditions => ["content != NULL"])
129+
assert_equal "Foo", entry.title
130+
entry = Entry.find_by_title("Foo", :conditions => ["content <> NULL"])
131+
assert_equal "Foo", entry.title
132+
end
117133

118134
end

0 commit comments

Comments
 (0)