Sha256: a72a003773d2ac419933c40da1daa6b0fd4fe5ec93b536e80c4fcf6e3400b4b5

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'tbpgr_utils'

describe Array do

  context :together do
    cases = [
      {
        case_no: 1,
        case_title: 'valid case',
        inputs: [[1, 2, 3], %w{one two three}],
        expected: ['1:one', '2:two', '3:three'],
      },
      {
        case_no: 2,
        case_title: 'contain nil case',
        inputs: [[1, 2, 3], %w{one two}],
        expected: ['1:one', '2:two', '3:'],
      },
    ]

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

          # -- given --
          # nothing

          # -- when/then --
          actual = []
          c[:inputs].together do |first, second|
            actual << "#{first}:#{second}"
          end

          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

4 entries across 4 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.12 spec/open_classes/array_spec.rb
tbpgr_utils-0.0.11 spec/open_classes/array_spec.rb
tbpgr_utils-0.0.10 spec/open_classes/array_spec.rb
tbpgr_utils-0.0.9 spec/open_classes/array_spec.rb