Sha256: 709dfe8c16fce8e1af54983e903dfeed958d9a75dea32365167bdfa500d6aea8
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'tbpgr_utils' describe String do context :justify_table do SAMPLE_TABLE = <<-EOS |* first name|* family name| |eiichiro|oda| |akira|toriyama| |yusei|matsui| EOS SAMPLE_NOT_TABLE = <<-EOS csv_column1_1, csv_column1_2 csv_column2_1, csv_column2_2 EOS SAMPLE_JUSTIFIED_TABLE = <<-EOS |* first name|* family name| |eiichiro |oda | |akira |toriyama | |yusei |matsui | EOS SAMPLE_TABLE4 = <<-EOS |* firstあ name|* family いいname| |eiichiro|oda| |akira|toriyama| |yusei|matsui| EOS SAMPLE_JUSTIFIED_TABLE4 = <<-EOS |* firstあ name|* family いいname| |eiichiro |oda | |akira |toriyama | |yusei |matsui | EOS cases = [ { case_no: 1, case_title: 'valid justify case', input: SAMPLE_TABLE, expected: SAMPLE_JUSTIFIED_TABLE, }, { case_no: 2, case_title: 'not table case', input: SAMPLE_NOT_TABLE, expected: SAMPLE_NOT_TABLE, }, { case_no: 3, case_title: 'empty case', input: '', expected: '', }, { case_no: 4, case_title: 'ascii/other code mix valid justify case', input: SAMPLE_TABLE4, expected: SAMPLE_JUSTIFIED_TABLE4, }, ] cases.each do |c| it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do begin case_before c # -- given -- # nothing # -- when -- actual = c[:input].justify_table # -- then -- expect(actual).to eq(c[:expected]) ensure case_after c end end def case_before(c) # implement each case before end def case_after(c) # implement each case after end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tbpgr_utils-0.0.77 | spec/open_classes/string/justify_table_spec.rb |
tbpgr_utils-0.0.76 | spec/open_classes/string/justify_table_spec.rb |