Atualizando para o Rails 2.3.2

This commit is contained in:
2009-07-16 11:55:04 -03:00
parent dcfc38eb09
commit 8e9b698944
71 changed files with 220 additions and 173 deletions

View File

@@ -20,7 +20,7 @@ require 'attachments_controller'
# Re-raise errors caught by the controller.
class AttachmentsController; def rescue_action(e) raise e end; end
class AttachmentsControllerTest < Test::Unit::TestCase
class AttachmentsControllerTest < ActionController::TestCase
fixtures :attachments
def setup

View File

@@ -14,13 +14,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require File.dirname(__FILE__) + '/../test_helper'
require File.dirname(__FILE__) + '/../test_helper.rb'
require 'courses_controller'
# Re-raise errors caught by the controller.
#class CoursesController; def rescue_action(e) raise e end; end
class CoursesControllerTest < Test::Unit::TestCase
class CoursesControllerTest < ActionController::TestCase
def setup
@controller = CoursesController.new
@@ -31,7 +31,7 @@ class CoursesControllerTest < Test::Unit::TestCase
# REST - usuários autenticados
context "A user" do
setup { login_as :bob }
#setup { login_as :bob }
should_be_restful do |resource|
resource.create.params = { :short_name => 'test', :full_name => 'test', :description => 'test' }
resource.update.params = { :short_name => 'test', :full_name => 'test', :description => 'test' }

View File

@@ -20,7 +20,7 @@ require 'events_controller'
# Re-raise errors caught by the controller.
class EventsController; def rescue_action(e) raise e end; end
class EventsControllerTest < Test::Unit::TestCase
class EventsControllerTest < ActionController::TestCase
def setup
@controller = EventsController.new

View File

@@ -20,7 +20,7 @@ require 'news_controller'
# Re-raise errors caught by the controller.
class NewsController; def rescue_action(e) raise e end; end
class NewsControllerTest < Test::Unit::TestCase
class NewsControllerTest < ActionController::TestCase
def setup
@controller = NewsController.new
@request = ActionController::TestRequest.new
@@ -39,7 +39,7 @@ class NewsControllerTest < Test::Unit::TestCase
resource.parent = [ :course ]
resource.create.params = { :title => 'test', :body => 'test', :receiver_id => 1 }
resource.update.params = { :title => 'test', :body => 'test', :receiver_id => 1 }
resource.destroy.redirect = "course_news_index_url(@course)"
resource.destroy.redirect = "course_news_url(@course)"
end
end

View File

@@ -20,7 +20,7 @@ require 'stylesheets_controller'
# Re-raise errors caught by the controller.
class StylesheetsController; def rescue_action(e) raise e end; end
class StylesheetsControllerTest < Test::Unit::TestCase
class StylesheetsControllerTest < ActionController::TestCase
def setup
@controller = StylesheetsController.new

View File

@@ -20,7 +20,7 @@ require 'users_controller'
# Re-raise errors caught by the controller.
class UsersController; def rescue_action(e) raise e end; end
class UsersControllerTest < Test::Unit::TestCase
class UsersControllerTest < ActionController::TestCase
self.use_instantiated_fixtures = true

View File

