Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeus (0.13.3) doesn't work with Test::Unit?!? #226

Open
gamov opened this issue Dec 27, 2012 · 18 comments
Open

Zeus (0.13.3) doesn't work with Test::Unit?!? #226

gamov opened this issue Dec 27, 2012 · 18 comments

Comments

@gamov
Copy link

@gamov gamov commented Dec 27, 2012

Hello,
I love the promises of this project, specially for testing purposes. Unfortunately, I don't use spec (vanilla rails test/unit instead) and it looks like that's the only way Zeus will run test currently, is it correct?

[rvm:ruby-1.9.3-p327@ector] GamovMBP:ector gamov$ zeus test
/Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/activesupport-3.0.17/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `match' for nil:NilClass (NoMethodError)
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/zeus-0.13.2/lib/zeus/rails.rb:210:in `spec_file?'
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/zeus-0.13.2/lib/zeus/rails.rb:185:in `test'
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/zeus-0.13.2/lib/zeus.rb:105:in `block in command'

I tried to tickle with the zeus.json without success.

@rosenfeld
Copy link

@rosenfeld rosenfeld commented Dec 27, 2012

Try zeus test test. I have the same issue and I use RSpec instead of Test::Unit. In my case I have to type zeus test spec (or zeus rspec spec). You have to pass-in the directory or file you want to test. That is the same behavior for the Spork gem. I never bothered trying to understand why this is needed as long as it works for me ;) But I confess I'm curious about it :)

@dwbutler
Copy link

@dwbutler dwbutler commented Dec 27, 2012

👍 This is pretty confusing. I expected zeus rspec to simply run rspec against the spec folder, and zeus rake to run the default rake task.

@rosenfeld
Copy link

@rosenfeld rosenfeld commented Dec 27, 2012

This is insteresting, but zeus rake will run my specs but lots of them will fail with things like uninitialized constant FactoryGirl, Failed to connect to a master node at mongodb:27018 among others... But zeus rspec spec works! Go figure it out...

@gamov
Copy link
Author

@gamov gamov commented Dec 28, 2012

mmmm, @rosenfeld I tried zeus test test, now zeus is trying to use minitest instead of test::unit:

/Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/activesupport-3.0.17/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `>' for nil:NilClass (NoMethodError)
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/minitest-2.12.1/lib/minitest/unit.rb:965:in `_run'
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/minitest-2.12.1/lib/minitest/unit.rb:949:in `run'
    from /Users/gamov/.rvm/gems/ruby-1.9.3-p327@ector/gems/zeus-0.13.2/lib/zeus/m.rb:203:in `execute'

It looks like zeus really hates test::unit ! :)

@rosenfeld
Copy link

@rosenfeld rosenfeld commented Dec 28, 2012

@gamov I've just created a fresh Rails app to give it a try:

rails new zeustest; cd zeustest; rails g scaffold book; rake db:migrate; gem install zeus
rake # tests run successfully
zeus start
zeus rake # tests run successfully as well
zeus test # doesn't work
zeus test test # doesn't work either
zeus test test/functional # worked this time

But for some reason I experienced some broken pipe errors sometimes. I'm testing this from my wife's notebook, which was installed with Debian 32bits long ago and I didn't bothered to reinstall using amd64 yet, so I'm not sure if the broken pipe issue is related to the different arch or to the Test::Unit tests...

@rosenfeld
Copy link

@rosenfeld rosenfeld commented Dec 28, 2012

Interesting... I've just tried with a similar app than above, but using RSpec instead of Test::Unit. For this app (differently from my actual app) zeus rake actually work and all tests pass. On the other hand weird things happen if I run with zeus test spec. All specs will pass but then the specs are re-run and this time all of them fail... Go figure it out... My specs don't run twice in my actual application but I'm not using latest RSpec in my actual app either. Also, I don't use AR, but Sequel in my actual app, so I'm not sure if that changes anything with regards to my specs and Zeus behavior...

@rosenfeld
Copy link

@rosenfeld rosenfeld commented Dec 28, 2012

It stopped running the second time with RSpec when I removed the 'rspec/autorun' require as suggested in #180.

@amree
Copy link

@amree amree commented Dec 31, 2012

I'm using:

  • Rails 3.2.9
  • zeus 0.13.2

Seems to be not working for me:

$ zeus rake
zeus test "test/unit/**/*_test.rb"
Run options: --seed 9268

# Running tests:

............................................................................

Finished tests in 1.953454s, 38.9054 tests/s, 40.9531 assertions/s.

76 tests, 80 assertions, 0 failures, 0 errors, 0 skips
zeus test "test/functional/**/*_test.rb"
Run options: --seed 63416

# Running tests:

.........................................................

Finished tests in 3.236595s, 17.6111 tests/s, 31.5146 assertions/s.

57 tests, 102 assertions, 0 failures, 0 errors, 0 skips
zeus test "test/integration/**/*_test.rb"
Couldn't find test file 'test/integration/**/*_test.rb'!
$ zeus test test
Run options: --seed 27737

# Running tests:

.....................................................................................................................................

Finished tests in 4.359570s, 30.5076 tests/s, 41.7472 assertions/s.

133 tests, 182 assertions, 0 failures, 0 errors, 0 skips
$ zeus test
/Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus/rails.rb:210:in `spec_file?': undefined method `match' for nil:NilClass (NoMethodError)
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus/rails.rb:185:in `test'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:105:in `block in command'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:92:in `fork'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:92:in `command'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:69:in `block (3 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:69:in `fork'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:69:in `block (2 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `each'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `block in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `loop'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (3 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `fork'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (2 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `each'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `block in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `loop'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (3 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `fork'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (2 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `each'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `block in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `loop'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (3 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `fork'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:67:in `block (2 levels) in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `each'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:63:in `block in go'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `loop'
    from /Users/amree/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zeus-0.13.2/lib/zeus.rb:61:in `go'
    from -e:1:in `<main>'

@Emerson
Copy link

@Emerson Emerson commented Jan 16, 2013

Just to chime in here - I am also using plain old Test::Unit and having issues with tests failing. Running rake test complains with:

zeus-0.13.2/lib/zeus/rails.rb:210:in `spec_file?': undefined method `match' for nil:NilClass (NoMethodError)`

I'm not using any specs.

Running zeus rake runs my tests, but fails on some of my functionals. A few examples of these failing tests:

test_get_index(Admin::CompaniesControllerTest):
NoMethodError: undefined method `request=' for #<Admin::CompaniesController:0x007fd72731fc58>
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/actionpack-3.2.11/lib/action_controller/test_case.rb:490:in `setup_controller_request_and_response'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__3268524071855835964__setup__3932835591712007662__callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:35:in `run'


test_ban(Admin::UsersControllerTest):
NoMethodError: undefined method `before_filter' for Admin::UsersController:Class
    /Users/Emerson/Rails/omx/app/controllers/admin/users_controller.rb:2:in `<class:UsersController>'
    /Users/Emerson/Rails/omx/app/controllers/admin/users_controller.rb:1:in `<top (required)>'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:359:in `require_or_load'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:502:in `load_missing_constant'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:192:in `block in const_missing'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `each'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `const_missing'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:230:in `block in constantize'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `each'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `constantize'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:260:in `safe_constantize'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb:66:in `safe_constantize'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/actionpack-3.2.11/lib/action_controller/test_case.rb:379:in `determine_default_controller_class'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/actionpack-3.2.11/lib/action_controller/test_case.rb:374:in `controller_class'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/actionpack-3.2.11/lib/action_controller/test_case.rb:483:in `setup_controller_request_and_response'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__690472650567597172__setup__3932835591712007662__callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/Emerson/.rvm/gems/ruby-1.9.3-p362@omx/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:35:in `run'

@turadg
Copy link
Collaborator

@turadg turadg commented Feb 6, 2013

Can someone having this problem confirm that @airpollak's patch fixes it? I'd like to merge but I don't use Test/Unit and the Zeus specs are broken.

@Emerson
Copy link

@Emerson Emerson commented Feb 6, 2013

Tried to test this out by installing zeus again on a current project, but I've been unable to get things working (just the standard zeus gem, not this particular patch). Maybe someone else will have better luck?

@gamov
Copy link
Author

@gamov gamov commented Apr 5, 2013

Tried zeus 0.13.3 with same error (zeus test test) :o(

@i8ramin
Copy link

@i8ramin i8ramin commented May 9, 2013

FYI, running zeus rspec spec worked for me.

@pencilcheck
Copy link

@pencilcheck pencilcheck commented Jun 5, 2013

same, zeus rspec spec worked

@gamov
Copy link
Author

@gamov gamov commented Jun 12, 2013

still no no for me (unit:test) but I've switched to minitest and everything works fine.

@pawlik
Copy link

@pawlik pawlik commented Oct 7, 2013

@gamov did you have to define assert_false for MiniTest::Assertions? I have problem with this after switching to minitest. And it seems like a strange issue... mayme I'm loading in in a wrong order? Could you provide test_helper.rb wich is working for you?

@gamov
Copy link
Author

@gamov gamov commented Oct 8, 2013

@pawlik Note that I load minitest via reporters so RubyMine can embed tests. Note that it works with Zeus outside RubyMine too.
I remember that order in the Gemfile is important indeed. I only have " gem 'minitest-reporters'" defined.
No, I didn't have to define anything.

My test_helper is quite vanilla:

##Activate minitest for Rubymine
require 'minitest/reporters' #requires minitest
MiniTest::Reporters.use!


ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

#begin
#  require 'turn/autorun';
#  Turn.config.format = :outline
#rescue LoadError; end

class ActiveSupport::TestCase
   fixtures :all
    ...
end
@pawlik
Copy link

@pawlik pawlik commented Oct 9, 2013

@gamov thank you. I have also shoulda and mocha required in that test and I have a feeling that one of those is in a wrong place. But can't figure out which one. But just reimplementing assert_false did the trick for me (I'll add it for anyone having same problem)

module MiniTest::Assertions
  include ActiveSupport::Deprecation
  alias_method :assert_false, :refute
  deprecate :assert_false => 'monkeypatch to use Mintest suite, use refute instead of assert_false'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

9 participants
You can’t perform that action at this time.