Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4646

Show
Ignore:
Timestamp:
08/01/06 07:33:17 (2 years ago)
Author:
bitsweat
Message:

more concise destroy test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/test/base_test.rb

    r4626 r4646  
    324324    end 
    325325  end 
    326    
     326 
    327327  def test_destroy 
    328     topic = Topic.new 
    329     topic.title = "Yet Another New Topic" 
    330     topic.written_on = "2003-12-12 23:23:00" 
    331     topic.save 
    332     topic.destroy 
     328    topic = Topic.find(1) 
     329    assert_equal topic, topic.destroy, 'topic.destroy did not return self' 
     330    assert topic.frozen?, 'topic not frozen after destroy' 
    333331    assert_raise(ActiveRecord::RecordNotFound) { Topic.find(topic.id) } 
    334332  end 
    335    
    336   def test_destroy_returns_self 
    337     topic = Topic.new("title" => "Yet Another Title") 
    338     assert topic.save 
    339     assert_equal topic, topic.destroy, "destroy did not return destroyed object" 
    340   end 
    341    
     333 
    342334  def test_record_not_found_exception 
    343335    assert_raises(ActiveRecord::RecordNotFound) { topicReloaded = Topic.find(99999) }