Test fixtures not loading

PLEASE HELP.

This is driving me insane. I have a simple database table:

create table products( id int not null auto_increment, title varchar(100) not null, description text not null, image_url varchar(200) not null, price decimal(10,2) not null, date_available datetime not null, primary key(id));

and now I am trying to load a fixture into that table:

version_control_book: id: 1 title: Pragmatic Version Control description: How to use version control image_url: sk_svn_small.jpg price: 29.95 date_available: 2005-01-26 00:00:00

however, I ALWAYS receive errors on the parameters as if they are being parsed like directories:

  1) Error: default_test(ProductTest): Errno::ENOENT: No such file or directory - Pragmatic Version Control

I have no idea what I am doing wrong. Has anyone got some ideas?

I ALWAYS receive errors on the parameters as if they are being parsed like directories:

  1) Error: default_test(ProductTest): Errno::ENOENT: No such file or directory - Pragmatic Version Control

Chances are you did not use your database client to create the database "default_test". You need a separate database for EACH function in Rails: development, testing, and production. Check out the database.yml file in your config/ directory.

and now I am trying to load a fixture into that table:

version_control_book: id: 1 title: Pragmatic Version Control description: How to use version control image_url: sk_svn_small.jpg price: 29.95 date_available: 2005-01-26 00:00:00

however, I ALWAYS receive errors on the parameters as if they are being parsed like directories:

Is this the indentation you're using in your fixture? I might be wrong, but I think you need to have the keys indented, e.g.,

version_control_book:    id: 1    title: Pragmatic Version Control    description: How to use version control    image_url: sk_svn_small.jpg    price: 29.95    date_available: 2005-01-26 00:00:00

  1) Error: default_test(ProductTest): Errno::ENOENT: No such file or directory - Pragmatic Version Control

I have no idea what I am doing wrong. Has anyone got some ideas?

I'm not sure if this explains this error though. Just a thought.

Michael Glaesemann grzm seespotcode net

I think I figured this out...

This has something to do with the file format or encoding.

If I create an identical project in Linux, identical database tables then the testing works flawlessly. As soon as I copy that project to a windows environment, my testing fails again.

Can I not do Rails development in Windows?

I think I figured this out...

This has something to do with the file format or encoding.

If I create an identical project in Linux, identical database tables then the testing works flawlessly. As soon as I copy that project to a windows environment, my testing fails again.

Can I not do Rails development in Windows?

Yes, you can of course. When you say "copy that project" do you convert from Unix "\n" line endings to DOS/Windows "\r\n" line endings in all your source and YAML files?

I've not explored this fully, but YAML depends on layout, which to some extent depends on what is an end-of-line sequence. So I think your Unix YAML files may possibly fail on Windows. But I've run no tests of this, it may be more resilient. _Why is way more clever than I am. :slight_smile:

The nature of the failure may be something of a clue... Ah, not sure that seen this below....

> > > and now I am trying to load a fixture into that table: > > > version_control_book: > > id: 1

[indentation comment below [trimmed] applies...]

> > title: Pragmatic Version Control > > description: How to use version control > > image_url: sk_svn_small.jpg > > price: 29.95 > > date_available: 2005-01-26 00:00:00 > > > however, I ALWAYS receive errors on the parameters as if they are > > being parsed like directories:

        [...]

> > 1) Error: > > default_test(ProductTest): > > Errno::ENOENT: No such file or directory - Pragmatic Version Control >

I don't see why a string would be processed as a directory.

Anything useful from poking about in the stack trace?

> > I have no idea what I am doing wrong. Has anyone got some ideas? > > I'm not sure if this explains this error though. Just a thought. > > Michael Glaesemann > grzm seespotcode net

        Hugh

Here's what I have going on and what I did to have "reproducable" YAML problems:

1. I am running an Ubuntu Linux server with a Subversion repository installed. 2. I run the 'rails' command in windows and create myself a project. 3. I have a very simple table in my database, so I create a model for it. 4. I add some data to the fixture file for that model. 5. Run my test, and it blows up.

Now,

If I check this project into source control. Then check it out on Linux, the test will still fail (remember I created the project in Windows).

So, then, I perform steps 1 through 5 on Linux (brand new project) and everything works fine.

So,

Is anyone out there actually using Windows for their fixture files? What editor/IDE are you using? do they work for you? I am running XP... are people running that OS?

Here's what I have going on and what I did to have "reproducable" YAML problems:

1. I am running an Ubuntu Linux server with a Subversion repository installed. 2. I run the 'rails' command in windows and create myself a project. 3. I have a very simple table in my database, so I create a model for it.

OK...

4. I add some data to the fixture file for that model. 5. Run my test, and it blows up.

Can you show us that fixture? And the explosion as well.

Now,

If I check this project into source control. Then check it out on Linux, the test will still fail (remember I created the project in Windows).

That looks like line endings.

So, then, I perform steps 1 through 5 on Linux (brand new project) and everything works fine.

So,

Is anyone out there actually using Windows for their fixture files?

Yes. Things are not perfect yet, I'm having problems with unlocatable missing parens, but in general this is working for me, but I working under Cygwin, as for me it kills some of the pain. I've been using various Unix flavours since the early 80's. The quoting conventions and / vs \ conventions, are just the start.

What editor/IDE are you using? do they work for you? I am running

gvim.

XP... are people running that OS?

Yes.

        Hugh