diff options
author | Ngan Pham <ngan@users.noreply.github.com> | 2023-08-12 19:16:20 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-17 16:07:54 +0000 |
commit | 75a4767525407755a33d3b140312c00f2cababd6 (patch) | |
tree | 967cd62a92a2d7f1c4b16300ca61bccb80da0ab0 /spec | |
parent | 30a5b94517699589f6943163cd6b92f2f6c0023f (diff) | |
download | ruby-75a4767525407755a33d3b140312c00f2cababd6.tar.gz |
[rubygems/rubygems] Add `file` option to `ruby` method in Gemfile
https://github.com/rubygems/rubygems/commit/fb9354b7bf
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/bundler/ruby_dsl_spec.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/bundler/bundler/ruby_dsl_spec.rb b/spec/bundler/bundler/ruby_dsl_spec.rb index bc1ca98457..0ba55e949f 100644 --- a/spec/bundler/bundler/ruby_dsl_spec.rb +++ b/spec/bundler/bundler/ruby_dsl_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Bundler::RubyDsl do let(:dsl) { MockDSL.new } let(:ruby_version) { "2.0.0" } + let(:ruby_version_arg) { ruby_version } let(:version) { "2.0.0" } let(:engine) { "jruby" } let(:engine_version) { "9000" } @@ -23,7 +24,10 @@ RSpec.describe Bundler::RubyDsl do let(:invoke) do proc do - args = Array(ruby_version) + [options] + args = [] + args << Array(ruby_version_arg) if ruby_version_arg + args << options + dsl.ruby(*args) end end @@ -91,5 +95,26 @@ RSpec.describe Bundler::RubyDsl do it_behaves_like "it stores the ruby version" end end + + context "with a file option" do + let(:options) { { :file => "foo" } } + let(:version) { "3.2.2" } + let(:ruby_version) { "3.2.2" } + let(:ruby_version_arg) { nil } + let(:engine_version) { version } + let(:patchlevel) { nil } + let(:engine) { "ruby" } + before { allow(Bundler).to receive(:read_file).with("foo").and_return("#{version}\n") } + + it_behaves_like "it stores the ruby version" + + context "and a version" do + let(:ruby_version_arg) { "2.0.0" } + + it "raises an error" do + expect { subject }.to raise_error(Bundler::GemfileError, "Cannot specify version when using the file option") + end + end + end end end |