def test_keyword
keywords = ["willow glen", "wg", "w.g."]
results = { "city"=>"San Jose", "neighborhood"=>"Willow Glen" }
rule = KeywordRule.new(keywords, results)
ad = "3/4 SFH dwntwn WG 555-1234"
ext_fields = rule.apply(ad)
assert_equal("San Jose", ext_fields["city"])
assert_equal("Willow Glen", ext_fields["neighborhood"])
ad = "Willow Glen 3/4 SFH 555-1234"
ext_fields = rule.apply(ad)
assert_equal("San Jose", ext_fields["city"])
assert_equal("Willow Glen", ext_fields["neighborhood"])
ad = "Beautiful home near dwntwn wg"
ext_fields = rule.apply(ad)
assert_equal("San Jose", ext_fields["city"])
assert_equal("Willow Glen", ext_fields["neighborhood"])
ad = "dawg wget awgwa"
ext_fields = rule.apply(ad)
assert_nil(ext_fields["city"])
assert_nil(ext_fields["neighborhood"])
end