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.87 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.86 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.85 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.84 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.83 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.82 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.81 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.80 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.79 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.78 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.77 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.76 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.75 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.74 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.73 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.72 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.71 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.70 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.69 spec/open_classes/kernel/bulk_puts_eval_spec.rb
tbpgr_utils-0.0.68 spec/open_classes/kernel/bulk_puts_eval_spec.rb