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:
- 1789 Bytes
1 | require File.dirname(__FILE__) + '/../spec_helper' |
2 | |
3 | describe PagePart do |
4 | dataset :home_page |
5 | |
6 | test_helper :validations |
7 | |
8 | before do |
9 | @original_filter = Radiant::Config['defaults.page.filter'] |
10 | @part = @model = PagePart.new(page_part_params) |
11 | end |
12 | |
13 | after do |
14 | Radiant::Config['defaults.page.filter'] = @original_filter |
15 | end |
16 | |
17 | it "should take the filter from the default filter" do |
18 | Radiant::Config['defaults.page.filter'] = "Textile" |
19 | part = PagePart.new :name => 'new-part' |
20 | part.filter_id.should == "Textile" |
21 | end |
22 | |
23 | it "shouldn't override existing page_parts filters with the default filter" do |
24 | part = PagePart.find(:first, :conditions => {:filter_id => nil}) |
25 | Radiant::Config['defaults.page.filter'] = "Textile" |
26 | part.reload |
27 | part.filter_id.should_not == "Textile" |
28 | end |
29 | |
30 | it 'should validate length of' do |
31 | { |
32 | :name => 100, |
33 | :filter_id => 25 |
34 | }.each do |field, max| |
35 | assert_invalid field, ('this must not be longer than %d characters' % max), 'x' * (max + 1) |
36 | assert_valid field, 'x' * max |
37 | end |
38 | end |
39 | |
40 | it 'should validate presence of' do |
41 | [:name].each do |field| |
42 | assert_invalid field, 'this must not be blank', '', ' ', nil |
43 | end |
44 | end |
45 | |
46 | it 'should validate numericality of' do |
47 | [:id, :page_id].each do |field| |
48 | assert_valid field, '1', '2' |
49 | assert_invalid field, 'this must be a number', 'abcd', '1,2', '1.3' |
50 | end |
51 | end |
52 | end |
53 | |
54 | describe PagePart, 'filter' do |
55 | dataset :markup_pages |
56 | |
57 | specify 'getting and setting' do |
58 | @part = page_parts(:textile_body) |
59 | original = @part.filter |
60 | original.should be_kind_of(TextileFilter) |
61 | |
62 | @part.filter.should equal(original) |
63 | |
64 | @part.filter_id = 'Markdown' |
65 | @part.filter.should be_kind_of(MarkdownFilter) |
66 | end |
67 | end |