summaryrefslogtreecommitdiff
path: root/spec/bundler/ruby_version_spec.rb
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-01-12 00:06:01 -0500
committerJames Wen <jrw2175@columbia.edu>2016-01-14 00:28:06 -0500
commite3d852f59fd16f682d858a7f596bd4e484308f70 (patch)
tree4c8ee29784ab36d25841adf909f21e7e5ba6081e /spec/bundler/ruby_version_spec.rb
parent0774ae07341c3f49381a56494b15397eb2acdcd0 (diff)
downloadbundler-e3d852f59fd16f682d858a7f596bd4e484308f70.tar.gz
Remove `Bundler::SystemRubyVersion`
- `Bundler::SystemRubyVersion` can easily be replaced by an instance of `Bundler::RubyVersion` that is constructed with the proper params
Diffstat (limited to 'spec/bundler/ruby_version_spec.rb')
-rw-r--r--spec/bundler/ruby_version_spec.rb122
1 files changed, 0 insertions, 122 deletions
diff --git a/spec/bundler/ruby_version_spec.rb b/spec/bundler/ruby_version_spec.rb
index e0df4c56c0..ee53ccdd45 100644
--- a/spec/bundler/ruby_version_spec.rb
+++ b/spec/bundler/ruby_version_spec.rb
@@ -242,126 +242,4 @@ describe "Bundler::RubyVersion and its subclasses" do
end
end
end
-
- describe Bundler::SystemRubyVersion do
- subject { Bundler::SystemRubyVersion.new(version, patchlevel, engine, engine_version) }
-
- let(:system_ruby_version) { subject }
-
- describe "#initialize" do
- # Suppress "warning: instance variable @variable not initialized" warnings
- before do
- @verbose = $VERBOSE
- $VERBOSE = nil
- end
-
- after { $VERBOSE = @verbose }
-
- it "should not set any of the instance attributes" do
- expect(system_ruby_version.instance_variable_get(:@version)).to be_nil
- expect(system_ruby_version.instance_variable_get(:@patchlevel)).to be_nil
- expect(system_ruby_version.instance_variable_get(:@engine)).to be_nil
- expect(system_ruby_version.instance_variable_get(:@engine_version)).to be_nil
- end
- end
-
- describe "#version" do
- it "should return a copy of the value of RUBY_VERSION" do
- expect(subject.version).to eq(RUBY_VERSION)
- expect(subject.version).to_not be(RUBY_VERSION)
- end
- end
-
- describe "#gem_version" do
- before do
- @current_ruby_version = RUBY_VERSION
- gem_version_double = double(:gem_version)
- allow(Gem::Version).to receive(:new).with(RUBY_VERSION).and_return(gem_version_double)
- end
-
- it "should return a Gem::Version instance with the correct version" do
- gem_version = Gem::Version.new(RUBY_VERSION)
- expect(system_ruby_version.gem_version).to eq(gem_version)
- end
-
- it "memoizes the Gem::Version instance" do
- expect(Gem::Version).to receive(:new).with(@current_ruby_version).once.and_call_original
- 2.times { system_ruby_version.gem_version }
- end
- end
-
- describe "#engine" do
- context "RUBY_ENGINE is defined" do
- before { stub_const("RUBY_ENGINE", "2.2.4") }
-
- it "should return a copy of the value of RUBY_ENGINE" do
- expect(subject.engine).to eq("2.2.4")
- expect(subject.engine).to_not be(RUBY_ENGINE)
- end
- end
-
- context "RUBY_ENGINE is not defined" do
- before { stub_const("RUBY_ENGINE", nil) }
-
- it "should return the string 'ruby'" do
- expect(subject.engine).to eq("ruby")
- end
- end
- end
-
- describe "#engine_version" do
- context "engine is ruby" do
- before do
- allow(system_ruby_version).to receive(:engine).and_return("ruby")
- stub_const("RUBY_VERSION", "2.2.4")
- end
-
- it "should return a copy of the value of RUBY_VERSION" do
- expect(system_ruby_version.engine_version).to eq("2.2.4")
- expect(system_ruby_version.engine_version).to_not be(RUBY_VERSION)
- end
- end
-
- context "engine is rbx" do
- before do
- allow(system_ruby_version).to receive(:engine).and_return("rbx")
- stub_const("Rubinius::VERSION", "2.0.0")
- end
-
- it "should return a copy of the value of Rubinius::VERSION" do
- expect(system_ruby_version.engine_version).to eq("2.0.0")
- expect(system_ruby_version.engine_version).to_not be(Rubinius::VERSION)
- end
- end
-
- context "engine is jruby" do
- before do
- allow(system_ruby_version).to receive(:engine).and_return("jruby")
- stub_const("JRUBY_VERSION", "2.1.1")
- end
-
- it "should return a copy of the value of JRUBY_VERSION" do
- expect(system_ruby_version.engine_version).to eq("2.1.1")
- expect(system_ruby_version.engine_version).to_not be(JRUBY_VERSION)
- end
- end
-
- context "engine is some other ruby engine" do
- before do
- allow(system_ruby_version).to receive(:engine).and_return("not_supported_ruby_engine")
- stub_const("RUBY_ENGINE", "not_supported_ruby_engine")
- end
-
- it "should raise a BundlerError with a 'not recognized' message" do
- expect { system_ruby_version.engine_version }.to raise_error(Bundler::BundlerError, "RUBY_ENGINE value not_supported_ruby_engine is not recognized")
- end
- end
- end
-
- describe "#patchlevel" do
- it "should return a string with the value of RUBY_PATCHLEVEL" do
- expect(subject.patchlevel).to eq(RUBY_PATCHLEVEL.to_s)
- end
- end
- end
end