diff options
| author | Jack Nagel | 2014-08-12 23:55:28 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-08-12 23:55:28 -0500 |
| commit | 25395c6de60849ea92c74bed8506d6e209ea7bf4 (patch) | |
| tree | 8fc5879de012fead9ed6bcf7a17ed65697e3721b /Library/Homebrew/test | |
| parent | 0a2be32d802073ef46596792a46f7139bb862a8c (diff) | |
| download | brew-25395c6de60849ea92c74bed8506d6e209ea7bf4.tar.bz2 | |
Replace Options.coerce with an alternate constructor
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_build_options.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_options.rb | 12 |
2 files changed, 6 insertions, 10 deletions
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 |
