Sha256: a462f1ac19df859c23ad78016e5894e6e34d2f4af383a5a0b2a765565e22bc3e

Contents?: true

Size: 1.5 KB

Versions: 88

Compression:

Stored size: 1.5 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'open_classes/kernel'
require 'test_toolbox'

describe Kernel do
  context :bluk_puts_eval do
    BULK_CODE1 = <<-EOS
"hoge-hige1" + "add"
"hoge-hige2" + "add"
    EOS

    BULK_EXPECTED1 = <<-EOS
"hoge-hige1" + "add" # => "hoge-hige1add"
"hoge-hige2" + "add" # => "hoge-hige2add"
    EOS

    BULK_CODE2 = <<-EOS
"hoge-hige1" + "add" + message
"hoge-hige2" + "add" + message
    EOS

    BULK_EXPECTED2 = <<-EOS
"hoge-hige1" + "add" + message # => "hoge-hige1addmsg"
"hoge-hige2" + "add" + message # => "hoge-hige2addmsg"
    EOS

    cases = [
      {
        case_no: 1,
        case_title: 'no bind case',
        code: BULK_CODE1,
        expected: BULK_EXPECTED1
      },
      {
        case_no: 2,
        case_title: 'with bind case',
        code: BULK_CODE1,
        bind: 'msg',
        expected: BULK_EXPECTED1
      },
    ]

    cases.each do |c|
      it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
        begin
          case_before c

          # -- given --
          message = c[:bind] if c[:bind]

          # -- when --
          actual = capture_stdout { bulk_puts_eval binding, c[:code] }

          # -- 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

88 entries across 88 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.127 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.126 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.125 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.124 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.123 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.122 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.121 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.120 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.119 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.118 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.117 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.116 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.115 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.114 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.113 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.112 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.111 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.110 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.109 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.108 spec/open_classes/kernel/bulk_puts_eval_spec.rb