Sha256: a5371e7bc32ce45d6a665bc89bc325999e604ed4d6e5b01ccf4acbb73dea14d6

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

require 'test_helper'

class CucumberTableFormatterTest < Test::Unit::TestCase
  context "A simple table" do
    setup { @table = "| a | b | c |" }
    
    should "be returned as-is" do
      assert_equal @table, format(@table)
    end
  end
  
  context "A simple table with missing whitespace" do
    setup { @table = "|a|b | c|" }
    
    should "be returned with whitespace" do
      assert_equal "| a | b | c |", format(@table)
    end
  end
  
  context "A more complex table without leading whitespace" do
    setup do
      @table = "| a | b | c |\n|def|ghi|jkl|\n|foobar|baz|blur|"
    end
    
    should "be returned in proper format" do
      expectation = "|      a |   b |    c |\n|    def | ghi |  jkl |\n| foobar | baz | blur |"
      assert_equal expectation, format(@table)
    end
  end
  
  context "A more complex table with leading whitespace" do
    setup do
      @table = "    | a | b | c |\n    |def|ghi|jkl|\n    |foobar|baz|blur|"
    end
    
    should "be returned in proper format" do
      expectation = "    |      a |   b |    c |\n    |    def | ghi |  jkl |\n    | foobar | baz | blur |"
      assert_equal expectation, format(@table)
    end
  end
  
  context "A more complex table with unicode-characters" do
    setup do
      @table = "| Ö | b | c |\n|def|ghi|jkl|\n|foobar|baz|blur|"
    end
    
    should "be returned in proper format" do
      expectation = "|      Ö |   b |    c |\n|    def | ghi |  jkl |\n| foobar | baz | blur |"
      assert_equal expectation, format(@table)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
colszowka-cucumber_table_formatter-0.2.1 test/cucumber_table_formatter_test.rb
colszowka-cucumber_table_formatter-0.2.2 test/cucumber_table_formatter_test.rb
colszowka-cucumber_table_formatter-0.2.4 test/cucumber_table_formatter_test.rb