public Method

TestText__Format.test_s_new

There's no documentation for this item.

Source Code

# File action_mailer/vendor/text-format-0.6.3/text/format.rb, line 1347
def test_s_new
      # new(NilClass) { block }
  assert_nothing_raised do
    @format_o = Text::Format.new {
      self.text = "Test 1, 2, 3"
    }
  end
  assert_equal("Test 1, 2, 3", @format_o.text)

    # new(Hash Symbols)
  assert_nothing_raised { @format_o = Text::Format.new(:columns => 72) }
  assert_equal(72, @format_o.columns)

    # new(Hash String)
  assert_nothing_raised { @format_o = Text::Format.new('columns' => 72) }
  assert_equal(72, @format_o.columns)

    # new(Hash) { block }
  assert_nothing_raised do
    @format_o = Text::Format.new('columns' => 80) {
      self.text = "Test 4, 5, 6"
    }
  end
  assert_equal("Test 4, 5, 6", @format_o.text)
  assert_equal(80, @format_o.columns)

    # new(Text::Format)
  assert_nothing_raised do
    fo = Text::Format.new(@format_o)
    assert(fo == @format_o)
  end

    # new(Text::Format) { block }
  assert_nothing_raised do
    fo = Text::Format.new(@format_o) { self.columns = 79 }
    assert(fo != @format_o)
  end

      # new(String)
  assert_nothing_raised { @format_o = Text::Format.new("Test A, B, C") }
  assert_equal("Test A, B, C", @format_o.text)

      # new(String) { block }
  assert_nothing_raised do
    @format_o = Text::Format.new("Test X, Y, Z") { self.columns = -5 }
  end
  assert_equal("Test X, Y, Z", @format_o.text)
  assert_equal(5, @format_o.columns)
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.