Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 2598 Bytes
1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | require 'content_state/factory' |
3 | |
4 | class ContentState::FactoryTest < Test::Unit::TestCase |
5 | def test_correctly_builds_new_state |
6 | [:new, 'new', 'content_state/new', 'New', |
7 | 'ContentState::New', nil].each do |memento| |
8 | assert_instance_of(ContentState::New, |
9 | ContentState::Factory.new(memento)) |
10 | end |
11 | end |
12 | |
13 | def test_correctly_builds_draft_state |
14 | assert_instance_of(ContentState::Draft, |
15 | ContentState::Factory.new('draft')) |
16 | end |
17 | |
18 | def test_correctly_builds_publication_pending_state |
19 | assert_instance_of(ContentState::PublicationPending, |
20 | ContentState::Factory.new('publication_pending')) |
21 | end |
22 | |
23 | def test_correct_builds_published_state |
24 | assert_instance_of(ContentState::Published, |
25 | ContentState::Factory.new('published')) |
26 | end |
27 | |
28 | def test_cant_make_state_directly |
29 | assert_raise(NoMethodError) do |
30 | ContentState::Base.new |
31 | end |
32 | end |
33 | |
34 | def test_write_new_state |
35 | content = MockContent.new(true) |
36 | |
37 | ContentState::New.instance.enter_hook(content) |
38 | |
39 | assert_equal false, content.published? |
40 | assert_nil content.published_at |
41 | end |
42 | |
43 | def test_write_publication_pending_state |
44 | content = MockContent.new(true, true, 1.hour.from_now) |
45 | ContentState::PublicationPending.instance.enter_hook(content) |
46 | assert_equal false, content.published? |
47 | assert content.published_at > Time.now |
48 | end |
49 | |
50 | def test_write_draft_state |
51 | content = MockContent.new(true, nil, nil) |
52 | ContentState::Draft.instance.enter_hook(content) |
53 | assert_equal false, content.published |
54 | assert_nil content.published_at |
55 | end |
56 | |
57 | def test_write_just_published_state |
58 | content = MockContent.new(true, nil, nil) |
59 | ContentState::JustPublished.instance.enter_hook(content) |
60 | assert_equal true, content.published |
61 | assert content.published_at <= Time.now |
62 | |
63 | published_at = 10.minutes.ago |
64 | content = MockContent.new(true, nil, published_at) |
65 | ContentState::JustPublished.instance.enter_hook(content) |
66 | assert_equal true, content.published |
67 | assert_equal published_at, content.published_at |
68 | end |
69 | |
70 | def test_write_published_state |
71 | content = MockContent.new |
72 | assert ContentState::Published.instance.enter_hook(content) |
73 | assert_equal true, content.published |
74 | end |
75 | |
76 | class MockContent < Struct.new(:new_record, :published, :published_at) |
77 | alias_method :new_record?, :new_record |
78 | alias_method :published?, :published |
79 | |
80 | def changed |
81 | @changed = true |
82 | end |
83 | |
84 | def changed? |
85 | @changed |
86 | end |
87 | end |
88 | end |