Sha256: 3ce5ce03f830861cedca2f0cfa9210ff3e80ecbdde411551ecc8f18d3e07e221

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'open_classes/string/ascii_unicode_html_table'

describe String do
  context :ascii_unicode_html_table do
    cases = [
      {
        case_no: 1,
        case_title: '> case',
        input: 'aあb',
        expected: <<-EOS
<table>
  <tr>
    <th>char</th>
    <th>ASCII</th>
    <th>ascii2</th>
    <th>Unicode</th>
  </tr>
  <tr>
    <td>a</td>
    <td>97</td>
    <td>1100001</td>
    <td>--</td>
  </tr>
  <tr>
    <td>あ</td>
    <td>--</td>
    <td>--</td>
    <td>0x3042</td>
  </tr>
  <tr>
    <td>b</td>
    <td>98</td>
    <td>1100010</td>
    <td>--</td>
  </tr>
</table>
        EOS
      }
    ]

    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].ascii_unicode_html_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

1 entries across 1 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 spec/open_classes/string/ascii_unicode_html_table_spec.rb