Mercurial > hg > soundsoftware-site
comparison test/unit/wiki_content_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
65 end | 65 end |
66 content.reload | 66 content.reload |
67 assert_equal version_count+1, content.version | 67 assert_equal version_count+1, content.version |
68 assert_equal version_count+1, content.versions.length | 68 assert_equal version_count+1, content.versions.length |
69 | 69 |
70 version = WikiContent::Version.first(:order => 'id DESC') | 70 version = WikiContent::Version.order('id DESC').first |
71 assert_equal @page.id, version.page_id | 71 assert_equal @page.id, version.page_id |
72 assert_equal '', version.compression | 72 assert_equal '', version.compression |
73 assert_equal "My new content", version.data | 73 assert_equal "My new content", version.data |
74 assert_equal "My new content", version.text | 74 assert_equal "My new content", version.text |
75 end | 75 end |
81 assert_difference 'WikiContent::Version.count' do | 81 assert_difference 'WikiContent::Version.count' do |
82 assert content.save | 82 assert content.save |
83 end | 83 end |
84 end | 84 end |
85 | 85 |
86 version = WikiContent::Version.first(:order => 'id DESC') | 86 version = WikiContent::Version.order('id DESC').first |
87 assert_equal @page.id, version.page_id | 87 assert_equal @page.id, version.page_id |
88 assert_equal 'gzip', version.compression | 88 assert_equal 'gzip', version.compression |
89 assert_not_equal "My new content", version.data | 89 assert_not_equal "My new content", version.data |
90 assert_equal "My new content", version.text | 90 assert_equal "My new content", version.text |
91 end | 91 end |
119 end | 119 end |
120 | 120 |
121 def test_current_version | 121 def test_current_version |
122 content = WikiContent.find(11) | 122 content = WikiContent.find(11) |
123 assert_equal true, content.current_version? | 123 assert_equal true, content.current_version? |
124 assert_equal true, content.versions.first(:order => 'version DESC').current_version? | 124 assert_equal true, content.versions.order('version DESC').first.current_version? |
125 assert_equal false, content.versions.first(:order => 'version ASC').current_version? | 125 assert_equal false, content.versions.order('version ASC').first.current_version? |
126 end | 126 end |
127 | 127 |
128 def test_previous_for_first_version_should_return_nil | 128 def test_previous_for_first_version_should_return_nil |
129 content = WikiContent::Version.find_by_page_id_and_version(1, 1) | 129 content = WikiContent::Version.find_by_page_id_and_version(1, 1) |
130 assert_nil content.previous | 130 assert_nil content.previous |