Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created November 4, 2009 18:35
Show Gist options
  • Save joevandyk/226278 to your computer and use it in GitHub Desktop.
Save joevandyk/226278 to your computer and use it in GitHub Desktop.
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
require 'action_view/test_case'
class TestBusinessSearchHelpers < ActionView::TestCase
include BusinessSearchHelper
ADDRESS_FORMATTERS_EXAMPLES = [
{ :input => "Foo Goo 123",
:expected => "Foo Goo 123" },
{ :input => "Blah Ste 345",
:expected => "Blah Ste&nbsp;345" },
{ :input => "Blah apt. 345",
:expected => "Blah apt.&nbsp;345" },
{ :input => "Blah apartment. 345",
:expected => "Blah apartment.&nbsp;345" },
{ :input => "",
:expected => "" },
{ :input => "Joe's Apartment 123",
:expected => "Joe's Apartment&nbsp;123" },
]
ADDRESS_FORMATTERS_EXAMPLES.each_with_index do |options, i|
define_method "test_format_address_#{i}" do
assert_equal options[:expected], format_address(options[:input])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment