Created
April 7, 2010 02:16
-
-
Save rbarazi/358403 to your computer and use it in GitHub Desktop.
[Beginning Rails 3] Listing 10-7. Test case for updating an article, in test/unit/article_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class ArticleTest < ActiveSupport::TestCase | |
test "should create article" do | |
article = Article.new | |
article.user = users(:eugene) | |
article.title = "Test article" | |
article.body = "Test body" | |
assert article.save | |
end | |
test "should find article" do | |
article_id = articles(:welcome_to_rails).id | |
assert_nothing_raised { Article.find(article_id) } | |
end | |
test "should update article" do | |
article = articles(:welcome_to_rails) | |
assert article.update_attributes(:title => 'New title') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment