aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Afanasjew2015-12-15 10:27:19 +0100
committerMartin Afanasjew2015-12-17 13:50:38 +0100
commit10f066197e4313019ec10781850b1253b2ccebec (patch)
tree307dd842c69c3aac5ec09ab1a99361a76aa27011 /Library
parent6d802d808727e3e13aeab93ef5fac7ee831fca07 (diff)
downloadbrew-10f066197e4313019ec10781850b1253b2ccebec.tar.bz2
tests: rely on fewer implementation details
These tests were using too much semi-global state (instance variables) and relied unnecessarily on the exact number of calls to `optional?` and `recommended?` in the `Depedable` module.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_dependency_expansion.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/test/test_dependency_expansion.rb b/Library/Homebrew/test/test_dependency_expansion.rb
index a542bfa93..c6ac84c7c 100644
--- a/Library/Homebrew/test/test_dependency_expansion.rb
+++ b/Library/Homebrew/test/test_dependency_expansion.rb
@@ -48,15 +48,15 @@ class DependencyExpansionTests < Homebrew::TestCase
end
def test_expand_skips_optionals_by_default
- @foo.expects(:optional?).returns(true)
- @f = stub(:deps => @deps, :build => stub(:with? => false), :name => "f")
- assert_equal [@bar, @baz, @qux], Dependency.expand(@f)
+ deps = [build_dep(:foo, [:optional]), @bar, @baz, @qux]
+ f = stub(:deps => deps, :build => stub(:with? => false), :name => "f")
+ assert_equal [@bar, @baz, @qux], Dependency.expand(f)
end
def test_expand_keeps_recommendeds_by_default
- @foo.expects(:recommended?).returns(true)
- @f = stub(:deps => @deps, :build => stub(:with? => true), :name => "f")
- assert_equal @deps, Dependency.expand(@f)
+ deps = [build_dep(:foo, [:recommended]), @bar, @baz, @qux]
+ f = stub(:deps => deps, :build => stub(:with? => true), :name => "f")
+ assert_equal deps, Dependency.expand(f)
end
def test_merges_repeated_deps_with_differing_options