Sha256: 29d975e8cc835a8fadfad1938e392b6fae1d2ce98c84d4b619199e8d238ea02e
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'og', 'CONFIG.rb') require 'test/unit' require 'og' require 'glue/revisable' class TestOgRevisable < Test::Unit::TestCase # :nodoc: all class Article is Glue::Revisable attr_accessor :body, String, :revisable => true attr_accessor :title, String def initialize(t, b) @title, @body = t, b end end $og1.manage_classes(Article, Article::Revision) def test_all a = Article.create('hello', 'world') a.revise do |a| a.body = 'wow!' end a.revise do |a| a.body = 'nice' end a.revise do |a| a.body = 'it' end assert_equal 3, a.revisions.count rev = a.get_revision(2) assert_equal 'wow!', rev.body a.rollback(2) assert_equal 'wow!', a.body a.rollback(1) assert_equal 'world', a.body a.rollback(3) assert_equal 'nice', a.body assert_equal 6, a.revisions.count a.revise do |a| a.title = 'kicks' a.body = 'ass' end assert_equal 7, a.revisions.count # The automatically generated class. assert_equal 7, Article::Revision.count end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
og-0.41.0 | test/glue/tc_revisable.rb |
og-0.40.0 | test/glue/tc_revisable.rb |