# Generated plugin test doesn't work

**URL:** <https://www.ruby-forum.com/t/generated-plugin-test-doesnt-work/159306>\
**Category:** Rails\
**Created:** [February 3, 2009, 11:17am UTC](https://www.ruby-forum.com/t/generated-plugin-test-doesnt-work/159306 "2009-02-03T11:17:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphael\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@raphael\_b](https://www.ruby-forum.com/u/raphael_b)\
**Post date:** [February 3, 2009, 11:17am UTC](https://www.ruby-forum.com/t/generated-plugin-test-doesnt-work/159306/1 "2009-02-03T11:17:49Z")

</div>

Hi,

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  
end

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?

Thanks

Raphaël

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/…]  
/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’  
/usr/bin/rake:28

–  
Web database: [http://www.myowndb.com](http://www.myowndb.com)  
Free Software Developers Meeting: [http://www.fosdem.org](http://www.fosdem.org)

---

<div class="post-metadata">

**Author:** ![raphael\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@raphael\_b](https://www.ruby-forum.com/u/raphael_b)\
**Post date:** [March 4, 2009, 5:35pm UTC](https://www.ruby-forum.com/t/generated-plugin-test-doesnt-work/159306/2 "2009-03-04T17:35:50Z")

</div>

I had the same problem and fixed it by changing all tests such that

test “the truth” do  
assert true  
end

were instead written

def test\_the\_truth  
assert true  
end

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,  
Justin
