Gemify and upgrade to shoulda-2.11.3, remove dr_nic_magic_models

This commit is contained in:
2013-07-12 15:54:20 -04:00
parent 8058096f7e
commit 796c1a279e
226 changed files with 56 additions and 12509 deletions

View File

@@ -46,7 +46,7 @@ class AttachmentsControllerTest < ActionController::TestCase
context "on get to :show" do
setup { get :show, :course_id => @course.id, :id => @att.id }
should_respond_with :success
should respond_with :success
should "link to the attachment" do
assert_select 'a[href=?]', download_course_attachment_url(@course, @att)
@@ -59,8 +59,8 @@ class AttachmentsControllerTest < ActionController::TestCase
context "on get to :new" do
setup { get :new, :course_id => @course.id }
should_render_a_form
should_respond_with :success
#should render_a_form
should respond_with :success
end
context "on post to :create" do
@@ -74,15 +74,15 @@ class AttachmentsControllerTest < ActionController::TestCase
assert @att
end
should_set_the_flash_to(/created/i)
should_redirect_to('the attachment') { course_attachment_url(@course, @att) }
should set_the_flash.to(/created/i)
should redirect_to('the attachment') { course_attachment_url(@course, @att) }
should_create_log_entry {[ AttachmentCreateLogEntry, @att.id, users(:bob).id ]}
end
context "on get to :edit" do
setup { get :edit, :course_id => @course.id, :id => @att.id }
should_render_a_form
should_render_template 'edit'
#should render_a_form
should render_template 'edit'
end
context "on post to :update" do
@@ -91,8 +91,8 @@ class AttachmentsControllerTest < ActionController::TestCase
post :update, :course_id => @course.id, :id => @att.id, :attachment => { :description => @att.description, :path => "", :front_page => 't' }
end
should_not_set_the_flash
should_redirect_to('the attachment') { course_attachment_url(@course, @att) }
should_not set_the_flash
should redirect_to('the attachment') { course_attachment_url(@course, @att) }
should "not create a new log entry" do
assert_nil AttachmentEditLogEntry.find(:first, :conditions => { :target_id => @att.id })
@@ -103,8 +103,8 @@ class AttachmentsControllerTest < ActionController::TestCase
setup do
post :update, :course_id => @course.id, :id => @att.id, :attachment => { :description => 'new description', :front_page => 't' }
end
should_set_the_flash_to(/updated/i)
should_redirect_to('the attachment') { course_attachment_url(@course, @att) }
should set_the_flash.to(/updated/i)
should redirect_to('the attachment') { course_attachment_url(@course, @att) }
should_create_log_entry {[ AttachmentEditLogEntry, @att.id, users(:bob).id ]}
end
@@ -116,8 +116,8 @@ class AttachmentsControllerTest < ActionController::TestCase
teardown do
@new_data.close!
end
should_set_the_flash_to(/updated/i)
should_redirect_to('the attachment') { course_attachment_url(@course, @att) }
should set_the_flash.to(/updated/i)
should redirect_to('the attachment') { course_attachment_url(@course, @att) }
should_create_log_entry {[ AttachmentEditLogEntry, @att.id, users(:bob).id ]}
end
end
@@ -125,8 +125,8 @@ class AttachmentsControllerTest < ActionController::TestCase
context "on post to :destroy" do
setup { post :destroy, :course_id => @course.id, :id => @att.id }
should_set_the_flash_to(/removed/i)
should_redirect_to('the course page'){ course_url(@course) }
should set_the_flash.to(/removed/i)
should redirect_to('the course page'){ course_url(@course) }
should_create_log_entry {[ AttachmentDeleteLogEntry, @att.id, users(:bob).id ]}
should "destroy the attachment" do
@@ -141,8 +141,8 @@ class AttachmentsControllerTest < ActionController::TestCase
# post :undelete, :course_id => @course.id, :id => @att.id
# end
# should_set_the_flash_to(/restored/i)
# should_redirect_to('the attachment'){ course_attachment_url(@course, @att) }
# should set_the_flash.to(/restored/i)
# should redirect_to('the attachment'){ course_attachment_url(@course, @att) }
# should_create_log_entry {[ AttachmentRestoreLogEntry, @att.id, users(:bob).id ]}
# should "restore the attachment" do
@@ -152,7 +152,7 @@ class AttachmentsControllerTest < ActionController::TestCase
context "on get to :download" do
setup { get :download, :course_id => @course.id, :id => @att.id }
should_respond_with :success
should respond_with :success
end
end
end

View File

@@ -41,8 +41,8 @@ class CoursesControllerTest < ActionController::TestCase
context "on get to :index" do
setup { get :index }
should_respond_with :success
should_render_template 'index'
should respond_with :success
should render_template 'index'
should "display the course list" do
assert_select 'h1', "Disciplinas #{App.current_period}"
@@ -58,8 +58,8 @@ class CoursesControllerTest < ActionController::TestCase
context "on get to :show" do
setup { get :show, :id => @course.id }
should_respond_with :success
should_render_template 'show'
should respond_with :success
should render_template 'show'
should "display the course" do
assert_select 'a[href=?]', course_log_url(@course)

View File

