grosser / autotest

Save a file, autotest will run the matching tests! (Autotest without ZenTest)
121 stars 20 forks source link

autotest couldn't see the rspec2 #6

Closed petRUShka closed 14 years ago

petRUShka commented 14 years ago

I can't force autotest to use rspec2 tests instead of test/unit.

# autotest
loading autotest/cucumber_rails
style: CucumberRails
/usr/bin/ruby-svn -I.:lib:test -rubygems -e "['test/unit', 'test/unit/helpers/companies_helper_test.rb', 'test/unit/user_test.rb', 'test/unit/company_test.rb', 'test/functional/companies_controller_test.rb'].each { |f| require f }" | /usr/lib/ruby/gems/svn/gems/autotest-4.2.9/bin/unit_diff -u

But rspec spec/ works fine. And autotest/discover.rb have rspec2 line:

# cat autotest/discover.rb
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

Arch Linux x86_64 ruby 1.9.3dev (2010-05-08 trunk 27674) x86_64-linux Rails 3.0.0.beta.3

# gem-svn list | grep rspec
rspec (2.0.0.beta.8)
rspec-core (2.0.0.beta.8)
rspec-expectations (2.0.0.beta.8)
rspec-mocks (2.0.0.beta.8)
rspec-rails (2.0.0.beta.8)

gem-svn list | grep autotest

autotest (4.2.9) autotest-growl (0.2.4) autotest-rails-pure (4.1.0)

Gemfile:

source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
gem 'devise', '1.1.rc1'
gem 'mysql'
group :test do
gem 'database_cleaner'
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'

gem 'test-unit'

gem 'cucumber', '0.7.2' gem 'cucumber-rails', '0.3.1'#, :git => 'git://github.com/aslakhellesoy/cucumber-rails.git' gem 'capybara'

gem 'autotest'

gem 'autotest-rails-pure' gem 'autotest-growl' gem 'machinist' end

cat /home/petrushka/.autotest

require 'autotest/growl'

cat .autotest

Autotest.add_hook :initialize do |at| at.add_exception 'tmp' at.add_exception 'rerun.txt' at.add_exception 'vendor' at.add_exception '.git' end

grosser commented 14 years ago

did you try to use autospec ?

petRUShka commented 14 years ago

I have no autospec bin. Because autospec was deprecated in rspec2.

grosser commented 14 years ago

can you try to narrow down the problem, e.g. find the most simple setup that does not work (empty rails project with just rspec 2 and one empty spec?)

petRUShka commented 14 years ago

Instead of style: Rspec2

grosser commented 14 years ago

thanks, ill try this setup :)

grosser commented 14 years ago

if i add discover.rb with rails and rspec2 i get:

loading autotest/rails_rspec2
Error loading Autotest style autotest/rails_rspec2 (no such file to load -- autotest/rails_rspec2). Aborting.

But when i just add rspec2 it works with:

loading autotest/rspec2
style: Rspec2
/home/micha/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby -rrubygems /home/micha/.rvm/gems/ree-1.8.7-2010.01/gems/rspec-core-2.0.0.beta.8/bin/rspec /apps/test/rspec2test/spec/xxx_spec.rb
.

Finished in 0.00029 seconds
1 example, 0 failures
petRUShka commented 14 years ago

I try to use this setup: $ cat autotest/discover.rb

Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
And this: $ cat autotest/discover.rb
Autotest.add_discovery { "rspec2" }

Same results. May be trouble with version of ruby? I see that you use REE 1.8.7, but in my setup Ruby: ruby 1.9.3dev (2010-05-08 trunk 27674) x86_64-linux

grosser commented 14 years ago

maybe:

petRUShka commented 14 years ago

I had no autotest-rails installed. And I uninstalled autotest-rails-pure and modified Gemfile:

group :test do
gem 'rspec-rails', '>=2.0.0.beta.8'
gem 'rspec', '>=2.0.0.beta.8'
gem 'autotest'

gem 'autotest-rails-pure'

gem 'autotest-growl' end

But this action had no effect.

$ cat autotest/discover.rb

Autotest.add_discovery { "rspec2" }
raise 'foo'
p 'dasdsadsa'

But it, as i could see, had no effect:

[f/usr/bin/ruby-svn -I.:lib:test -rubygems -e "['test/unit', 'test/unit/test_test.rb', 'test/test_helper.rb'].each { |f| require f }" | /usr/lib/ruby/gems/svn/gems/autotest-4.2.9/bin/unit_diff -u
Loaded suite -e
Started
EEEEEEE
Finished in 0.085949 seconds.
1) Error:
tests(ActionController::TestCase):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
2) Error:
tests(ActionDispatch::IntegrationTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
3) Error:
tests(ActionView::TestCase):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
4) Error:
tests(ActiveRecord::TestCase):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
5) Error:
tests(ActiveSupport::TestCase):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
6) Error:
test_the_truth(TestTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
7) Error:
tests(TestTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: tests: DELETE FROM "tests" WHERE 1=1
7 tests, 0 assertions, 0 failures, 7 errors, 0 skips
Test run options: --seed 40297
Unable to map class ActionController::TestCase to a file
Unable to map class ActionDispatch::IntegrationTest to a file
Unable to map class ActionView::TestCase to a file
Unable to map class ActiveRecord::TestCase to a file
Unable to map class ActiveSupport::TestCase to a file
Unable to map class TestTest to a file
Unable to map class TestTest to a file

grosser commented 14 years ago

ahh got it, its a 1.9 problem, same at me now with 1.9.2, ill try to fix it asap :)

petRUShka commented 14 years ago

That's great! Sometimes I thought that it is only my bug :)

Good luck with your work!

grosser commented 14 years ago

ruby 1.9 has a great new bug feature: the current path is not in the load path... 4.2.10 is for you :)

petRUShka commented 14 years ago

Yahoo!! $ autotest

loading autotest/cucumber_rails_rspec2
style: CucumberRailsRspec2

Thank you! It works!