Create a gist now

Instantly share code, notes, and snippets.

Embed
Cucumber hooks for culerity + rvm
Before("@culerity,@celerity,@javascript") do |scenario|
unless @env_rvm_jruby
@env_rvm_jruby = {}
require 'yaml'
rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`).values.first
rvm_info['environment'].each do |k, v|
@env_rvm_jruby[k] = v
end
@env_jruby_path = rvm_info['binaries']['ruby'].gsub(%r{^(.*)/ruby$}, '\1')
end
@env_defaults = {}
@env_rvm_jruby.each do |k, v|
@env_defaults[k] = ENV[k]
ENV[k] = v
end
@env_path = ENV['PATH']
ENV['PATH'] = ENV['PATH'] + ":#{@env_jruby_path}"
end
After("@culerity,@celerity,@javascript") do |scenario|
@env_defaults.each do |k, v|
ENV[k] = v
end
ENV["PATH"] = @env_path
end
@pacoguzman

This comment has been minimized.

Show comment
Hide comment
@pacoguzman

pacoguzman Apr 13, 2010

Works great!! Thanks

Works great!! Thanks

@agibralter

This comment has been minimized.

Show comment
Hide comment
@agibralter

agibralter Apr 13, 2010

Glad it was helpful!

Unfortunately I couldn't get Celerity to work with my JS so I ended up switching to selenium anyway :(

Owner

agibralter commented Apr 13, 2010

Glad it was helpful!

Unfortunately I couldn't get Celerity to work with my JS so I ended up switching to selenium anyway :(

@pacoguzman

This comment has been minimized.

Show comment
Hide comment
@pacoguzman

pacoguzman Apr 13, 2010

I've tested culerity as default_driver and works with my JS but the test are slower than using selenium and I've got errors with the GC.

I've tested culerity as default_driver and works with my JS but the test are slower than using selenium and I've got errors with the GC.

@agibralter

This comment has been minimized.

Show comment
Hide comment
@agibralter

agibralter Apr 13, 2010

Hmm yeah I thought a headless browser would be faster... but seems like the selenium_webdriver is pretty snappy for me.

Owner

agibralter commented Apr 13, 2010

Hmm yeah I thought a headless browser would be faster... but seems like the selenium_webdriver is pretty snappy for me.

@pacoguzman

This comment has been minimized.

Show comment
Hide comment
@pacoguzman

pacoguzman Apr 14, 2010

Hi! again :)
I've found an easier solution thats works for me, only symlink jruby-1.4.0 to jruby and everything works without changing anything in the environment of rvm.

Look at this Javswcript testing with cucumber and capybara

Hi! again :)
I've found an easier solution thats works for me, only symlink jruby-1.4.0 to jruby and everything works without changing anything in the environment of rvm.

Look at this Javswcript testing with cucumber and capybara

@david

This comment has been minimized.

Show comment
Hide comment
@david

david Sep 8, 2010

With the latest RVM (1.0), line #5 should be changed to

rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`).values.first

david commented Sep 8, 2010

With the latest RVM (1.0), line #5 should be changed to

rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`).values.first
@agibralter

This comment has been minimized.

Show comment
Hide comment
@agibralter

agibralter Sep 8, 2010

Updated. Thanks, David!

Owner

agibralter commented Sep 8, 2010

Updated. Thanks, David!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment