Created
November 11, 2012 15:58
-
-
Save benjaminvialle/4055330 to your computer and use it in GitHub Desktop.
Diff from RB for issue 687
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -63,6 +63,8 @@ group :development, :test do | |
gem "time-warp" | |
gem "ruby-debug" | |
gem "mocha" | |
+ gem "assert_valid_markup", | |
+ :git => "git://github.com/hoboman313/assert_valid_markup.git" | |
end | |
# If you plan to use clustered mongrel servers for production | |
diff --git a/Gemfile.lock b/Gemfile.lock | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -1,4 +1,11 @@ | |
GIT | |
+ remote: git://github.com/hoboman313/assert_valid_markup.git | |
+ revision: af6a0bcc9109ef566d1539337037e9f4be2b5460 | |
+ specs: | |
+ assert_valid_markup (0.6.6) | |
+ json | |
+ | |
+GIT | |
remote: git://github.com/rails/prototype_legacy_helper.git | |
revision: a2cd95c3e3c1a4f7a9566efdab5ce59c886cb05f | |
specs: | |
@@ -50,6 +57,7 @@ GEM | |
fastthread (1.0.7) | |
gem_plugin (0.2.3) | |
i18n (0.5.0) | |
+ json (1.6.5) | |
linecache (0.46) | |
rbx-require-relative (> 0.0.4) | |
machinist (1.0.6) | |
@@ -120,6 +128,7 @@ PLATFORMS | |
ruby | |
DEPENDENCIES | |
+ assert_valid_markup! | |
db_populate | |
dynamic_form | |
exception_notification | |
diff --git a/app/views/layouts/content.html.erb b/app/views/layouts/content.html.erb | |
--- a/app/views/layouts/content.html.erb | |
+++ b/app/views/layouts/content.html.erb | |
@@ -1,9 +1,8 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
+ <meta charset="UTF-8" /> | |
<title><%= t(:markus) %> - <%= controller.action_name %></title> | |
<%= stylesheet_link_tag 'main.css', :media => 'all' %> | |
<%= stylesheet_link_tag "livepipe/tabs.css", :media => 'all' %> | |
diff --git a/app/views/layouts/error.html.erb b/app/views/layouts/error.html.erb | |
--- a/app/views/layouts/error.html.erb | |
+++ b/app/views/layouts/error.html.erb | |
@@ -1,9 +1,8 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
+ <meta charset="UTF-8" /> | |
<title>Oh no!</title> | |
<%= stylesheet_link_tag 'main.css', :media => 'all' %> | |
<%= yield :head %> | |
diff --git a/app/views/layouts/main.html.erb b/app/views/layouts/main.html.erb | |
--- a/app/views/layouts/main.html.erb | |
+++ b/app/views/layouts/main.html.erb | |
@@ -1,9 +1,8 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
+ <meta charset="UTF-8" /> | |
<title><%= t(:markus) %> - <%= controller.action_name %></title> | |
<%= stylesheet_link_tag 'main.css', :media => 'all' %> | |
<%= yield :head %> | |
diff --git a/app/views/layouts/no_menu_header.html.erb b/app/views/layouts/no_menu_header.html.erb | |
--- a/app/views/layouts/no_menu_header.html.erb | |
+++ b/app/views/layouts/no_menu_header.html.erb | |
@@ -1,9 +1,8 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
+ <meta charset="UTF-8" /> | |
<title>Markus - <%= controller.action_name %></title> | |
<%= stylesheet_link_tag 'main.css', :media => 'all' %> | |
<%= stylesheet_link_tag 'content.css', :media => 'all' %> | |
diff --git a/app/views/layouts/plain.html.erb b/app/views/layouts/plain.html.erb | |
--- a/app/views/layouts/plain.html.erb | |
+++ b/app/views/layouts/plain.html.erb | |
@@ -1,9 +1,8 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
+ <meta charset="UTF-8" /> | |
<title>Test Result: <%= h(@test_result.filename) %></title> | |
<%= stylesheet_link_tag 'main.css', :media => 'all' %> | |
<%= yield :head %> | |
diff --git a/app/views/layouts/sanitized_html.erb b/app/views/layouts/sanitized_html.erb | |
--- a/app/views/layouts/sanitized_html.erb | |
+++ b/app/views/layouts/sanitized_html.erb | |
@@ -1,5 +1,4 @@ | |
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
+<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<body> | |
<pre><%= yield :layout %></pre> | |
diff --git a/app/views/notes/modal_dialogs/_notes_dialog.html.erb b/app/views/notes/modal_dialogs/_notes_dialog.html.erb | |
--- a/app/views/notes/modal_dialogs/_notes_dialog.html.erb | |
+++ b/app/views/notes/modal_dialogs/_notes_dialog.html.erb | |
@@ -11,12 +11,12 @@ | |
<div class="notes_existing"> | |
<% @notes.each do |note| %> | |
<strong><%= note.user.user_name %>: </strong> | |
- <br> | |
+ <br /> | |
<small><%=note.format_date%></small> | |
- <br> | |
+ <br /> | |
<%=note.notes_message %> | |
- <br> | |
- <br> | |
+ <br /> | |
+ <br /> | |
<% end %> | |
</div> | |
diff --git a/app/views/results/marker/_remark_request.html.erb b/app/views/results/marker/_remark_request.html.erb | |
--- a/app/views/results/marker/_remark_request.html.erb | |
+++ b/app/views/results/marker/_remark_request.html.erb | |
@@ -6,7 +6,7 @@ | |
<%= I18n.t("marker.remark_submitted_on") %>: | |
<% if submission.remark_request_timestamp %> | |
<%= I18n.l(submission.remark_request_timestamp, :format => :long_date) %> | |
- <% end %><br><br> | |
+ <% end %><br /><br /> | |
<%= h(submission.remark_request) %> | |
</div> | |
<div id="overall_remark_comment"> | |
diff --git a/app/views/shared/_assignments_dropdown_menu.html.erb b/app/views/shared/_assignments_dropdown_menu.html.erb | |
--- a/app/views/shared/_assignments_dropdown_menu.html.erb | |
+++ b/app/views/shared/_assignments_dropdown_menu.html.erb | |
@@ -10,7 +10,7 @@ | |
:action => 'new' %> | |
</li> | |
<li class="level2"> | |
- <div class="clear"></div><br></br> | |
+ <div class="clear" /><br /><br /> | |
</li> | |
<% end %> | |
diff --git a/config/environments/test.rb b/config/environments/test.rb | |
--- a/config/environments/test.rb | |
+++ b/config/environments/test.rb | |
@@ -28,7 +28,6 @@ Markus::Application.configure do | |
config.active_support.deprecation = :stderr | |
require 'ruby-debug' | |
- | |
################################################################### | |
# MarkUs SPECIFIC CONFIGURATION | |
# - use "/" as path separator no matter what OS server is running | |
diff --git a/public/javascripts/syntaxhighlighter/shCore.js b/public/javascripts/syntaxhighlighter/shCore.js | |
--- a/public/javascripts/syntaxhighlighter/shCore.js | |
+++ b/public/javascripts/syntaxhighlighter/shCore.js | |
@@ -271,16 +271,16 @@ dp.sh.Highlighter.prototype.AddBit = function(str, css) | |
str = str.replace(/</g, '<'); | |
// str = str.replace(/</g, '<'); | |
// str = str.replace(/>/g, '>'); | |
- str = str.replace(/\n/gm, ' <br>'); | |
+ str = str.replace(/\n/gm, ' <br />'); | |
- // when adding a piece of code, check to see if it has line breaks in it | |
+ // when adding a piece of code, check to see if it has line breaks in it | |
// and if it does, wrap individual line breaks with span tags | |
if(css != null) | |
{ | |
if((/br/gi).test(str)) | |
{ | |
- var lines = str.split(' <br>'); | |
- | |
+ var lines = str.split(' <br />'); | |
+ | |
for(var i = 0; i < lines.length; i++) | |
{ | |
span = this.CreateElement('SPAN'); | |
diff --git a/test/functional/admins_controller_test.rb b/test/functional/admins_controller_test.rb | |
--- a/test/functional/admins_controller_test.rb | |
+++ b/test/functional/admins_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -7,6 +6,7 @@ require 'shoulda' | |
require 'admins_controller' | |
class AdminsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/annotation_categories_controller_test.rb b/test/functional/annotation_categories_controller_test.rb | |
--- a/test/functional/annotation_categories_controller_test.rb | |
+++ b/test/functional/annotation_categories_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -7,6 +6,7 @@ require 'shoulda' | |
require 'mocha' | |
class AnnotationCategoriesControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
setup do | |
clear_fixtures | |
diff --git a/test/functional/annotations_controller_test.rb b/test/functional/annotations_controller_test.rb | |
--- a/test/functional/annotations_controller_test.rb | |
+++ b/test/functional/annotations_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -7,6 +6,7 @@ require 'machinist' | |
class AnnotationsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/assignments_controller_test.rb b/test/functional/assignments_controller_test.rb | |
--- a/test/functional/assignments_controller_test.rb | |
+++ b/test/functional/assignments_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -9,6 +8,7 @@ require 'mocha' | |
require 'time-warp' | |
class AssignmentsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
@controller = AssignmentsController.new | |
diff --git a/test/functional/authenticated_controller_test.rb b/test/functional/authenticated_controller_test.rb | |
--- a/test/functional/authenticated_controller_test.rb | |
+++ /dev/null | |
@@ -1,31 +0,0 @@ | |
-require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
- | |
-# Test class to extend when creating tests for this application; | |
-# overrides common request types with authentication | |
-class AuthenticatedControllerTest < ActionController::TestCase | |
- | |
- # Performs GET request as the supplied user for authentication | |
- def get_as(user, action, params=nil, flash=nil) | |
- session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
- get action, params, session_vars, flash | |
- end | |
- | |
- # Performs POST request as the supplied user for authentication | |
- def post_as(user, action, params=nil, flash=nil) | |
- session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
- post action, params, session_vars, flash | |
- end | |
- | |
- # Performs PUT request as the supplied user for authentication | |
- def put_as(user, action, params=nil, flash=nil) | |
- session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
- put action, params, session_vars, flash | |
- end | |
- | |
- | |
- # Performs DELETE request as the supplied user for authentication | |
- def delete_as(user, action, params=nil, flash=nil) | |
- session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
- delete action, params, session_vars, flash | |
- end | |
-end | |
diff --git a/test/functional/automated_tests_controller_test.rb b/test/functional/automated_tests_controller_test.rb | |
--- a/test/functional/automated_tests_controller_test.rb | |
+++ b/test/functional/automated_tests_controller_test.rb | |
@@ -1,6 +1,5 @@ | |
# Using machinist | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -8,6 +7,7 @@ require 'shoulda' | |
class AutomatedTestsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/flexible_criteria_controller_test.rb b/test/functional/flexible_criteria_controller_test.rb | |
--- a/test/functional/flexible_criteria_controller_test.rb | |
+++ b/test/functional/flexible_criteria_controller_test.rb | |
@@ -1,8 +1,9 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
+require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require 'shoulda' | |
require 'mocha' | |
class FlexibleCriteriaControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
fixtures :all | |
diff --git a/test/functional/grade_entry_forms_controller_test.rb b/test/functional/grade_entry_forms_controller_test.rb | |
--- a/test/functional/grade_entry_forms_controller_test.rb | |
+++ b/test/functional/grade_entry_forms_controller_test.rb | |
@@ -1,9 +1,9 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
require 'shoulda' | |
require 'will_paginate' | |
class GradeEntryFormsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/graders_controller_test.rb b/test/functional/graders_controller_test.rb | |
--- a/test/functional/graders_controller_test.rb | |
+++ b/test/functional/graders_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -7,6 +6,7 @@ require 'mocha' | |
require 'fastercsv' | |
class GradersControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/groups_controller_csv_upload_test.rb b/test/functional/groups_controller_csv_upload_test.rb | |
--- a/test/functional/groups_controller_csv_upload_test.rb | |
+++ b/test/functional/groups_controller_csv_upload_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -14,6 +13,8 @@ include ActionDispatch::TestProcess | |
# setup of assignment and group sizes is used. This test suite uses | |
# SubversionRepository instead of MemoryRepository. | |
class GroupsControllerCsvUploadTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
+ | |
context "An authenticated and authorized admin" do | |
# We need to use SubversionRepository for this test suite | |
diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb | |
--- a/test/functional/groups_controller_test.rb | |
+++ b/test/functional/groups_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
require 'shoulda' | |
@@ -8,6 +7,7 @@ require 'fastercsv' | |
## TODO refactor this code | |
class GroupsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/main_controller_test.rb b/test/functional/main_controller_test.rb | |
--- a/test/functional/main_controller_test.rb | |
+++ b/test/functional/main_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
require 'shoulda' | |
require 'machinist' | |
@@ -11,6 +10,7 @@ class MainController | |
end | |
class MainControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
# TODO need to change username and password for valid logins when | |
# actual authentication is in place (i.e. when User.verify is implemented) | |
diff --git a/test/functional/notes_controller_test.rb b/test/functional/notes_controller_test.rb | |
--- a/test/functional/notes_controller_test.rb | |
+++ b/test/functional/notes_controller_test.rb | |
@@ -3,10 +3,10 @@ | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require 'shoulda' | |
class NotesControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/results_controller_test.rb b/test/functional/results_controller_test.rb | |
--- a/test/functional/results_controller_test.rb | |
+++ b/test/functional/results_controller_test.rb | |
@@ -1,10 +1,10 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
require 'shoulda' | |
require 'mocha' | |
class ResultsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/role_switching_test.rb b/test/functional/role_switching_test.rb | |
--- a/test/functional/role_switching_test.rb | |
+++ b/test/functional/role_switching_test.rb | |
@@ -1,10 +1,10 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require 'shoulda' | |
require 'machinist' | |
require 'mocha' | |
class RoleSwitchingTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
# Required for REMOTE_USER config mocking | |
include MarkusConfigurator | |
diff --git a/test/functional/rubrics_controller_test.rb b/test/functional/rubrics_controller_test.rb | |
--- a/test/functional/rubrics_controller_test.rb | |
+++ b/test/functional/rubrics_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__),'..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -8,6 +7,7 @@ require 'mocha' | |
require 'machinist' | |
class RubricsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/sections_controller_test.rb b/test/functional/sections_controller_test.rb | |
--- a/test/functional/sections_controller_test.rb | |
+++ b/test/functional/sections_controller_test.rb | |
@@ -1,6 +1,5 @@ | |
# Using machinist | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__),'..', 'test_helper') | |
require File.join(File.dirname(__FILE__),'..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__),'..', 'blueprints', 'helper') | |
@@ -8,6 +7,7 @@ require 'shoulda' | |
class SectionsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/students_controller_test.rb b/test/functional/students_controller_test.rb | |
--- a/test/functional/students_controller_test.rb | |
+++ b/test/functional/students_controller_test.rb | |
@@ -1,8 +1,7 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
class StudentsControllerTest < AuthenticatedControllerTest | |
- | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/functional/submissions_controller_test.rb b/test/functional/submissions_controller_test.rb | |
--- a/test/functional/submissions_controller_test.rb | |
+++ b/test/functional/submissions_controller_test.rb | |
@@ -1,4 +1,3 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'test_helper') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'blueprints') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
@@ -7,6 +6,8 @@ require 'shoulda' | |
require 'mocha' | |
class SubmissionsControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
+ | |
def setup | |
clear_fixtures | |
end | |
diff --git a/test/functional/tas_controller_test.rb b/test/functional/tas_controller_test.rb | |
--- a/test/functional/tas_controller_test.rb | |
+++ b/test/functional/tas_controller_test.rb | |
@@ -1,7 +1,7 @@ | |
-require File.join(File.dirname(__FILE__), 'authenticated_controller_test') | |
require File.join(File.dirname(__FILE__), '..', 'blueprints', 'helper') | |
class TasControllerTest < AuthenticatedControllerTest | |
+ assert_all_valid_markup(:ignore_no_doctype => true) | |
def setup | |
clear_fixtures | |
diff --git a/test/test_helper.rb b/test/test_helper.rb | |
--- a/test/test_helper.rb | |
+++ b/test/test_helper.rb | |
@@ -1,5 +1,8 @@ | |
ENV["RAILS_ENV"] = "test" | |
-require File.expand_path('../../config/environment', __FILE__) | |
+# Set to false to turn off HTML_VALIDATION | |
+# Note that w3c validation requires an inet connection | |
+HTML_VALIDATION = true | |
+require File.expand_path( File.join('..', '..', 'config', 'environment'), __FILE__) | |
require 'rails/test_help' | |
require 'mocha' | |
require 'sham' | |
@@ -129,3 +132,32 @@ class ActiveRecord::Base | |
end | |
end | |
+ | |
+# Test class to extend when creating tests for this application; | |
+# overrides common request types with authentication | |
+class AuthenticatedControllerTest < ActionController::TestCase | |
+ # Performs GET request as the supplied user for authentication | |
+ def get_as(user, action, params=nil, flash=nil) | |
+ session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
+ get action, params, session_vars, flash | |
+ end | |
+ | |
+ # Performs POST request as the supplied user for authentication | |
+ def post_as(user, action, params=nil, flash=nil) | |
+ session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
+ post action, params, session_vars, flash | |
+ end | |
+ | |
+ # Performs PUT request as the supplied user for authentication | |
+ def put_as(user, action, params=nil, flash=nil) | |
+ session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
+ put action, params, session_vars, flash | |
+ end | |
+ | |
+ | |
+ # Performs DELETE request as the supplied user for authentication | |
+ def delete_as(user, action, params=nil, flash=nil) | |
+ session_vars = { 'uid' => user.id, 'timeout' => 3.days.from_now } | |
+ delete action, params, session_vars, flash | |
+ end | |
+end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment