GithubHelp home page GithubHelp logo

Comments (5)

wied03 avatar wied03 commented on August 17, 2024

Are you using the Rake task? Did you call Opal.use_gem from the Rakefile?
It sounds like a load path issue. I use jquery in my tests all the time.

from opal-rspec.

wied03 avatar wied03 commented on August 17, 2024

If you're using Rails but not using opal-rails, then you'd do something like this (I have 2 spec directories, thus the shared reference):

Opal::RSpec::RakeTask.new('opal:spec' => :environment) do |server, task|
  app = Rails.application
  task.files = FileList[
      app.root.join('spec/javascripts/**/*_spec{,.js}.{rb,opal}'),
      app.root.join('spec/shared/**/*_spec{,.js}.{rb,opal}')
  ]
  task.default_path = 'spec/javascripts'
  app.assets.paths.each { |p| server.append_path p }
  %w(spec/javascripts spec/shared).each { |p| server.append_path p }
end

The only magic here is the app.assets line, which takes the Rails sprockets load paths (already populated via Bundle.require to force each GEM to add itself to the load path and my opal.rb initializer, which adds the Opal load paths to sprockets/Rails).

I'm not sure what the latest is with opal-rails since I've been working on other stuff.

from opal-rspec.

catmando avatar catmando commented on August 17, 2024

thanks - I did not try your suggestion, instead I ended up doing this:

# in reactive-ruby.rb 
...
Opal.append_path File.expand_path('../sources/', __FILE__).untaint

Once I did this everything got better

from opal-rspec.

wied03 avatar wied03 commented on August 17, 2024

Hopefully this clarifies a little - 7e9a7ab

from opal-rspec.

catmando avatar catmando commented on August 17, 2024

thanks

from opal-rspec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.