Sha256: 025134360e7c84deca30ff73414fc33ec46c6e87524fc4b354a66c4a979cff00

Contents?: true

Size: 918 Bytes

Versions: 69

Compression:

Stored size: 918 Bytes

Contents

require 'test_helper'
require 'tins'

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

69 entries across 67 versions & 7 rubygems

Version Path
tins-0.5.0 tests/extract_last_argument_options_test.rb
tins-0.4.3 tests/extract_last_argument_options_test.rb
tins-0.4.2 tests/extract_last_argument_options_test.rb
tins-0.4.1 tests/extract_last_argument_options_test.rb
tins-0.4.0 tests/extract_last_argument_options_test.rb
tins-0.3.14 tests/extract_last_argument_options_test.rb
tins-0.3.13 tests/extract_last_argument_options_test.rb
tins-0.3.12 tests/extract_last_argument_options_test.rb
tins-0.3.11 tests/extract_last_argument_options_test.rb