# File scripts/test-harvester.rb, line 108 def test_match_consumption match_dep = '\$\d+ dep(\.|osit)?' dep_rule = RegexRule.new(match_dep) match_price = '\$(\d+)' price_rule = RegexRule.new(match_price, {'price'=>'\1'}) ad = Ad.new("Cupertino Apt. $950/mo. 555-1234") ad.apply_rule(dep_rule) ad.apply_rule(price_rule) assert_equal('950', ad.atts[15]['price']) ad = Ad.new("dwntwn SJ, $500 deposit. 555-1234") ad.apply_rule(dep_rule) ad.apply_rule(price_rule) assert(ad.atts.empty?) end