Skip to content

Commit 5a5e839

Browse files
Merge pull request #8073 from Earlopain/bundler-activation-still-false
Fix `stub.activated?` sometimes returning false after activation under bundler (cherry picked from commit ced0c67)
1 parent d599df2 commit 5a5e839

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

bundler/lib/bundler/stub_specification.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def missing_extensions?
4545
true
4646
end
4747

48-
def activated
49-
stub.activated
48+
def activated?
49+
stub.activated?
5050
end
5151

5252
def activated=(activated)

bundler/spec/bundler/stub_specification_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,24 @@
5555
expect(stub.missing_extensions?).to be true
5656
end
5757
end
58+
59+
describe "#activated?" do
60+
it "returns true after activation" do
61+
stub = described_class.from_stub(with_bundler_stub_spec)
62+
63+
expect(stub.activated?).to be_falsey
64+
stub.activated = true
65+
expect(stub.activated?).to be true
66+
end
67+
68+
it "returns true after activation if the underlying stub is a `Gem::StubSpecification`" do
69+
spec_path = File.join(File.dirname(__FILE__), "specifications", "foo.gemspec")
70+
gem_stub = Gem::StubSpecification.new(spec_path, File.dirname(__FILE__),"","")
71+
stub = described_class.from_stub(gem_stub)
72+
73+
expect(stub.activated?).to be_falsey
74+
stub.activated = true
75+
expect(stub.activated?).to be true
76+
end
77+
end
5878
end

0 commit comments

Comments
 (0)