Sha256: 795584f8d0127e451b17c3b9a718b7873718ffa89957585f3cc34e25b32da0f7

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'aruba/config'
require 'aruba/api'
include Aruba::Api

describe "Aruba JRuby Startup Helper"  do
  before(:all) do
    @fake_env = ENV.clone
  end
  before(:each) do
    Aruba.config = Aruba::Config.new
    @fake_env['JRUBY_OPTS'] = "--1.9"
    @fake_env['JAVA_OPTS'] = "-Xdebug"
  end

  it 'configuration does not load when RUBY_PLATFORM is not java' do
    with_constants :ENV => @fake_env, :RUBY_PLATFORM => 'x86_64-chocolate' do
      load 'aruba/jruby.rb'
      Aruba.config.hooks.execute :before_cmd, self
      expect(ENV['JRUBY_OPTS']).to eq "--1.9"
      expect(ENV['JAVA_OPTS']).to eq "-Xdebug"
    end
  end

  it 'configuration loads for java and merges existing environment variables' do
    with_constants :ENV => @fake_env, :RUBY_PLATFORM => 'java'  do
      RbConfig::CONFIG.stub(:[] => 'solaris')
      load 'aruba/jruby.rb'
      Aruba.config.hooks.execute :before_cmd, self
      expect(ENV['JRUBY_OPTS']).to eq "-X-C --1.9"
      expect(ENV['JAVA_OPTS']).to eq "-d32 -Xdebug"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aruba-0.5.4 spec/aruba/jruby_spec.rb