1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/bundler/other/ext_spec.rb
hsbt 8598f8c2dc Merge bundler to standard libraries.
rubygems 2.7.x depends bundler-1.15.x. This is preparation for
  rubygems and bundler migration.

  * lib/bundler.rb, lib/bundler/*: files of bundler-1.15.4
  * spec/bundler/*: rspec examples of bundler-1.15.4. I applied patches.
    * https://github.com/bundler/bundler/pull/6007
    * Exclude not working examples on ruby repository.
    * Fake ruby interpriter instead of installed ruby.
  * Makefile.in: Added test task named `test-bundler`. This task is only
    working macOS/linux yet. I'm going to support Windows environment later.
  * tool/sync_default_gems.rb: Added sync task for bundler.

  [Feature #12733][ruby-core:77172]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-08 08:45:41 +00:00

67 lines
2.2 KiB
Ruby

# frozen_string_literal: true
require "spec_helper"
RSpec.describe "Gem::Specification#match_platform" do
it "does not match platforms other than the gem platform" do
darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
expect(darwin.match_platform(pl("java"))).to eq(false)
end
context "when platform is a string" do
it "matches when platform is a string" do
lazy_spec = Bundler::LazySpecification.new("lol", "1.0", "universal-mingw32")
expect(lazy_spec.match_platform(pl("x86-mingw32"))).to eq(true)
expect(lazy_spec.match_platform(pl("x64-mingw32"))).to eq(true)
end
end
end
RSpec.describe "Bundler::GemHelpers#generic" do
include Bundler::GemHelpers
it "converts non-windows platforms into ruby" do
expect(generic(pl("x86-darwin-10"))).to eq(pl("ruby"))
expect(generic(pl("ruby"))).to eq(pl("ruby"))
end
it "converts java platform variants into java" do
expect(generic(pl("universal-java-17"))).to eq(pl("java"))
expect(generic(pl("java"))).to eq(pl("java"))
end
it "converts mswin platform variants into x86-mswin32" do
expect(generic(pl("mswin32"))).to eq(pl("x86-mswin32"))
expect(generic(pl("i386-mswin32"))).to eq(pl("x86-mswin32"))
expect(generic(pl("x86-mswin32"))).to eq(pl("x86-mswin32"))
end
it "converts 32-bit mingw platform variants into x86-mingw32" do
expect(generic(pl("mingw32"))).to eq(pl("x86-mingw32"))
expect(generic(pl("i386-mingw32"))).to eq(pl("x86-mingw32"))
expect(generic(pl("x86-mingw32"))).to eq(pl("x86-mingw32"))
end
it "converts 64-bit mingw platform variants into x64-mingw32" do
expect(generic(pl("x64-mingw32"))).to eq(pl("x64-mingw32"))
expect(generic(pl("x86_64-mingw32"))).to eq(pl("x64-mingw32"))
end
end
RSpec.describe "Gem::SourceIndex#refresh!" do
before do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
end
it "does not explode when called", :rubygems => "1.7" do
run "Gem.source_index.refresh!"
run "Gem::SourceIndex.new([]).refresh!"
end
it "does not explode when called", :rubygems => "< 1.7" do
run "Gem.source_index.refresh!"
run "Gem::SourceIndex.from_gems_in([]).refresh!"
end
end