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:
- 3409 Bytes
1 | require File.dirname(__FILE__) + '/../spec_helper' |
2 | |
3 | # http://blog.davidchelimsky.net/articles/2007/06/03/oxymoron-testing-behaviour-of-abstractions |
4 | describe ApplicationController do |
5 | dataset :users |
6 | |
7 | it 'should include LoginSystem' do |
8 | ApplicationController.included_modules.should include(LoginSystem) |
9 | end |
10 | |
11 | it 'should initialize config' do |
12 | controller.config.should == Radiant::Config |
13 | end |
14 | |
15 | it 'should set the current user for the UserActionObserver' do |
16 | ApplicationController.filter_chain.find(:set_current_user).should_not be_nil |
17 | UserActionObserver.current_user = nil |
18 | controller.should_receive(:current_user).and_return(users(:admin)) |
19 | controller.send :set_current_user |
20 | UserActionObserver.current_user.should == users(:admin) |
21 | end |
22 | |
23 | it 'should initialize the javascript and stylesheets arrays' do |
24 | ApplicationController.filter_chain.find(:set_javascripts_and_stylesheets).should_not be_nil |
25 | controller.send :set_javascripts_and_stylesheets |
26 | controller.send(:instance_variable_get, :@javascripts).should_not be_nil |
27 | controller.send(:instance_variable_get, :@javascripts).should be_instance_of(Array) |
28 | controller.send(:instance_variable_get, :@stylesheets).should_not be_nil |
29 | controller.send(:instance_variable_get, :@stylesheets).should be_instance_of(Array) |
30 | end |
31 | |
32 | it "should include stylesheets" do |
33 | controller.send :set_javascripts_and_stylesheets |
34 | controller.include_stylesheet('test').should include('test') |
35 | end |
36 | |
37 | it "should include javascripts" do |
38 | controller.send :set_javascripts_and_stylesheets |
39 | controller.include_javascript('test').should include('test') |
40 | end |
41 | |
42 | describe 'self.template_name' do |
43 | it "should return 'index' when the controller action_name is 'index'" do |
44 | controller.stub!(:action_name).and_return('index') |
45 | controller.template_name.should == 'index' |
46 | end |
47 | ['new', 'create'].each do |action| |
48 | it "should return 'new' when the action_name is #{action}" do |
49 | controller.stub!(:action_name).and_return(action) |
50 | controller.template_name.should == 'new' |
51 | end |
52 | end |
53 | ['edit', 'update'].each do |action| |
54 | it "should return 'edit' when the action_name is #{action}" do |
55 | controller.stub!(:action_name).and_return(action) |
56 | controller.template_name.should == 'edit' |
57 | end |
58 | end |
59 | ['remove', 'destroy'].each do |action| |
60 | it "should return 'remove' when the action_name is #{action}" do |
61 | controller.stub!(:action_name).and_return(action) |
62 | controller.template_name.should == 'remove' |
63 | end |
64 | end |
65 | it "should return 'show' when the action_name is show" do |
66 | controller.stub!(:action_name).and_return('show') |
67 | controller.template_name.should == 'show' |
68 | end |
69 | it "should return the action_name when the action_name is a non-standard name" do |
70 | controller.stub!(:action_name).and_return('other') |
71 | controller.template_name.should == 'other' |
72 | end |
73 | end |
74 | |
75 | describe "set_timezone" do |
76 | it "should use Radiant::Config['local.timezone']" do |
77 | Radiant::Config['local.timezone'] = 'Kuala Lumpur' |
78 | controller.send(:set_timezone) |
79 | Time.zone.name.should == 'Kuala Lumpur' |
80 | end |
81 | |
82 | it "should default to config.time_zone" do |
83 | Radiant::Config.initialize_cache # to clear out setting from previous tests |
84 | controller.send(:set_timezone) |
85 | Time.zone.name.should == 'UTC' |
86 | end |
87 | end |
88 | end |