Sha256: 00851271388d226fe62dbef9cc4b98bcb7e02c80c720624509ec4bc37f5024fd

Contents?: true

Size: 897 Bytes

Versions: 6

Compression:

Stored size: 897 Bytes

Contents

require 'test_helper'

module Tins
  class ExtractLastArgumentOptionsTest < Test::Unit::TestCase
    require 'tins/xt/extract_last_argument_options'

    def test_empty_argument_array
      arguments = []
      result = arguments.extract_last_argument_options
      assert_equal [ [], {} ], result
      assert_not_same arguments, result.first
    end

    def test_argument_array_without_options
      arguments = [ 1, 2, 3 ]
      result = arguments.extract_last_argument_options
      assert_equal [ [ 1, 2, 3 ], {} ], result
      assert_not_same arguments, result.first
    end

    def test_argument_array_witt_options
      arguments = [ 1, 2, 3, { foo: :bar } ]
      result = arguments.extract_last_argument_options
      assert_equal [ [ 1, 2, 3 ], { foo: :bar } ], result
      assert_not_same arguments, result.first
      assert_not_same arguments.last, result.last
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tins-1.38.0 tests/extract_last_argument_options_test.rb
tins-1.37.1 tests/extract_last_argument_options_test.rb
tins-1.37.0 tests/extract_last_argument_options_test.rb
tins-1.36.1 tests/extract_last_argument_options_test.rb
tins-1.36.0 tests/extract_last_argument_options_test.rb
tins-1.35.0 tests/extract_last_argument_options_test.rb