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