public Method

TestText__Format.test_format_style

There's no documentation for this item.

Source Code

# File action_mailer/vendor/text-format-0.6.3/text/format.rb, line 1133
def test_format_style
  assert_nothing_raised { @format_o = Text::Format.new }
  assert_equal(Text::Format::LEFT_ALIGN, @format_o.format_style)
  assert_match(/^November 1863$/,
               @format_o.format(GETTYSBURG).split("\n")[-1])
  assert_nothing_raised {
    @format_o.format_style = Text::Format::RIGHT_ALIGN
  }
  assert_equal(Text::Format::RIGHT_ALIGN, @format_o.format_style)
  assert_match(/^ +November 1863$/,
               @format_o.format(GETTYSBURG).split("\n")[-1])
  assert_nothing_raised {
    @format_o.format_style = Text::Format::RIGHT_FILL
  }
  assert_equal(Text::Format::RIGHT_FILL, @format_o.format_style)
  assert_match(/^November 1863 +$/,
               @format_o.format(GETTYSBURG).split("\n")[-1])
  assert_nothing_raised { @format_o.format_style = Text::Format::JUSTIFY }
  assert_equal(Text::Format::JUSTIFY, @format_o.format_style)
  assert_match(/^of freedom, and that government of the people, by the  people,  for  the$/,
               @format_o.format(GETTYSBURG).split("\n")[-3])
  assert_raises(ArgumentError) { @format_o.format_style = 33 }
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.