Skip to content

Instantly share code, notes, and snippets.

@oldfartdeveloper
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oldfartdeveloper/8746819 to your computer and use it in GitHub Desktop.
Save oldfartdeveloper/8746819 to your computer and use it in GitHub Desktop.
Opal can't seem to find Cucumber gem.

I'm trying to spike running Cucumber in Opal; it's not find it, and I don't know why.

Here's my app/application file. The only change is the addition of the last 3 lines:

# when using sprockets/rails, we must include the corelib
require 'opal'

[1, 2, 3].each { |a| puts a }

my_class = Cucumber::Cli::Main
my_cuke = my_class.new(['features/spike.feature'])
my_cuke.execute!

My config.ru file:

require 'bundler'
Bundler.require

run Opal::Server.new { |s|
  # the entry-point (main) to the app
  s.main = 'application'

  # add additional dirs to opal/sprockets load path
  s.append_path 'app'

  # include Cucumber
  s.use_gem 'cucumber'
}

And, finally, my Gemfile:

source 'https://rubygems.org'

gem 'opal', :git => "git://github.com/opal/opal.git"
gem 'opal-jquery', :git => "git://github.com/opal/opal-jquery.git"
gem 'opal-browser', :git => "git://github.com/opal/opal-browser.git"
#gem 'opal-rspec'
gem 'cucumber'

When I run bundle exec rackup and browse localhost:9292 in my Chrome browser, I get

Uncaught NameError: uninitialized constant Object::Cucumber error:6
(anonymous function)                                        error:6
def.$raise                                                  kernel:464
def.$const_missing                                          module:238
Opal.cm                                                     runtime.js?body=1:478
(anonymous function)                                        application:6
(anonymous function)                                        application:8

So, it doesn't seem like it's finding cucumber at all.

Here's my GitHub repository; it's not very big.

Any ideas?

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