Day one - SuSE factory - Why doesn't rake work?


#1

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:inexecute’
    /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:ininsert_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:increate_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:increate_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:increate_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:insetup’

  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:inteardown’

  3. Failure:
    test_truth(ExaminersTest) [./test/unit/examiners_test.rb:8]:

    expected to be kind_of?
    but was
    .

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 F.
The Norcross Group
Forensics for the 21st Century


#2

On 12/12/05, Greg F. removed_email_address@domain.invalid 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


#3

On 12/12/05, Howard R. removed_email_address@domain.invalid 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 F.
The Norcross Group
Forensics for the 21st Century