Skip to content

Commit ef15824

Browse files
committed
Added simple example for suppressing warning with JRuby
1 parent a0bfdb2 commit ef15824

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

bundler/spec/bundler/stub_specification_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
described_class.from_stub(gemspec)
1313
end
1414

15+
let(:with_java_gem_stub_spec) do
16+
gemspec = Gem::Specification.new do |s|
17+
s.name = "gemname"
18+
s.version = "1.0.0"
19+
s.loaded_from = __FILE__
20+
s.platform = "java"
21+
end
22+
23+
described_class.from_stub(gemspec)
24+
end
25+
1526
describe "#from_stub" do
1627
it "returns the same stub if already a Bundler::StubSpecification" do
1728
stub = described_class.from_stub(with_bundler_stub_spec)
@@ -43,6 +54,17 @@
4354
end
4455
end
4556

57+
describe "#ignored?" do
58+
skip "This example is only for without JRuby" if RUBY_ENGINE == 'jruby'
59+
60+
it "returns true if the gem is for different platform" do
61+
stub = described_class.from_stub(with_java_gem_stub_spec)
62+
allow(stub).to receive(:missing_extensions?).and_return(true)
63+
expect(stub).to_not receive(:warn)
64+
expect(stub.ignored?).to be true
65+
end
66+
end
67+
4668
describe "#missing_extensions?" do
4769
it "returns false if manually_installed?" do
4870
stub = described_class.from_stub(with_bundler_stub_spec)

0 commit comments

Comments
 (0)