Topic: No test will run

When I perform a simle truth test I get the following.

test_the_truth(UserTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: table stories has no column named authour: INSERT INTO "stories" ("title", "authour", "created_at", "updated_at", "id") VALUES ('MyString', 'MyString', '2011-05-31 17:23:49', '2011-05-31 17:23:49', 980190962)

This is annoying in itself but even more so given that there is an authour table in the stories table.

Can anybody shed any light on this matter?

Last edited by gleb (2011-05-31 13:39:16)

Re: No test will run

There is no column named authour in the stories table means you probably mistyped something somewhere and you probably meant to say author or even author_id or you possibly meant to say nothing at all,
Either way, check out your fixtures for the stories,rb file (which lives in your_app/tests/fixtures) and verify the column names against what you actually have in the database table and make sure they match.

the fact that you have this error probably means that you are going to have to visit some other code in your tests to correct that error in other files but fix that error first then see what you get

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: No test will run

I am just starting testing this app. All the unit tests contain

class StoryTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  test "the truth" do
    assert true
  end
end

The yml does match the database ie contains authour

Re: No test will run

Can you post the stories fixture plus the fields list for the stories table?

Before each test runs the fixtures will load up the database defined in your database.yml file under test with the data from your fixtures, You quite categorically do not have a column called authour in the test database for the table called stories.

Why this is the case is anyones guess at this stage but one thing you can check is that you have applied all your migrations to the test database by running rake db:test:prepare

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: No test will run

from stories.yml

one:
  title: MyString
  authour: MyString

two:
  title: MyString
  authour: MyString

from schema.rb

create_table "stories", :force => true do |t|
    t.integer  "user_id"
    t.string   "authour"
    t.string   "title"
    t.string   "body"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "photo_file_name"
    t.string   "photo_content_type"
    t.integer  "photo_file_size"
    t.integer  "avatars"

Re: No test will run

In the actual test database (test.sqlite3) can you check that the stories table has that authour field and did you run rake db:test:prepare

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: No test will run

That sorted it. The seond time I ran db:test:prepare it stopped the stories problem. That brought up a subcomments problem whih I'e solved. I've got an emails problem now but I think I know what to do now.

Cheers Gleb

Re: No test will run

Nice one, good luck smile
p.s.
Have you checked out the Railscast on RSpec and capybara http://railscasts.com/episodes/257-requ … d-capybara

I'm finding this to be an awesome combination plus I'm also now mixing factory girl as a fixtures replacement. It's worth a look once you've gotten your head round testing

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)