Forum: Ruby on Rails Day one - SuSE factory - Why doesn't rake work?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
25bbc96d9c53647354cb724e744b2222?d=identicon&s=25 Greg Freemyer (Guest)
on 2005-12-12 23:07
(Received via mailing list)
What are the below rake errors telling me?

====
I'm a rails newbie, but a long time programmer SUSE user.

I'm trying get day one stuff to work where it says run rake to verify
everything is setup.

I'm a SuSE fan, so I'm trying to use SuSE 10.0.

So far everytime I run rake, it gives errors.

I've got a fairly simple mysql database setup that I want to work with.

Concerned that ruby 1.8.2 from SuSE 10 was too old, I've just
compiled/installed ruby-1.8.3 and rubygems-0.8.11 from the SUSE
factory (like Red Hat's Fedora).

Currently when I run rake I get
# rake
(in /srv/www/vhosts/forensic1000)
/usr/bin/ruby -Ilib:test
"/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake_t
est_loader.rb" "test/unit/cases_test.rb" "test/unit/examiners_test.rb"
Loaded suite
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake_test_loader
Started
EEF
Finished in 0.120232 seconds.

  1) Error:
test_truth(CasesTest):
ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry ''
for key 2
: INSERT INTO cases (`id`) VALUES (1)
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection
_adapters/abstract_adapter.rb:88:in `log'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection
_adapters/mysql_adapter.rb:190:in `execute'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:284:in `insert_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:283:in `insert_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:253:in `create_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:253:in `create_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection
_adapters/abstract/database_statements.rb:51:in `transaction'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:251:in `create_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:83
1:in `silence'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:244:in `create_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:540:in `load_fixtures'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:487:in `setup'

  2) Error:
test_truth(CasesTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.-
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/transactio
ns.rb:112:in `unlock_mutex'
    /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/fixtures.r
b:509:in `teardown'

  3) Failure:
test_truth(ExaminersTest) [./test/unit/examiners_test.rb:8]:
<nil>
expected to be kind_of?
<Examiners> but was
<NilClass>.

2 tests, 1 assertions, 1 failures, 2 errors
/usr/bin/ruby -Ilib:test
"/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake_t
est_loader.rb" "test/functional/cases_controller_test.rb"
"test/functional/exami
ners_controller_test.rb"
Loaded suite
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/rake_test_loader
Started
..
Finished in 0.017476 seconds.

2 tests, 2 assertions, 0 failures, 0 errors
rake aborted!
Test failures


Thanks
Greg
--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
39bd2cc2a8b8ead1299b6f8121b127f7?d=identicon&s=25 Howard Roberts (Guest)
on 2005-12-13 05:27
(Received via mailing list)
On 12/12/05, Greg Freemyer <greg.freemyer@gmail.com> wrote:
Hi Greg,


>   1) Error:
> test_truth(CasesTest):
> ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry '' for
> key 2
> : INSERT INTO cases (`id`) VALUES (1)
>
Usually this particular error indicates that you didn't set up your id
field
in your table to be auto_increment. Start there and see how many other
errors go away.

HTH,
Howard
25bbc96d9c53647354cb724e744b2222?d=identicon&s=25 Greg Freemyer (Guest)
on 2005-12-14 00:42
(Received via mailing list)
On 12/12/05, Howard Roberts <hdean.roberts@gmail.com> wrote:
> in your table to be auto_increment. Start there and see how many other
> errors go away.
>
>  HTH,
>  Howard

Thanks,

As I said, this is my first time to run ruby/rails.

I have been trying "rake" with no options.  Today I read something
that called for running "rake test".

When I do "rake test" everything works fine.

Was that my mistake?  Does "rake" by itself modify the devel DB which
in my case has some test data in it?

If "rake" should work, I'm still having problems even with the basic
ToDo setup called for in "four days on rails".  The scaffolding itself
seems to be working.

Thanks
Greg
--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
This topic is locked and can not be replied to.