From 8d2ef974a3a87bf4207f71ccb8a7b4776e16a016 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 12 Aug 2014 23:55:28 -0500 Subject: Replace Options.coerce with an alternate constructor --- Library/Homebrew/test/test_build_options.rb | 4 ++-- Library/Homebrew/test/test_options.rb | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index a0c52da81..7d2c952d9 100644 --- a/Library/Homebrew/test/test_build_options.rb +++ b/Library/Homebrew/test/test_build_options.rb @@ -4,8 +4,8 @@ require "options" class BuildOptionsTests < Homebrew::TestCase def setup - args = Options.coerce(%w(--with-foo --with-bar --without-qux)) - opts = Options.coerce(%w(--with-foo --with-bar --without-baz --without-qux)) + args = Options.create(%w(--with-foo --with-bar --without-qux)) + opts = Options.create(%w(--with-foo --with-bar --without-baz --without-qux)) @build = BuildOptions.new(args, opts) end diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb index 250360a30..264ef772a 100644 --- a/Library/Homebrew/test/test_options.rb +++ b/Library/Homebrew/test/test_options.rb @@ -132,22 +132,18 @@ class OptionsTests < Homebrew::TestCase assert_equal [foo, bar, baz].sort, (@options | options).to_a.sort end - def test_coerce_with_array + def test_create_with_array array = %w{--foo --bar} option1 = Option.new("foo") option2 = Option.new("bar") - assert_equal [option1, option2].sort, Options.coerce(array).to_a.sort + assert_equal [option1, option2].sort, Options.create(array).to_a.sort end - def test_coerce_raises_for_inappropriate_types - assert_raises(TypeError) { Options.coerce(1) } - end - - def test_coerce_splits_multiple_switches_with_single_dash + def test_create_splits_multiple_switches_with_single_dash array = %w{-vd} verbose = Option.new("-v") debug = Option.new("-d") - assert_equal [verbose, debug].sort, Options.coerce(array).to_a.sort + assert_equal [verbose, debug].sort, Options.create(array).to_a.sort end def test_copies_do_not_share_underlying_collection -- cgit v1.2.3