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:
- 1602 Bytes
1 | require File.join(File.dirname(__FILE__), 'test_helper') |
2 | |
3 | class RadiusContextTest < Test::Unit::TestCase |
4 | include RadiusTestHelper |
5 | |
6 | def setup |
7 | @context = new_context |
8 | end |
9 | |
10 | def test_initialize |
11 | @context = Radius::Context.new |
12 | end |
13 | |
14 | def test_initialize_with_block |
15 | @context = Radius::Context.new do |c| |
16 | assert_kind_of Radius::Context, c |
17 | c.define_tag('test') { 'just a test' } |
18 | end |
19 | assert_not_equal Hash.new, @context.definitions |
20 | end |
21 | |
22 | def test_with |
23 | got = @context.with do |c| |
24 | assert_equal @context, c |
25 | end |
26 | assert_equal @context, got |
27 | end |
28 | |
29 | def test_render_tag |
30 | define_tag "hello" do |tag| |
31 | "Hello #{tag.attr['name'] || 'World'}!" |
32 | end |
33 | assert_render_tag_output 'Hello World!', 'hello' |
34 | assert_render_tag_output 'Hello John!', 'hello', 'name' => 'John' |
35 | end |
36 | |
37 | def test_render_tag__undefined_tag |
38 | e = assert_raises(Radius::UndefinedTagError) { @context.render_tag('undefined_tag') } |
39 | assert_equal "undefined tag `undefined_tag'", e.message |
40 | end |
41 | |
42 | def test_tag_missing |
43 | class << @context |
44 | def tag_missing(tag, attr, &block) |
45 | "undefined tag `#{tag}' with attributes #{attr.inspect}" |
46 | end |
47 | end |
48 | |
49 | text = '' |
50 | expected = %{undefined tag `undefined_tag' with attributes {"cool"=>"beans"}} |
51 | assert_nothing_raised { text = @context.render_tag('undefined_tag', 'cool' => 'beans') } |
52 | assert_equal expected, text |
53 | end |
54 | |
55 | private |
56 | |
57 | def assert_render_tag_output(output, *render_tag_params) |
58 | assert_equal output, @context.render_tag(*render_tag_params) |
59 | end |
60 | |
61 | end |