diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 2c8a856e3a..b9e05f3b0b 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -262,7 +262,7 @@ class Formula end def spec_eval(name) - spec = self.class.send(name) + spec = self.class.send(name).dup return unless spec.url spec.owner = self @@ -1449,9 +1449,9 @@ class Formula # @private def ==(other) - instance_of?(other.class) && + self.class == other.class && name == other.name && - active_spec == other.active_spec + active_spec_sym == other.active_spec_sym end alias eql? == diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index a155d0017b..b02c3c41f0 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -567,6 +567,14 @@ describe Formula do expect(f.class.head).to be_kind_of(SoftwareSpec) end + specify "instance specs have different references" do + f = Testball.new + f2 = Testball.new + + expect(f.stable.owner).to equal(f) + expect(f2.stable.owner).to equal(f2) + end + specify "incomplete instance specs are not accessible" do f = formula do url "foo-1.0"