Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 2471 Bytes
1 | ENV["RAILS_ENV"] = "test" |
2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") |
3 | require 'test_help' |
4 | |
5 | User.salt = 'change-me' |
6 | |
7 | class Test::Unit::TestCase |
8 | # Turn off transactional fixtures if you're working with MyISAM tables in MySQL |
9 | self.use_transactional_fixtures = true |
10 | |
11 | # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) |
12 | self.use_instantiated_fixtures = false |
13 | |
14 | # Add more helper methods to be used by all tests here... |
15 | def assert_xml(xml) |
16 | assert_nothing_raised do |
17 | assert REXML::Document.new(xml) |
18 | end |
19 | end |
20 | |
21 | # Add more helper methods to be used by all tests here... |
22 | def find_tag_in(source, conditions) |
23 | HTML::Document.new(source).find(conditions) |
24 | end |
25 | |
26 | def assert_tag_in(source, opts) |
27 | tag = find_tag_in(source, opts) |
28 | assert tag, "expected tag, but no tag found matching #{opts.inspect} in:\n#{source.inspect}" |
29 | end |
30 | |
31 | def assert_no_tag_in(source, opts) |
32 | tag = find_tag_in(source, opts) |
33 | assert !tag, "expected no tag, but tag found matching #{opts.inspect} in:\n#{source.inspect}" |
34 | end |
35 | |
36 | def get_xpath(xpath) |
37 | rexml = REXML::Document.new(@response.body) |
38 | assert rexml |
39 | |
40 | REXML::XPath.match(rexml, xpath) |
41 | end |
42 | |
43 | def assert_xpath(xpath, msg=nil) |
44 | assert !(get_xpath(xpath).empty?), msg |
45 | end |
46 | |
47 | def assert_not_xpath(xpath, msg=nil) |
48 | assert get_xpath(xpath).empty?, msg |
49 | end |
50 | |
51 | def this_blog |
52 | Blog.default || Blog.create! |
53 | end |
54 | end |
55 | |
56 | # Extend HTML::Tag to understand URI matching |
57 | begin |
58 | require 'html/document' |
59 | rescue LoadError |
60 | require 'action_controller/vendor/html-scanner/html/document' |
61 | end |
62 | require 'uri' |
63 | |
64 | class HTML::Tag |
65 | private |
66 | |
67 | alias :match_condition_orig :match_condition unless private_method_defined? :match_condition_orig |
68 | def match_condition(value, condition) |
69 | case condition |
70 | when URI |
71 | compare_uri(URI.parse(value), condition.dup) rescue nil |
72 | else |
73 | match_condition_orig(value, condition) |
74 | end |
75 | end |
76 | |
77 | def compare_uri(value, condition) |
78 | valQuery = value.query |
79 | condQuery = condition.query |
80 | value.query = nil |
81 | condition.query = nil |
82 | value == condition && compare_query(valQuery, condQuery) |
83 | end |
84 | |
85 | def compare_query(value, condition) |
86 | def create_query_hash(str) |
87 | str.split('&').inject({}) do |h,v| |
88 | key, value = v.split('=') |
89 | h[key] = value |
90 | h |
91 | end |
92 | end |
93 | create_query_hash(value) == create_query_hash(condition) |
94 | end |
95 | end |