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:
- 3469 Bytes
1 | require File.dirname(__FILE__) + '/../../spec_helper' |
2 | |
3 | describe Admin::ReferencesHelper do |
4 | describe "determining the page class" do |
5 | before :each do |
6 | helper.send(:instance_variable_set, :@page_class, nil) |
7 | end |
8 | |
9 | it "should return Page when the class_name was not sent" do |
10 | helper.class_of_page.should == Page |
11 | end |
12 | |
13 | it "should return the named class when sent class_name" do |
14 | params[:class_name] = "FileNotFoundPage" |
15 | helper.class_of_page.should == FileNotFoundPage |
16 | end |
17 | |
18 | it "should return Page when the class_name is blank" do |
19 | params[:class_name] = '' |
20 | helper.class_of_page.should == Page |
21 | end |
22 | end |
23 | |
24 | describe "determining the filter" do |
25 | before :each do |
26 | helper.send(:instance_variable_set, :@filter, nil) |
27 | end |
28 | |
29 | it "should return nil when no filter is set" do |
30 | helper.filter.should be_nil |
31 | end |
32 | |
33 | it "should return the filter object for the named filter" do |
34 | params[:filter_name] = "Textile" |
35 | helper.filter.should == TextileFilter |
36 | end |
37 | |
38 | it "should return nil when the set filter is blank" do |
39 | params[:filter_name] = ' ' |
40 | helper.filter.should be_nil |
41 | end |
42 | end |
43 | |
44 | describe "determining the display name" do |
45 | describe "when getting a filter reference" do |
46 | before :each do |
47 | helper.send(:instance_variable_set, :@filter, nil) |
48 | params[:type] = 'filters' |
49 | end |
50 | |
51 | it "should return the name of the set filter" do |
52 | params[:filter_name] = "Textile" |
53 | helper._display_name.should == "Textile" |
54 | end |
55 | |
56 | it "should return <none> when no filter is set" do |
57 | params[:filter_name] = nil |
58 | helper._display_name.should == "<none>" |
59 | end |
60 | end |
61 | |
62 | describe "when getting a tag reference" do |
63 | before :each do |
64 | helper.send(:instance_variable_set, :@page_class, nil) |
65 | params[:type] = 'tags' |
66 | end |
67 | |
68 | it "should return the display name of the page class" do |
69 | params[:class_name] = "FileNotFoundPage" |
70 | helper._display_name.should == "File Not Found" |
71 | end |
72 | |
73 | it "should return Page when <normal> is chosen" do |
74 | params[:class_name] = nil |
75 | helper._display_name.should == "Page" |
76 | end |
77 | end |
78 | end |
79 | |
80 | describe "rendering the filter reference" do |
81 | before :each do |
82 | helper.send(:instance_variable_set, :@filter, nil) |
83 | params[:type] = 'filters' |
84 | params[:filter_name] = 'Textile' |
85 | end |
86 | |
87 | it "should render a helpful message when the description is blank" do |
88 | TextileFilter.should_receive(:description).and_return('') |
89 | helper.filter_reference.should == "There is no documentation on this filter." |
90 | end |
91 | |
92 | it "should render the filter's description when available" do |
93 | helper.filter_reference.should == TextileFilter.description |
94 | end |
95 | |
96 | it "should render a helpful message when no filter is selected" do |
97 | params[:filter_name] = nil |
98 | helper.filter_reference.should == "There is no filter on the current page part." |
99 | end |
100 | end |
101 | |
102 | describe "rendering the tag reference" do |
103 | before :each do |
104 | helper.send(:instance_variable_set, :@page_class, nil) |
105 | params[:type] = 'tags' |
106 | params[:class_name] = '' |
107 | end |
108 | |
109 | it "should render the tag reference partial for each tag description" do |
110 | count = Page.tag_descriptions.size |
111 | helper.should_receive(:render).exactly(count).times.and_return("desc") |
112 | helper.tag_reference.should == "desc" * count |
113 | end |
114 | end |
115 | end |