@@ -28,15 +28,15 @@ class UsersControllerTest < ActionController::TestCase
context "on get to :dashboard" do
setup { get :dashboard }
should_respond_with :success
should_render_template "dashboard"
should respond_with :success
should render_template "dashboard"
end
context "on post to :logout" do
setup { get :logout }
should_respond_with :redirect
should_redirect_to('the main page') { index_url }
should respond_with :redirect
should redirect_to('the main page') { index_url }
should "log out" do
assert_nil session[:user_id]

View File

@@ -51,14 +51,14 @@ class WikiControllerTest < ActionController::TestCase
#context "on get to :index" do
# setup { get :index, :course_id => @course.id }
# should_redirect_to('the course page') { course_url(@course) }
# should redirect_to('the course page') { course_url(@course) }
#end
context "on get to :show" do
setup { get :show, :course_id => @course.id, :id => @wiki_page.id }
should_respond_with :success
should_render_template 'show'
should respond_with :success
should render_template 'show'
should "show the wiki page" do
assert_select 'h1.title', @wiki_page.title
@@ -74,8 +74,8 @@ class WikiControllerTest < ActionController::TestCase
context "on get to :versions" do
setup { get :versions, :course_id => @course.id, :id => @wiki_page.id }
should_respond_with :success
should_render_template 'versions'
should respond_with :success
should render_template 'versions'
should "show the wiki page versions" do
@wiki_page.versions.each do |v|
@@ -88,7 +88,7 @@ class WikiControllerTest < ActionController::TestCase
context "with valid markup" do
setup { get :preview, :text => "hello {$x$} <script>foo();</script> <i onclick='foo()'>x</i>" }
should_respond_with :success
should respond_with :success
should "display latex formulas" do
assert_select 'img[class=tex_inline]'
@@ -102,14 +102,14 @@ class WikiControllerTest < ActionController::TestCase
context "with invalid markup" do
setup { get :preview, :text => "<a" }
should_respond_with :bad_request
should respond_with :bad_request
end
end
context "on get to :diff" do
setup { get :diff, :course_id => @course.id, :id => @wiki_page.id, :from => 1, :to => 2 }
should_respond_with :success
should_assign_to :diff
should respond_with :success
should assign_to :diff
end
end
@@ -119,8 +119,8 @@ class WikiControllerTest < ActionController::TestCase
context "on get to :new" do
setup { get :new, :course_id => @course.id }
should_render_a_form
should_respond_with :success
#should render_a_form
should respond_with :success
end
context "on post to :create" do
@@ -130,8 +130,8 @@ class WikiControllerTest < ActionController::TestCase
@wiki_page = @course.wiki_pages.find_by_title('test2')
end
should_set_the_flash_to(/created/i)
should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should set_the_flash.to(/created/i)
should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should_create_log_entry {[ WikiCreateLogEntry, @wiki_page.id, users(:bob).id ]}
should "create a new wiki page" do
@@ -144,8 +144,8 @@ class WikiControllerTest < ActionController::TestCase
context "on get to :edit" do
setup { get :edit, :course_id => @course.id, :id => @wiki_page.id }
should_render_a_form
should_render_template 'edit'
#should render_a_form
should render_template 'edit'
should "render a form with the correct fields" do
assert_select "input[name='wiki_page[title]'][value=?]", @wiki_page.title
@@ -168,8 +168,8 @@ class WikiControllerTest < ActionController::TestCase
:title => @wiki_page.title, :content => @wiki_page.content}
end
should_not_set_the_flash
should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should_not set_the_flash
should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should "not create a new log entry" do
assert_nil WikiEditLogEntry.find(:first, :conditions => { :target_id => @wiki_page.id })
@@ -184,8 +184,8 @@ class WikiControllerTest < ActionController::TestCase
@wiki_page.reload
end
should_set_the_flash_to(/updated/i)
should_redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should set_the_flash.to(/updated/i)
should redirect_to('the wiki page') { course_wiki_instance_url(@course, @wiki_page) }
should_create_log_entry {[ WikiEditLogEntry, @wiki_page.id, users(:bob).id ]}
should "update the wiki page" do
@@ -200,8 +200,8 @@ class WikiControllerTest < ActionController::TestCase
context "on post to :destroy" do
setup { post :destroy, :course_id => @course.id, :id => @wiki_page.id }
should_set_the_flash_to(/removed/i)
should_redirect_to('the course page') { course_url(@course) }
should set_the_flash.to(/removed/i)
should redirect_to('the course page') { course_url(@course) }
should_create_log_entry {[ WikiDeleteLogEntry, @wiki_page.id, users(:bob).id ]}
should "delete the wiki page" do
@@ -217,7 +217,7 @@ class WikiControllerTest < ActionController::TestCase
get :move_up, :course_id => @course.id, :id => @another_wiki_page.id
end
should_redirect_to('the course page') { course_url(@course) }
should redirect_to('the course page') { course_url(@course) }
should "move the page up" do
@wiki_page.reload
@@ -234,7 +234,7 @@ class WikiControllerTest < ActionController::TestCase
get :move_down, :course_id => @course.id, :id => @wiki_page.id
end
should_redirect_to('the course page') { course_url(@course) }
should redirect_to('the course page') { course_url(@course) }
should "move the page up" do
@wiki_page.reload
@@ -246,17 +246,17 @@ class WikiControllerTest < ActionController::TestCase
end
#def test_should_accept_text_on_show
#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
#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
#def test_should accept_xml_on_versions
# get :versions, :format => 'xml', :course_id => 1, :id => @wiki_page.id
# assert_formatted_response :xml, :versions
#end