These are chat archives for opal/opal

3rd
Oct 2018
Elia Schito
@elia
Oct 03 2018 06:03
@fkchang yeah, me too, but I think he’ll still be there if you need to ask a couple of questions
Hadasa Vengrover
@HadasaGett
Oct 03 2018 10:56

Hi
I'm using opal (V 0.11.3) for converting the ruby code.
I want to convert also the Rspec to be run on the converted js file.

I try to run rspec with rake
using the factory_girl gem.
But I get an error:

An error occurred while loading spec_helper.
Failure/Error: require 'opal-factory_girl'

NameError:
uninitialized constant Opal::Processor

What is the problem?
the gem 'opal-sprockets' already in the GemFile.

Thank

Elia Schito
@elia
Oct 03 2018 11:10
@HadasaGett can you paste here the full output of the error and the code you think generated the error?
Hadasa Vengrover
@HadasaGett
Oct 03 2018 12:16

@elia
Full error:

An error occurred while loading spec_helper.
Failure/Error: require 'opal-factory_girl'

NameError:
uninitialized constant Opal::Processor
Did you mean? Process

/Users/hadasav/.rvm/gems/ruby-2.4.2/gems/opal-factory_girl-4.5.0.3/lib/opal-factory_girl.rb:9:in `block in <top (required)>'

/Users/hadasav/.rvm/gems/ruby-2.4.2/gems/opal-factory_girl-4.5.0.3/lib/opal-factory_girl.rb:9:in `each'

/Users/hadasav/.rvm/gems/ruby-2.4.2/gems/opal-factory_girl-4.5.0.3/lib/opal-factory_girl.rb:9:in `<top (required)>'

./spec/spec_helper.rb:28:in `require'

./spec/spec_helper.rb:28:in `<top (required)>'


spec_helper.rb code that related to Opal:

require 'opal'
require 'opal-factory_girl'
require 'opal-sprockets'

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end

Elia Schito
@elia
Oct 03 2018 12:24
@HadasaGett I think the main problem is that the opal-factory_girl gem has been developed for opal 0.9 https://rubygems.org/gems/opal-factory_girl and it doesn't work with 0.11
Hadasa Vengrover
@HadasaGett
Oct 03 2018 12:40

@elia So if I use factory_girl in the Rspec what do I need to do?
Because If I don't use the 'opal-factory_girl' gem I get this error while running rake:

Running phantomjs /Users/hadasav/.rvm/gems/ruby-2.4.2/gems/opal-rspec-0.6.1/vendor/spec_runner.js "http://localhost:9999/"
Sprockets::FileNotFound: couldn't find file 'factory_girl' with type 'application/javascript'
Checked in these paths: ....

Elia Schito
@elia
Oct 03 2018 12:42
@HadasaGett I don't think there's an updated version of opal-factory_girl that you can use now, my advice is to contribute to the existing gem and update the code to be compatible with opal 0.11
Hadasa Vengrover
@HadasaGett
Oct 03 2018 12:52
@elia so currently there is no way to convert Rspec to JS or testing the JS file that Opal created?
Elia Schito
@elia
Oct 03 2018 13:03
@HadasaGett not if you need factory_girl
Hadasa Vengrover
@HadasaGett
Oct 03 2018 13:14
@elia Thank you!
Elia Schito
@elia
Oct 03 2018 13:21
👍
Mitch VanDuyn
@catmando
Oct 03 2018 13:50
@HadasaGett this may not be helpful, but if you are using rails at the backend you can use hyperstack's hyper-spec. Runs your client side specs from with server side rspec.