Can't debug test cases in ruby mine - ruby-on-rails

I used to debug test cases in ruby mine for my rails test cases. Some time ago I updated my ruby mine and not sure what happened since then, I am not able to debug my test cases.
Attaching the screenshot of the error below:
What can be done here to rectify this?
Here is the same console output in plain text:
Testing started at 12:53 PM ...
bash -c "/Users/someUSER/.rvm/bin/rvm ruby-2.3.1 do /Users/someUSER/.rvm/rubies/ruby-2.3.1/bin/ruby /Users/someUSER/.rvm/gems/ruby-2.3.1#global/gems/ruby-debug-ide-0.7.0.beta6/bin/rdebug-ide --key-value --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 49496 --host 0.0.0.0 --dispatcher-port 49497 -- /Users/someUSER/.rvm/gems/ruby-2.3.1/bin/rspec /Users/someUSER/RubymineProjects/Proj/spec/controllers/site/some_controller_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example \"Site::SomeController Some POST create new data \""
Fast Debugger (ruby-debug-ide 0.7.0.beta6, debase 0.2.2, file filtering is supported) listens on 0.0.0.0:49496
Uncaught exception: cannot load such file -- rspec/core/formatters/fallback_message_formatter
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:132:in `require'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:132:in `setup_default'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:47:in `block in prepare_default'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:228:in `ensure_listeners_ready'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:199:in `notify'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:92:in `message'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb:161:in `notify_non_example_exception'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:2037:in `rescue in load_file_handling_errors'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:2034:in `load_file_handling_errors'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1560:in `block in load_spec_files'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1558:in `each'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1558:in `load_spec_files'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:98:in `setup'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:86:in `run'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:71:in `run'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:45:in `invoke'
/Users/someUSER/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.8.0/exe/rspec:4:in `<top (required)>'
/Users/someUSER/.rvm/gems/ruby-2.3.1/bin/rspec:23:in `load'
/Users/someUSER/.rvm/gems/ruby-2.3.1/bin/rspec:23:in `<top (required)>'
/Users/someUSER/.rvm/gems/ruby-2.3.1#global/gems/ruby-debug-ide-0.7.0.beta6/bin/rdebug-ide:187:in `<main>'
Process finished with exit code 1
Empty test suite.

I think you are having problems to install the debug gem for RubyMine. I had the same issue and after taking a look at JetBrains web page seems like they are working to fix it on RubyMine 2018.3.3. Meantime, a workaround is to install the gems in a console.
Open the terminal inside RubyMine and run:
gem install debase -v 0.2.3.beta3 --no-document
gem install ruby-debug-ide -v 0.7.0.beta7 --no-document

The beta6 version of the ruby-debug-ide gem that you use is older than rspec 3.8. Maybe upgrading ruby-debug-ide to the latest beta7 version helps (or downgrading rspec to a version older than beta6).

Related

Execute tests in RubyMine causes "uninitialized constant Spring::Client::Run::UNIXSocket" on Windows 7

In RubyMine, I try to run tests in debug (equivalent to rails test, but with debug mode in RubyMine). I get this log in RubyMine console:
Testing started at 08:44 ...
C:\Ruby23-x64\bin\ruby.exe C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0.beta4/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 55232 --host 0.0.0.0 --dispatcher-port 55233 -- C:/Users/[ANONYMOUS]/bin/rails test
Fast Debugger (ruby-debug-ide 0.7.0.beta4, debase 0.2.2, file filtering is supported) listens on 0.0.0.0:55232
Uncaught exception: uninitialized constant Spring::Client::Run::UNIXSocket
Did you mean? Socket
IPSocket
UDPSocket
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/run.rb:26:in `connect'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/run.rb:31:in `call'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:24:in `call'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
C:/Users/[ANONYMOUS]/bin/spring:15:in `<top (required)>'
C:/Users/[ANONYMOUS]/bin/rails:3:in `load'
C:/Users/[ANONYMOUS]/bin/rails:3:in `<top (required)>'
Process finished with exit code 0
It seems like RubyMine tries to run against some UNIX configuration, but I couldn't find anything related to this in my files.
I run RubyMine with Ruby 2.3.3, on Windows 7, RubyMine 2018.1.4.
When I run tests without the debug mode, everything is fine.
How could I resolve this problem? Thanks.
You need to uninstall spring as it's not supported on Windows.
From thier README:
Spring makes extensive use of Process.fork, so won't be able to provide a speed up on platforms which don't support forking (Windows, JRuby).
To uninstall:
'Unspring' your bin/ executables:
spring binstub --remove --all
Remove spring from your Gemfile
Recreate your gemlock file by running:
bundle install

How do I run specs for the activeadmin gem

I am trying to run the specs for a local clone of the activeadmin gems current master.
I am using ruby 2.2.2 and have bundled successfully.
When I try to run one of the specs like so:
bundle exec rspec spec/unit/filters/humanized_spec.rb
I am getting the following error:
The git source https://github.com/jruby/activerecord-jdbc-adapter is not yet checked out. Please run `bundle install` before trying to start your application
Coverage report generated for RSpec to /Users/aljoscha/gem/activeadmin/coverage. 0.0 / 0.0 LOC (100.0%) covered.
/Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `require': cannot load such file -- active_record (LoadError)
from /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `<top (required)>'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `require'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `<main>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
which I cannot make sense of.
Especially since activerecord-jdbc-adapter is not even in the Gemfile.
What am I missing?
Try prepending your command with bundle exec:
bundle exec rspec spec/unit/filters/humanized_spec.rb
It looks like you have a local version discrepancy causing issues.
If not, did you follow all of the steps listed on their contributing readme?
If you are still stuck, you may be experiencing an issue with bundler itself. First, try updating bundler then reinstalling gems and attempt to run rspec. If that doesn't work you may need to delete the bundle cache folder and start over.
I'm going to re-answer to emphasize how to test a gem using appraisal as mentioned in CONTIBUTING:
bundle exec appraisal install
bundle exec appraisal rails_50 rspec spec/unit/filters/humanized_spec.rb
Thank you for your interest in Active Admin.

