Displaying 3 results from an estimated 3 matches for "article_test".
2010 Dec 15
5
Having trouble testing :( "superclass mismatch" and can't load "test_helper"
I''m having trouble testing my Rails 3 application. Unit testing
doesn''t work. If I try ruby article_test.rb directly, I get a "no
such file to load" error, and if I try rake test:units or ruby unit/
article_test.rb I get this odd "superclass mismatch for class
ArticlesController" error!
I''m hoping I can get this settled...
My test files were generated by the generator......
2006 May 04
2
Testing associations
...do is a test in
each model.
# user_test.rb
def test_add_post
u = users(:first)
before_articles = u.articles.count
u.articles << Article.new(:title => "Title", :body => "Body")
u.reload
assert_equal before_articles + 1, u.articles.count
end
# article_test.rb
def test_create_with_user
a = Article.new(:title => "Title", :body => "Body", :user => users(:first))
assert a.save
a.reload
assert_equal users(:first), a.user
end
The thing that bugs me is that in my unit test for article I have to
include the...
2006 Mar 27
1
Tests not tiding up after themselves?
...straint
error. For example:
----
$ ruby test/unit/headline_test.rb
Loaded suite test/unit/headline_test
Started
...........
Finished in 0.312 seconds.
11 tests, 14 assertions, 0 failures, 0 errors
----
This runs nicely. But if I had run the article tests before, I get this
----
$ ruby test/unit/article_test.rb
Loaded suite test/unit/article_test
Started
.
Finished in 0.203 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
$ C:\devel\motiro>ruby test/unit/headline_test.rb | more
Loaded suite test/unit/headline_test
Started
EEEEEEEEEEE
Finished in 0.531 seconds.
1) Error:
test_cache_already_r...