public Method

TestText__Format.test_abbreviations

Tests both abbreviations and abbreviations=

Source Code

# File action_mailer/vendor/text-format-0.6.3/text/format.rb, line 1059
def test_abbreviations
  abbr = ["    Pres. Abraham Lincoln\n", "    Pres.  Abraham Lincoln\n"]
  assert_nothing_raised { @format_o = Text::Format.new }
  assert_equal([], @format_o.abbreviations)
  assert_nothing_raised { @format_o.abbreviations = [ 'foo', 'bar' ] }
  assert_equal([ 'foo', 'bar' ], @format_o.abbreviations)
  assert_equal(abbr[0], @format_o.format(abbr[0]))
  assert_nothing_raised { @format_o.extra_space = true }
  assert_equal(abbr[1], @format_o.format(abbr[0]))
  assert_nothing_raised { @format_o.abbreviations = [ "Pres" ] }
  assert_equal([ "Pres" ], @format_o.abbreviations)
  assert_equal(abbr[0], @format_o.format(abbr[0]))
  assert_nothing_raised { @format_o.extra_space = false }
  assert_equal(abbr[0], @format_o.format(abbr[0]))
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.