Merge pull request #12328 from Bo98/formula-spec-ref

formula: make each instance have separate spec references
This commit is contained in:
Bo Anderson 2021-10-26 17:17:11 +01:00 committed by GitHub
commit 273d330c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -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? ==

View File

@ -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"