Sha256: f79c4be5a66d5b3b848e0b3c70ed93700a4e0ee5e1297aba8b5c1141cf531201

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "rvm:create_gemset task" do
  include_context "Capistrano::Configuration"

  before {
    @gemset = 'mygemset'
    @configuration.set :rvm_ruby_string, '2.0.0@' + @gemset
    @task = @configuration.find_task 'rvm:create_gemset'
  }

  it "should create a gemset in $HOME" do
    @configuration.trigger :load
    expected = "$HOME/.rvm/bin/rvm 2.0.0 do rvm gemset create #{@gemset}"
    @task.namespace.should_receive(:run_without_rvm).with(expected)
    @configuration.execute_task @task
  end

  it "should create a system-wide gemset" do
    @configuration.set :rvm_type, :system
    @configuration.trigger :load
    expected = <<-EOSHELL.gsub(/^      /, '')
      if id | grep ' groups=.*(rvm)' >/dev/null ;
      then /usr/local/rvm/bin/rvm 2.0.0 do rvm gemset create #{@gemset} ;
      else sudo -p 'sudo password: '  sg rvm -c '/usr/local/rvm/bin/rvm 2.0.0 do rvm gemset create #{@gemset}' ;
      fi
    EOSHELL
    @task.namespace.should_receive(:run_without_rvm).with(expected)
    @configuration.execute_task @task
  end

  it "should create a gemset in $HOME in mixed mode" do
    @configuration.set :rvm_ruby_string, '2.0.0@' + @gemset
    @configuration.set :rvm_type, :mixed
    @configuration.set :rvm_user, [ :gemsets ]
    @configuration.trigger :load
    task = @configuration.find_task 'rvm:create_gemset'
    expected = \
      "/usr/local/rvm/bin/rvm 2.0.0 do rvm user gemsets ; " +
      "/usr/local/rvm/bin/rvm 2.0.0 do rvm gemset create #{@gemset}"
    task.namespace.should_receive(:run_without_rvm).with(expected)
    @configuration.execute_task task
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rvm-capistrano-1.5.5 spec/create_gemset_spec.rb
rvm-capistrano-1.5.4 spec/create_gemset_spec.rb
rvm-capistrano-1.5.3 spec/create_gemset_spec.rb
rvm-capistrano-1.5.2 spec/create_gemset_spec.rb
rvm-capistrano-1.5.1 spec/create_gemset_spec.rb
rvm-capistrano-1.5.0 spec/create_gemset_spec.rb
rvm-capistrano-1.5.0.rc1 spec/create_gemset_spec.rb