diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-03-13 19:14:37 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-04-29 23:43:25 -0300 |
commit | 248e60df80040e085b51d3689fa83e3ac92b634d (patch) | |
tree | 643438c7d9924afcb2d9367018bdf67345dc81df | |
parent | fdfcf64eb991397721665bb749a32079e199ef90 (diff) | |
download | highline-248e60df80040e085b51d3689fa83e3ac92b634d.tar.gz |
Remove HighLine::Wrapper tests' dependency on HighLine
-rw-r--r-- | test/test_wrapper.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/test_wrapper.rb b/test/test_wrapper.rb index 062d6fa..0d1b8a5 100644 --- a/test/test_wrapper.rb +++ b/test/test_wrapper.rb @@ -1,20 +1,20 @@ require "minitest/autorun" require "test_helper" -require "highline" +require "highline/wrapper" class TestHighLineWrapper < Minitest::Test def setup - HighLine.reset - @input = StringIO.new - @output = StringIO.new - @terminal = HighLine.new(@input, @output) - @terminal.wrap_at = 80 + @wrap_at = 80 + end + + def wrap(text) + HighLine::Wrapper.wrap text, @wrap_at end def test_dont_wrap_if_line_is_shorter_than_wrap_at - @terminal.say("This is a very short line.\n") - assert_equal("This is a very short line.\n", @output.string) + wrapped = wrap("This is a very short line.\n") + assert_equal "This is a very short line.\n", wrapped end def test_wrap_long_lines_correctly @@ -33,8 +33,8 @@ class TestHighLineWrapper < Minitest::Test "things like this.\n\n" - @terminal.say long_line - assert_equal wrapped_long_line, @output.string + wrapped = wrap(long_line) + assert_equal wrapped_long_line, wrapped end def test_dont_wrap_already_well_wrapped_text @@ -44,12 +44,12 @@ class TestHighLineWrapper < Minitest::Test " * Because it's already formatted correctly and does not\n" + " exceed the limit!\n" - @terminal.say well_formatted_text - assert_equal well_formatted_text, @output.string + wrapped = wrap(well_formatted_text) + assert_equal well_formatted_text, wrapped end def test_wrap_single_word_longer_than_wrap_at - @terminal.say("-=" * 50) - assert_equal(("-=" * 40 + "\n") + ("-=" * 10 + "\n"), @output.string) + wrapped = wrap("-=" * 50) + assert_equal(("-=" * 40 + "\n") + ("-=" * 10), wrapped) end end
\ No newline at end of file |