Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 2190 Bytes
1 | module RenderTestHelper |
2 | |
3 | def assert_renders(expected, input, url = nil, host = nil) |
4 | output = get_render_output(input, url, host) |
5 | message = "<#{expected.inspect}> expected but was <#{output.inspect}>" |
6 | assert_block(message) { expected == output } |
7 | end |
8 | |
9 | def assert_render_match(regexp, input, url = nil) |
10 | regexp = Regexp.new(regexp) if regexp.kind_of? String |
11 | output = get_render_output(input, url) |
12 | message = "<#{output.inspect}> expected to be =~ <#{regexp.inspect}>" |
13 | assert_block(message) { output =~ regexp } |
14 | end |
15 | |
16 | def assert_render_error(expected_error_message, input, url = nil) |
17 | output = get_render_output(input, url) |
18 | message = "expected error message <#{expected_error_message.inspect}> expected but none was thrown" |
19 | assert_block(message) { false } |
20 | rescue => e |
21 | message = "expected error message <#{expected_error_message.inspect}> but was <#{e.message.inspect}>" |
22 | assert_block(message) { expected_error_message === e.message } |
23 | end |
24 | |
25 | def assert_headers(expected_headers, url = nil) |
26 | setup_page(url) |
27 | headers = @page.headers |
28 | message = "<#{expected_headers.inspect}> expected but was <#{headers.inspect}>" |
29 | assert_block(message) { expected_headers == headers } |
30 | end |
31 | |
32 | def assert_page_renders(page_name, expected, message = nil) |
33 | page = pages(page_name) |
34 | output = page.render |
35 | message = "<#{expected.inspect}> expected, but was <#{output.inspect}>" |
36 | assert_block(message) { expected == output } |
37 | end |
38 | |
39 | def assert_snippet_renders(snippet_name, expected, message = nil) |
40 | snippet = snippets(snippet_name) |
41 | output = @page.render_snippet(snippet) |
42 | message = "<#{expected.inspect}> expected, but was <#{output.inspect}>" |
43 | assert_block(message) { expected == output } |
44 | end |
45 | |
46 | private |
47 | |
48 | def get_render_output(input, url, host = nil) |
49 | setup_page(url, host) |
50 | @page.send(:parse, input) |
51 | end |
52 | |
53 | def setup_page(url = nil, host = nil) |
54 | @page.request = ActionController::TestRequest.new |
55 | @page.request.request_uri = (url || @page.url) |
56 | @page.request.host = host || "testhost.tld" |
57 | @page.response = ActionController::TestResponse.new |
58 | end |
59 | |
60 | end |