spec/aruba/jruby_spec.rb in aruba-0.7.4 vs spec/aruba/jruby_spec.rb in aruba-0.8.0.pre
- old
+ new
@@ -1,39 +1,55 @@
require 'spec_helper'
-require 'aruba/config'
require 'aruba/api'
describe "Aruba JRuby Startup Helper" do
before(:all) do
@fake_env = ENV.clone
end
- before(:each) do
- Aruba.config = Aruba::Config.new
+ before :each do
+ Aruba.config.reset
+
+ # Define before_cmd-hook
+ load 'aruba/config/jruby.rb'
+ end
+
+ before(:each) do
@fake_env['JRUBY_OPTS'] = "--1.9"
@fake_env['JAVA_OPTS'] = "-Xdebug"
stub_const('ENV', @fake_env)
end
- it 'configuration does not load when RUBY_PLATFORM is not java' do
- stub_const('RUBY_PLATFORM', 'x86_64-chocolate')
+ context 'when some mri ruby' do
+ before :each do
+ stub_const('RUBY_PLATFORM', 'x86_64-chocolate')
+ end
- 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"
+ before :each do
+ Aruba.config.before :command, self
+ end
+
+ it { expect(ENV['JRUBY_OPTS']).to eq '--1.9' }
+ it { expect(ENV['JAVA_OPTS']).to eq '-Xdebug' }
end
- it 'configuration loads for java and merges existing environment variables' do
- stub_const('RUBY_PLATFORM', 'java')
+ context 'when jruby ruby' do
+ before :each do
+ stub_const('RUBY_PLATFORM', 'java')
+ end
- rb_config = double('rb_config')
- allow(rb_config).to receive(:[]).and_return('solaris')
- stub_const 'RbConfig::CONFIG', rb_config
+ before :each do
+ rb_config = double('rb_config')
+ allow(rb_config).to receive(:[]).and_return('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"
+ stub_const 'RbConfig::CONFIG', rb_config
+ end
+
+ before :each do
+ Aruba.config.before :command, self
+ end
+
+ it { expect(ENV['JRUBY_OPTS']).to eq '-X-C --1.9' }
+ it { expect(ENV['JAVA_OPTS']).to eq '-d32 -Xdebug' }
end
end