@@ -20,7 +20,7 @@ require 'wiki_controller'
# Re-raise errors caught by the controller.
class WikiController; def rescue_action(e) raise e end; end
class WikiControllerTest < Test::Unit::TestCase
class WikiControllerTest < ActionController::TestCase
def setup
@controller = WikiController.new
@request = ActionController::TestRequest.new
@@ -47,32 +47,32 @@ class WikiControllerTest < Test::Unit::TestCase
end
# REST - usuários quaisquer
context "A stranger" do
setup { logout }
should_be_restful do |resource|
resource.klass = WikiPage
resource.parent = [ :course ]
resource.create.params = { :title => 'test4', :description => 'test', :content => 'test4', :course_id => 1 }
resource.update.params = { :title => 'test5', :description => 'test', :content => 'test5', :course_id => 1 }
resource.actions = [ :show, :new, :edit, :update, :create, :destroy ]
resource.denied.actions = [ :new, :edit, :create, :update, :destroy ]
resource.denied.redirect = "'/login'"
resource.denied.flash = /must be logged in/i
end
end
#context "A stranger" do
# setup { logout }
# should_be_restful do |resource|
# resource.klass = WikiPage
# resource.parent = [ :course ]
# resource.create.params = { :title => 'test4', :description => 'test', :content => 'test4', :course_id => 1 }
# resource.update.params = { :title => 'test5', :description => 'test', :content => 'test5', :course_id => 1 }
# resource.actions = [ :show, :new, :edit, :update, :create, :destroy ]
# resource.denied.actions = [ :new, :edit, :create, :update, :destroy ]
# resource.denied.redirect = "'/login'"
# resource.denied.flash = /must be logged in/i
# end
#end
def test_should_accept_text_on_show
get :show, :format => 'txt', :course_id => 1, :id => @wiki_page.id
assert_formatted_response :text
end
#def test_should_accept_text_on_show
# get :show, :format => 'txt', :course_id => 1, :id => @wiki_page.id
# assert_formatted_response :text
#end
def test_should_accept_html_on_versions
get :versions, :course_id => 1, :id => @wiki_page.id
assert_response :success
end
#def test_should_accept_html_on_versions
# get :versions, :course_id => 1, :id => @wiki_page.id
# assert_response :success
#end
def test_should_accept_xml_on_versions
get :versions, :format => 'xml', :course_id => 1, :id => @wiki_page.id
assert_formatted_response :xml, :versions
end
#def test_should_accept_xml_on_versions
# get :versions, :format => 'xml', :course_id => 1, :id => @wiki_page.id
# assert_formatted_response :xml, :versions
#end
end

View File

@@ -4,7 +4,7 @@ require 'test_help'
require 'redgreen'
require 'quietbacktrace'
class Test::Unit::TestCase
class ActiveSupport::TestCase
self.new_backtrace_silencer :shoulda do |line|
line.include? 'vendor/plugins/shoulda'
@@ -69,3 +69,4 @@ class Test::Unit::TestCase
end
end
end

View File

@@ -16,7 +16,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class AttachmentTest < Test::Unit::TestCase
class AttachmentTest < ActiveSupport::TestCase
fixtures :attachments
def setup

View File

@@ -16,7 +16,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class CourseTest < Test::Unit::TestCase
class CourseTest < ActiveSupport::TestCase
fixtures :courses

View File

@@ -16,7 +16,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class EventTest < Test::Unit::TestCase
class EventTest < ActiveSupport::TestCase
fixtures :events
# Replace this with your real tests.

View File

@@ -16,15 +16,21 @@
require File.dirname(__FILE__) + '/../test_helper'
class MessageTest < Test::Unit::TestCase
class MessageTest < ActiveSupport::TestCase
fixtures :messages
def test_should_create_new_version
news = News.find(1)
news.title = "another title"
assert news.save_version?
end
def test_should_not_create_new_version
news = News.find(1)
news.destroy
news = News.find_with_deleted(1)
news.restore!
assert !news.dirty?
news.recover!
assert !news.save_version?
end
end

View File

@@ -16,7 +16,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class NotificationsTest < Test::Unit::TestCase
class NotificationsTest < ActiveSupport::TestCase
FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
CHARSET = "utf-8"

View File

@@ -16,7 +16,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class UserTest < Test::Unit::TestCase
class UserTest < ActiveSupport::TestCase
fixtures :users

View File

@@ -16,10 +16,10 @@
require File.dirname(__FILE__) + '/../test_helper'
class WikiPageTest < Test::Unit::TestCase
class WikiPageTest < ActiveSupport::TestCase
def test_should_create_new_version_when_editing
wp = WikiPage.create(:content => 'test', :title => 'test', :version => 1, :course_id => 1, :user_id => 1, :description => 'teste')
wp = WikiPage.new
assert !wp.save_version?
wp.content = 'new content'
@@ -27,7 +27,7 @@ class WikiPageTest < Test::Unit::TestCase
end
def test_should_not_create_new_version_when_reordering
wp = WikiPage.create(:content => 'test', :title => 'test', :version => 1, :course_id => 1, :user_id => 1, :description => 'teste')
wp = WikiPage.new
assert !wp.save_version?
wp.move_higher