rails not working in ruby on rails [duplicate]

Why am i getting this error?
shibly#mybox:~/blog$ rails server
/home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/shibly/blog/config/application.rb:7:in `<top (required)>'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>
You should run following command to install NodeJS in Ubuntu
sudo apt-get install nodejs
or run this for OSX
brew install nodejs
Uglifier is a JS wrapper and it needs a JS runtime running or JS interpreter. I would choose to install NodeJS.
In the default Rails Gemfile, the line for the gem 'therubyracer' is commented out. If you uncomment it, you'll get that gem and it should work.
From "Getting Started with Rails":
Compiling CoffeeScript and JavaScript asset compression requires you have a JavaScript runtime available on your system, in the absence of a runtime you will see an execjs error during asset compilation. Usually Mac OS X and Windows come with a JavaScript runtime installed. Rails adds the therubyracer gem to the generated Gemfile in a commented line for new apps and you can uncomment if you need it. therubyrhino is the recommended runtime for JRuby users and is added by default to the Gemfile in apps generated under JRuby. You can investigate all the supported runtimes at ExecJS.
There was an error with creating the db.
The problem is that the Node.js tried to install without sudo in the script:
sudo apt-get install nodejs

Windows/Ruby/Rails install --- .cannot load such file -- sqlite3/sqlite3_native windows

Ruby 2.1.3p242 <2014-09-19 revision 47630> [x64-mingw32]
Rails 4.2.0.beta2
I'm running windows 8 on a 64 bit system. I have been using c9 (cloud hosted ubuntu) but want to start using RubyMine IDE on my pc to make everything faster but it's posing some problems.
I've tried pretty much every recommended way including this one:
How do I install sqlite3 for Ruby on Windows?
but I'm still getting the same error message. You help is much appreciated! Please let me know if you have any questions for me.
Full Error message when I run $rails s:
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler.rb:133:in `require'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/config/application.rb:7:in `<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/bin/rails:8:in `require'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/bin/rails:8:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
fortunately, you don't have to switch to ruby 2.0
there is a solution to this issue, after endless trying...
https://github.com/hwding/sqlite3-ruby-win
Steps
Pre
gem uninstall sqlite3 --all
Source
Download the latest sqlite3-ruby, https://github.com/sparklemotion/sqlite3-ruby
unzip the package
Build
run command-line in the extracted dir
make sure you have your C compiler installed and added to PATH
gem install bundler
bundle install
rake native gem
you'll find a dir named 'pkg' generated
Install
enter dir 'pkg'
gem install --local sqlite3-xxx.gem ('xxx' is version code)
Check
irb
require 'sqlite3'
The issue is that binary sqlite3 gem do not include pre-compiled versions for Ruby 2.1.3
This is mentioned in the sqlite3-ruby mailing list here.
In the folder of your project open terminal and execute:
bundle update sqlite3
bundle update nokogiri
I hope i have helped you ;)
EDIT:
i always recommend using linux/mac for ruby, because some gems may get problematic, because of compiling errors with c
always use bundle to manage your gems, it is much easier*,
you can install it by:
gem install bundler
bundle install - will install all the gems in your Gemfile
the last bundler version is not compatible withe ruby bellow 2.3, so use gem install bundler -v 1.16.4
If you have extracted "exe"s and "dll"s from Sqlite download link to Ruby's bin folder and still have this problem. Try this:
bundle update
gem uninstall sqlite3
Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here
Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3
.
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
>
y
gem install sqlite3 --platform=ruby
rails s
This should work.
Read through this link for more explanation if above works for you.

Every Rails command fails epically

I recently ran into a problem and in desperation decided to uninstall and reinstall both Ruby and Rails on my OS X 10.6. I've reinstalled Ruby and gem installed rails. Now, though, I get this error or similar EVERY time I try to run a rails command (even -v):
rails -v
/Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find bcrypt-ruby-3.0.1 in any of the sources (Bundler::GemNotFound)
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p1
25#global/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75:in `<top (required)>'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/Dylan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/Dylan/.rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:9:in `<main>'
ANy ideas on how to fix this?
It seems like you need to install bcrypt-ruby
Maybe try sudo gem install bcrypt-ruby?
Run bundle install then run bundle exec rails -v see if this clears the issue.

Resources