replying to myself here: I managed to fix article_test.rb so that it
now passes all tests on sqlite
Should I submit patches for the files I fix? I still haven’t worked
out all the errors on postgres. I’ll work on that more, but I like
sqlite more, so I’ll be concentrating on that platform.
Before:
mattrose@venice:~/typotest/typo.sqlite/test/unit$ ruby
article_test.rb.orig
Loaded suite article_test.rb.orig
Started
F…E.EEFEF…F.E.
Finished in 3.506417 seconds.
-
Failure:
test_create(ArticleTest) [article_test.rb.orig:24]:
is not true.
-
Error:
test_find_published_by_category(ArticleTest):
ActiveRecord::RecordInvalid: Validation failed: Blog can’t be blank
/home/mattrose/typotest/typo.sqlite/config/…/vendor/rails/
activerecord/lib/active_record/validations.rb:736:in save!' /home/mattrose/typotest/typo.sqlite/config/../vendor/rails/ activerecord/lib/active_record/validations.rb:699:in
create!’
article_test.rb.orig:178:in `test_find_published_by_category’
-
Error:
test_future_publishing(ArticleTest):
ActiveRecord::RecordInvalid: Validation failed: Blog can’t be blank
/home/mattrose/typotest/typo.sqlite/config/…/vendor/rails/
activerecord/lib/active_record/validations.rb:736:in save!' /home/mattrose/typotest/typo.sqlite/config/../vendor/rails/ activerecord/lib/active_record/validations.rb:699:in
create!’
article_test.rb.orig:150:in `test_future_publishing’
-
Error:
test_future_publishing_without_published_flag(ArticleTest):
ActiveRecord::RecordInvalid: Validation failed: Blog can’t be blank
/home/mattrose/typotest/typo.sqlite/config/…/vendor/rails/
activerecord/lib/active_record/validations.rb:736:in save!' /home/mattrose/typotest/typo.sqlite/config/../vendor/rails/ activerecord/lib/active_record/validations.rb:699:in
create!’
article_test.rb.orig:156:in
`test_future_publishing_without_published_flag’
-
Failure:
test_html_title(ArticleTest) [article_test.rb.orig:63]:
is not true.
-
Error:
test_just_published_flag(ArticleTest):
ActiveRecord::RecordInvalid: Validation failed: Blog can’t be blank
/home/mattrose/typotest/typo.sqlite/config/…/vendor/rails/
activerecord/lib/active_record/validations.rb:736:in save!' /home/mattrose/typotest/typo.sqlite/config/../vendor/rails/ activerecord/lib/active_record/validations.rb:699:in
create!’
article_test.rb.orig:142:in `test_just_published_flag’
-
Failure:
test_notifications(ArticleTest) [article_test.rb.orig:203]:
is not true.
-
Failure:
test_tags(ArticleTest) [article_test.rb.orig:92]:
is not true.
-
Error:
test_triggers_are_dependent(ArticleTest):
ActiveRecord::RecordInvalid: Validation failed: Blog can’t be blank
/home/mattrose/typotest/typo.sqlite/config/…/vendor/rails/
activerecord/lib/active_record/validations.rb:736:in save!' /home/mattrose/typotest/typo.sqlite/config/../vendor/rails/ activerecord/lib/active_record/validations.rb:699:in
create!’
article_test.rb.orig:161:in `test_triggers_are_dependent’
21 tests, 45 assertions, 4 failures, 5 errors
After:
mattrose@venice:~/typotest/typo.sqlite/test/unit$ ruby article_test.rb
Loaded suite article_test
Started
…
Finished in 11.862288 seconds.
21 tests, 72 assertions, 0 failures, 0 errors
and this is the unified diff
— article_test.rb.orig 2006-06-21 21:51:49.000000000 -0400
+++ article_test.rb 2006-06-21 21:57:34.000000000 -0400
@@ -18,6 +18,7 @@
def test_create
a = Article.new
@@ -60,6 +61,7 @@
def test_html_title
a = Article.new
a.title = “This is a test”
@@ -79,7 +81,7 @@
end
def test_tags
- a = Article.new(:title => ‘Test tag article’,
- a = Article.new(:title => ‘Test tag article’, :blog_id => 1,
:keywords => ‘test tag tag stuff’);
assert_kind_of Article, a
@@ -139,7 +141,7 @@
assert art.save
assert !art.just_published?
- art = Article.create!(:title => ‘title2’,
- art = Article.create!(:title => ‘title2’, :blog_id => 2,
:body => ‘body’,
:published => false)
@@ -148,17 +150,18 @@
def test_future_publishing
assert_sets_trigger(Article.create!(:title => ‘title’, :body =>
‘body’,
-
:blog_id => 1,
:published => true,
:published_at => Time.now +
2.seconds))
end
def test_future_publishing_without_published_flag
- assert_sets_trigger Article.create!(:title => ‘title’, :body =>
‘body’,
- assert_sets_trigger Article.create!(:title => ‘title’, :body =>
‘body’, :blog_id => 1,
:published_at => Time.now +
2.seconds)
end
def test_triggers_are_dependent
- art = Article.create!(:title => ‘title’, :body => ‘body’,
- art = Article.create!(:title => ‘title’, :body =>
‘body’, :blog_id => 1,
:published_at => Time.now + 1.hour)
assert_equal 1, Trigger.count
art.destroy
@@ -178,8 +181,10 @@
Article.create!(:title => “News from the future!”,
:body => “The future is cool!”,
:keywords => “future”,
-
:blog_id => 1,
:published_at => Time.now + 12.minutes)
-
#print @articles.find(/future/)
@articles = Category.find_by_permalink
(‘personal’).published_articles
assert_results_are :article1, :article2, :article3
@@ -199,7 +204,7 @@
end
def test_notifications
- a = Article.new(:title => ‘New Article’, :body => ‘Foo’, :author
=> ‘Tobi’, :user => users(:tobi))
- a = Article.new(:title => ‘New Article’, :blog_id => 1, :body =>
‘Foo’, :author => ‘Tobi’, :user => users(:tobi))
assert a.save
assert_equal 2, a.notify_users.size