fix tests

This commit is contained in:
r888888888
2014-03-19 12:59:51 -07:00
parent 95b05cae76
commit a1817bd0c3
2 changed files with 12 additions and 4 deletions

View File

@@ -64,9 +64,13 @@ class NotesControllerTest < ActionController::TestCase
context "revert action" do context "revert action" do
setup do setup do
@note = FactoryGirl.create(:note, :body => "000") @note = FactoryGirl.create(:note, :body => "000")
Timecop.travel(1.day.from_now) do
@note.update_attributes(:body => "111") @note.update_attributes(:body => "111")
end
Timecop.travel(2.days.from_now) do
@note.update_attributes(:body => "222") @note.update_attributes(:body => "222")
end end
end
should "revert to a previous version" do should "revert to a previous version" do
post :revert, {:id => @note.id, :version_id => @note.versions(true).first.id}, {:user_id => @user.id} post :revert, {:id => @note.id, :version_id => @note.versions(true).first.id}, {:user_id => @user.id}

View File

@@ -82,9 +82,13 @@ class WikiPagesControllerTest < ActionController::TestCase
context "revert action" do context "revert action" do
setup do setup do
@wiki_page = FactoryGirl.create(:wiki_page, :body => "1") @wiki_page = FactoryGirl.create(:wiki_page, :body => "1")
Timecop.travel(1.day.from_now) do
@wiki_page.update_attributes(:body => "1 2") @wiki_page.update_attributes(:body => "1 2")
end
Timecop.travel(2.days.from_now) do
@wiki_page.update_attributes(:body => "1 2 3") @wiki_page.update_attributes(:body => "1 2 3")
end end
end
should "revert to a previous version" do should "revert to a previous version" do
version = @wiki_page.versions(true).first version = @wiki_page.versions(true).first