|
|
|
@ -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
|
|
|
|
|