Merge pull request #12328 from Bo98/formula-spec-ref
formula: make each instance have separate spec references
This commit is contained in:
commit
273d330c9d
@ -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? ==
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user