Rake spec with Spork on Windows 7

I managed to set up spork on Windows 7. The spork server is running in a command window. I'm using Rubymine 3.1 and Ruby 1.9.2.

Running autotest, rspec spec/ and rake spec from the command line runs fine and performs all tests correctly. Running rake spec from within the RubyMine environment always results in:


C:\Ruby192\bin\ruby.exe C:\Ruby192\bin\rake spec
Testing started at 6:51 PM ...
(in C:/Users/Moshik/Documents/RubyProjects/sample_app)
Empty test suite.

Process finished with exit code 0


and

"No tests were found"


Any ideas?

0
15 comments

Spork server should be launched using "RubyMine | Tools | Run Spork Server...". RubyMine loads server attached to RubyMine test runner UI. Otherwise you will get ordinary console output results.

0
Avatar
Permanently deleted user

That make a sense, the only problem is that I can't run the spork server from within RubyMine - that option is grayed out.

0

Is "spork" gem attached in "RubyMine | File | Settings | Ruby SDK and Gems Manager" ?

0
Avatar
Permanently deleted user

Removing milhouse-spork and installing spork 0.8.4 does make the "run spork drb server" available.

After some small fixes the server now runs properly within Rubymine - see below:

C:\Ruby192\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby192\bin\spork rspec
Using RSpec
  -- Rinda Ring Server listening for connections...

  -- Starting to fill pool...
     Wait until at least one slave is provided before running tests...
  ** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
   -- build slave 1...
Loading Spork.prefork block...
   -- build slave 2...
Loading Spork.prefork block...


Running  "rake spec" returns the following:

C:\Ruby192\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby192\bin\rake spec
Testing started at 5:56 PM ...
(in C:/Users/Moshik/Documents/RubyProjects/sample_app)
Empty test suite.

Process finished with exit code 0


As before, running spork and rake spec from the command line works fine. The problems is only within RubyMine 3.1.
0
Avatar
Permanently deleted user

I upgraded to the latest spork version 0.9.0.rc4, and ran rake with the "spec:controllers" option. now, at least I can get the tests to somehow run. As you can see below, the "Empty test suite." message still comes up. Any idea what's going on?

C:\Ruby192\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby192\bin\rake spec:controllers
Testing started at 6:38 PM ...
(in C:/Users/Moshik/Documents/RubyProjects/sample_app)
C:/Ruby192/bin/ruby.exe -S bundle exec rspec ./spec/controllers/pages_controller_spec.rb
You must use ANSICON 1.31 or later (http://adoxa.110mb.com/ansicon/) to use colour on Windows
Empty test suite.
6 examples, 0 failures, 6 passed
Finished in 7.610435 seconds
  <-- Slave(1) run done!

Process finished with exit code 0

0
Avatar
Permanently deleted user

Same config (RM 3.1, Win 7x64, latest gem Spork) and same problem here. Sometimes, rerunning the test works but not always.

Here is the message from Spork console when it doesn't find any tests:

Running tests with args ["--color", "--format", "Spec::Runner::Formatter::TeamcityFormatter", "--require", "teamcity/spec/runner/formatter/teamcity/formatter", "D:/dev/rails/railsapp/spec/models/draw_spec.rb"]...
- NO tuple
Done.

Edit:
When stopping Spork server within RM 3.1, three ruby.exe processes remains according to the task manager while a Ctrl + B in a console really kills all ruby slave processes. Don't know if it's a related problem though

0
Avatar
Permanently deleted user

I had the same issue and was able to debug it by starting the drb-server from rubymine and running cucumber --drb from command window. For some reason running from command window provided different output. In my case my features/support/env.rb file stated

ENV["RAILS_ENV"] ||= "cucumber"

and I didn't have proper configuration file for "cucumber" environment in /config/environments/. So I changed it to

ENV["RAILS_ENV"] ||= "test"

And the tests started to run properly.

Nevertheless it is a bit alarming that cucumber output is so much different in console and rubymine. Could it be a related issue that my installation of ANSICON is working properly in the command window, but it is not recognized in rubymine console?

0
Avatar
Permanently deleted user

ok I must take that back. Not everything works as it should:

The tests are run and I get a report in the console:

C:\Ruby\Ruby192\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) E:/workspace/RubyMine_ws/supersalonki/script/cucumber E:/workspace/RubyMine_ws/supersalonki/features --format Teamcity::Cucumber::Formatter --expand --drb --color
Testing started at 21:16 ...
*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows
Using the default profile...
Disabling profiles...
16 scenarios (16 passed)
86 steps (86 passed)
0m12.851s
  <-- Slave(1) run done!
Empty test suite.

Process finished with exit code 1


But cucumber.log - panel in rubymine is empty and the treeview of tests is also empty (even though i disable "hide passed"-toggle). So basically running the drb-server and the tests in Rubymine doesn't provide proper output.

0
Avatar
Permanently deleted user

I believe the No Tuple message is related to this bug: https://github.com/timcharper/spork/issues/#issue/58

0

We will try to reproduce. Please describe your environment:

1. ruby 1.9
2. rspec version -?
3. spork 0.9.0.rc4
4. rails version -?
5. rspec rails -?

As for cucumber - it is a know problem and a bug in cucumber which doesn't allow RubyMine to plug-in our custom results reporter through RubyMine UI.
"No tests found" means that RubyMine tests results reporter failed to attach to test framework or didn't send any test start/finished events.

0
Avatar
Permanently deleted user

Thank you. Here are the versions:

  • ruby 1.9.2-p136
  • rspec 2.5.0
  • rails 3.0.4
  • spork 0.9.0-rc4
  • rspec-rails 2.5.0


If needed we can set up a time to connect remotely to my machine.

0
Avatar
Permanently deleted user

Same config as Moshik except rails 3.0.5

0
Avatar
Permanently deleted user

ruby 1.9.2p0
rspec 2.5.0
spork 0.9.0.rc4
rails 3.0.0
rspec rails 2.5.0

0
Avatar
Permanently deleted user

The problem was that "RAILS_ENV" was set to "test" ("RAILS_ENV=test"). When removed all tests run fine within RubyMine.

Note that spork 0.9.0rc4 still has an issue unrelated to RubyMine causing it to run out of slaves after 3 minutes. The fix here works: https://github.com/timcharper/spork/issues/#issue/58

0
Avatar
Permanently deleted user

Thanks Tuomas, it fixed the no tuple problem.

I still have the Ruby processes not killed when using RM while a Ctrl + B in a console  really kills all ruby slave processes.

When stopping Spork server within RM 3.1, three ruby.exe processes  remains according to the task manager and I get this error message

      C:/Ruby192/lib/ruby/1.9.1/rinda/ring.rb:35:in `bind': Une seule utilisation de chaque adresse de socket (protocole/adresse r�seau/port) est habituellement autoris�e. - bind(2) (Errno::EADDRINUSE)
    from C:/Ruby192/lib/ruby/1.9.1/rinda/ring.rb:35:in `initialize'
    from ring_server.rb:7:in `new'
    from ring_server.rb:7:in `<main>'


Steps to reproduce:
Start Spork server (with rspec)
stop it
rerun Spork

0

Please sign in to leave a comment.