require File.dirname(__FILE__) + '/../test_helper' class PageTest < Test::Unit::TestCase fixtures :pages, :books, :versions, :authors def test_continuous_edit assert home_page.continuous_edit?(david, home_page.current_version.updated_at) 'David was the author of the last Home Page edit, so this should not be a continuous edit' assert !home_page.continuous_edit?(alex, home_page.current_version.updated_at), 'Alex was not the author of the last Home Page edit, so this should be a continuous edit' assert home_page.continuous_edit?(david, home_page.current_version.updated_at + 30.minutes), 'If the last edit was 30 minutes ago, this should still be a continuous edit' assert !home_page.continuous_edit?(david, home_page.current_version.updated_at + 31.minutes), 'If the last edit was over 30 minutes ago, this should not be a continuous edit' end def home_page pages(:home_page) end def david authors(:david) end def alex authors(:alex) end end