Added a check for XML well-formedness to assert_success
(optional, enabled by uncommenting a variable at the top of test_helper.rb); corrected some malformed templates (not all yet)
This commit is contained in:
parent
203405c4dc
commit
c8e459cbb0
|
@ -8,12 +8,12 @@
|
||||||
<p>
|
<p>
|
||||||
File to upload:
|
File to upload:
|
||||||
<br/>
|
<br/>
|
||||||
<input type="file" name="file" size="40">
|
<input type="file" name="file" size="40" />
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" value="Update"> as
|
<input type="submit" value="Update" /> as
|
||||||
<input type="text" name="author" id="authorName" value="<%= @author %>"
|
<input type="text" name="author" id="authorName" value="<%= @author %>"
|
||||||
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true">
|
onClick="this.value == 'AnonymousCoward' ? this.value = '' : true" />
|
||||||
<% if @page %>
|
<% if @page %>
|
||||||
| <a href="../file/">Cancel</a> <small>(unlocks page)</small>
|
| <a href="../file/">Cancel</a> <small>(unlocks page)</small>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -17,7 +17,7 @@ end
|
||||||
<%= list_item "Authors", "../authors/", "Who wrote what" %> |
|
<%= list_item "Authors", "../authors/", "Who wrote what" %> |
|
||||||
<%= list_item "Feeds", "../feeds/", "Subscribe to changes by RSS" %> |
|
<%= list_item "Feeds", "../feeds/", "Subscribe to changes by RSS" %> |
|
||||||
<%= list_item "Export", "../export/", "Download a zip with all the pages in this wiki", "X" %> |
|
<%= list_item "Export", "../export/", "Download a zip with all the pages in this wiki", "X" %> |
|
||||||
<input type="text" id="searchField" name="query" style="font-size: 10px" value="Search" onClick="this.value == 'Search' ? this.value = '' : true">
|
<input type="text" id="searchField" name="query" style="font-size: 10px" value="Search" onClick="this.value == 'Search' ? this.value = '' : true" />
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= list_item "Home Page", "../published/HomePage", "Home, Sweet Home", "H" %> |
|
<%= list_item "Home Page", "../published/HomePage", "Home, Sweet Home", "H" %> |
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();">
|
Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();" />
|
||||||
Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();">
|
Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();" />
|
||||||
<i>(Letters & digits only)</i>
|
<i>(Letters & digits only)</i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -30,24 +30,17 @@
|
||||||
|
|
||||||
Color:
|
Color:
|
||||||
<select name="color">
|
<select name="color">
|
||||||
<%= html_options({ "Green" => "008B26", "Purple" => "504685", "Red" => "DA0006", "Orange" => "FA6F00", "Grey" => "8BA2B0" },
|
<%= html_options({ "Green" => "008B26", "Purple" => "504685", "Red" => "DA0006", "Orange" => "FA6F00", "Grey" => "8BA2B0" }, @web.color) %>
|
||||||
@web.color) %>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<small>
|
<small>
|
||||||
|
<input type="checkbox" name="safe_mode"<%= " CHECKED" if @web.safe_mode %>> Safe mode
|
||||||
<input type="checkbox" name="safe_mode"<%= " CHECKED" if @web.safe_mode %>> Safe mode
|
|
||||||
|
<input type="checkbox" name="brackets_only"<%= " CHECKED" if @web.brackets_only %>> Brackets only
|
||||||
|
|
||||||
|
<input type="checkbox" name="count_pages"<%= " CHECKED" if @web.count_pages %>> Count pages
|
||||||
<input type="checkbox" name="brackets_only"<%= " CHECKED" if @web.brackets_only %>> Brackets only
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<input type="checkbox" name="count_pages"<%= " CHECKED" if @web.count_pages %>> Count pages
|
|
||||||
|
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<textarea id="additionalStyle" style="display: none; margin-top: 10px; margin-bottom: 5px; width: 560px; height: 200px" name="additional_style"><%= @web.additional_style %></textarea>
|
<textarea id="additionalStyle" style="display: none; margin-top: 10px; margin-bottom: 5px; width: 560px; height: 200px" name="additional_style"><%= @web.additional_style %></textarea>
|
||||||
|
@ -114,23 +107,23 @@ function validateSetup() {
|
||||||
alert("You must enter the system password");
|
alert("You must enter the system password");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById('name').value == "") {
|
if (document.getElementById('name').value == "") {
|
||||||
alert("You must pick a name for the web");
|
alert("You must pick a name for the web");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById('address').value == "") {
|
if (document.getElementById('address').value == "") {
|
||||||
alert("You must pick an address for the web");
|
alert("You must pick an address for the web");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById('password').value != "" &&
|
if (document.getElementById('password').value != "" &&
|
||||||
document.getElementById('password').value != document.getElementById('password_check').value) {
|
document.getElementById('password').value != document.getElementById('password_check').value) {
|
||||||
alert("The password and its verification doesn't match");
|
alert("The password and its verification doesn't match");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require File.dirname(__FILE__) + '/../config/environment'
|
require File.dirname(__FILE__) + '/../config/environment'
|
||||||
require 'application'
|
require 'application'
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'action_controller/test_process'
|
require 'action_controller/test_process'
|
||||||
|
|
||||||
|
# Uncomment this variable to have assert_success check that response bodies are valid XML
|
||||||
|
# $validate_xml_in_assert_success = true
|
||||||
|
|
||||||
# Convenient setup method for Test::Unit::TestCase
|
# Convenient setup method for Test::Unit::TestCase
|
||||||
class Test::Unit::TestCase
|
class Test::Unit::TestCase
|
||||||
|
|
||||||
|
@ -93,3 +95,21 @@ module ChunkMatch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if defined? $validate_xml_in_assert_success and $validate_xml_in_assert_success == true
|
||||||
|
module Test
|
||||||
|
module Unit
|
||||||
|
module Assertions
|
||||||
|
alias :__assert_success_before_ovverride_by_instiki :assert_success
|
||||||
|
def assert_success
|
||||||
|
__assert_success_before_ovverride_by_instiki
|
||||||
|
if @response.body.kind_of?(Proc)
|
||||||
|
body = @response.body.call
|
||||||
|
else
|
||||||
|
body = @response.body
|
||||||
|
end
|
||||||
|
assert_nothing_raised(body) { REXML::Document.new(body) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue