diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-21 17:01:55 -0400 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-21 22:06:26 -0400 |
commit | 608cf3144439287ccb181593fbb40d5051063da4 (patch) | |
tree | 4b5d43679973d3e4a61a0594b197e7d94eb030fb /spec/install/gemfile/gemspec_spec.rb | |
parent | 2922a0aaa42edc92b0e061725afc96e2e6f72d64 (diff) | |
download | bundler-608cf3144439287ccb181593fbb40d5051063da4.tar.gz |
Add specs for bundling with locked platform-specific gemspec deps on RUBY
Diffstat (limited to 'spec/install/gemfile/gemspec_spec.rb')
-rw-r--r-- | spec/install/gemfile/gemspec_spec.rb | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index f860f55f13..cae005ff2d 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -266,5 +266,151 @@ describe "bundle install from an existing gemspec" do end end end + + context "bundled for ruby and jruby" do + let(:platform_specific_type) { :runtime } + before do + build_lib "foo", :path => "." do |s| + if platform_specific_type == :runtime + s.add_runtime_dependency "platform_specific" + elsif platform_specific_type == :development + s.add_development_dependency "platform_specific" + else + raise "wrong dependency type #{platform_specific_type}, can only be :development or :runtime" + end + end + + %w(ruby jruby).each do |platform| + simulate_platform(platform) do + install_gemfile <<-G + source "file://#{gem_repo1}" + gemspec + G + end + end + end + + context "on ruby" do + before do + simulate_platform("ruby") + bundle :install + end + + context "as a runtime dependency" do + it "keeps java dependencies in the lockfile" do + should_be_installed "foo 1.0", "platform_specific 1.0 RUBY" + expect(lockfile).to eq strip_whitespace(<<-L) + PATH + remote: . + specs: + foo (1.0) + platform_specific + + GEM + remote: file:#{gem_repo1}/ + specs: + platform_specific (1.0) + platform_specific (1.0-java) + + PLATFORMS + java + ruby + + DEPENDENCIES + foo! + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + + context "as a development dependency" do + let(:platform_specific_type) { :development } + + it "keeps java dependencies in the lockfile" do + should_be_installed "foo 1.0", "platform_specific 1.0 RUBY" + expect(lockfile).to eq strip_whitespace(<<-L) + PATH + remote: . + specs: + foo (1.0) + + GEM + remote: file:#{gem_repo1}/ + specs: + platform_specific (1.0) + platform_specific (1.0-java) + + PLATFORMS + java + ruby + + DEPENDENCIES + foo! + platform_specific + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + + context "with an indirect platform-specific development dependency" do + before do + build_repo2 do + build_gem "indirect_platform_specific" do |s| + s.add_runtime_dependency "platform_specific" + end + end + + build_lib "foo", :path => "." do |s| + s.add_development_dependency "indirect_platform_specific" + end + + %w(ruby jruby).each do |platform| + simulate_platform(platform) do + install_gemfile <<-G + source "file://#{gem_repo2}" + gemspec + G + end + end + + simulate_platform "ruby" + bundle :install + end + + it "keeps java dependencies in the lockfile" do + should_be_installed "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY" + expect(lockfile).to eq strip_whitespace(<<-L) + PATH + remote: . + specs: + foo (1.0) + + GEM + remote: file:#{gem_repo2}/ + specs: + indirect_platform_specific (1.0) + platform_specific + platform_specific (1.0) + platform_specific (1.0-java) + + PLATFORMS + java + ruby + + DEPENDENCIES + foo! + indirect_platform_specific + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + end + end end end |