Sha256: bfc1815ce3147278dcb7329f5566538e5f0bf1c8964426048036f25dde9c4a12

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

require "spec_helper"

describe Stairs::EnvAdapters::RVM do
  subject { described_class.new }

  describe ".present?" do
    before { described_class.should_receive(:`).with("which rvm") }

    context "when rvm is installed" do
      before { $?.stub success?: true }

      it "returns true" do
        expect(described_class.present?).to be_true
      end
    end

    context "when rvm is not installed" do
      before { $?.stub success?: false }

      it "returns true" do
        expect(described_class.present?).to be_false
      end
    end
  end

  describe "#set" do
    it "delegates to the well tested FileMutation util" do
      name = "VAR_NAME"
      value = "the_value"

      Stairs::Util::FileMutation.should_receive(:replace_or_append).with(
        Regexp.new("^export #{name}=(.*)$"),
        "export #{name}=#{value}",
        ".rvmrc",
      )

      subject.set(name, value)
    end
  end

  describe "#unset" do
    it "delegates to the well tested FileMutation util" do
      Stairs::Util::FileMutation.should_receive(:remove).with(
        Regexp.new("^export SOMETHING=(.*)\n"),
        ".rvmrc",
      )
      subject.unset "SOMETHING"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stairs-0.9.0 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.8.0 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.7.1 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.7.0 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.6.1 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.6.0 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.5.1 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.5.0 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.4.2 spec/lib/stairs/env_adapters/rvm_spec.rb
stairs-0.4.1 spec/lib/stairs/env_adapters/rvm_spec.rb