Forum: Ruby on Rails generated plugin test doesn't work

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Raphael B. (Guest)
on 2009-02-03 12:17
(Received via mailing list)

I'm on rails 2.2.2, and generate a new plugin:
./script/generate  plugin mytest

and try to run the generated test but get an error:
 cd vendor/plugins/mytest/
 rake test --trace
(in /tmp/test/vendor/plugins/mytest)
** Invoke test (first_time)
** Execute test
/usr/bin/ruby1.8 -Ilib:lib:test
"/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/mytest_test.rb"
./test/mytest_test.rb:5:in `test': unknown command ?t (ArgumentError)
        from ./test/mytest_test.rb:5
        from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5:in `load'
        from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5
        from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5:in `each'
        from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5
rake aborted!

The generated test is:
  test "the truth" do
    assert true

and in "unknown command ?t", the ?t is the first letter of "the truth"
(I mean changing this label changes the error).

Any hint as to how I should correct this and get the test running fine?



Here is the rest of the trace when running rake test --trace in the
plugin's directory

Command failed with status (1): [/usr/bin/ruby1.8 -Ilib:lib:test
/usr/lib/ruby/1.8/rake.rb:899:in `sh'
/usr/lib/ruby/1.8/rake.rb:906:in `call'
/usr/lib/ruby/1.8/rake.rb:906:in `sh'
/usr/lib/ruby/1.8/rake.rb:985:in `sh'
/usr/lib/ruby/1.8/rake.rb:920:in `ruby'
/usr/lib/ruby/1.8/rake.rb:985:in `ruby'
/usr/lib/ruby/1.8/rake/testtask.rb:117:in `define'
/usr/lib/ruby/1.8/rake.rb:1003:in `verbose'
/usr/lib/ruby/1.8/rake/testtask.rb:102:in `define'
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1909:in `each'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1903:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1881:in `run'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1878:in `run'

Web database:
Free Software Developers Meeting:
piannaf (Guest)
on 2009-03-04 18:35
(Received via mailing list)
I had the same problem and fixed it by changing all tests such that

  test "the truth" do
    assert true

were instead written

  def test_the_truth
    assert true

I had generated the tests with Rails 2.2.x but then had downgraded
(check environment.rb) to 2.1.x which doesn't use the same format.

Hope that helps you,
This topic is locked and can not be replied to.