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:
- 2997 Bytes
1 | require File.dirname(__FILE__) + "/../spec_helper" |
2 | |
3 | describe TaskSupport do |
4 | describe "self.config_export" do |
5 | before do |
6 | @yaml_file = "#{Rails.root}/tmp/config/radiant_config.yml" |
7 | FileUtils.rm_rf(File.dirname(@yaml_file)) |
8 | Radiant::Config['test_data'] = 'test string' |
9 | File.exist?(@yaml_file).should be_false |
10 | end |
11 | it "should create a YAML file in config/radiant_config.yml" do |
12 | TaskSupport.config_export(@yaml_file) |
13 | File.exist?(@yaml_file).should be_true |
14 | end |
15 | it "should create YAML equal to Radiant::Config.to_hash" do |
16 | TaskSupport.config_export(@yaml_file) |
17 | YAML.load_file(@yaml_file).should == Radiant::Config.to_hash.to_yaml |
18 | end |
19 | end |
20 | describe "self.config_import" do |
21 | before do |
22 | @yaml_file = "#{RADIANT_ROOT}/spec/fixtures/radiant_config.yml" |
23 | end |
24 | it "should delete all Radiant::Config when the clear parameter is set to true" do |
25 | Radiant::Config['testing_clear'] = 'true' |
26 | TaskSupport.config_import(@yaml_file, true) |
27 | Radiant::Config['testing_clear'].should be_nil |
28 | end |
29 | it "should load from the given YAML path" do |
30 | @yaml = "--- \ndefaults.page.parts: body, extended\n" |
31 | @hash = {} |
32 | YAML.stub!(:load_file).and_return(@yaml) |
33 | YAML.should_receive(:load).with(@yaml).and_return(@hash) |
34 | TaskSupport.config_import(@yaml_file) |
35 | end |
36 | it "should update Radiant::Config with the settings from the given YAML" do |
37 | Radiant::Config.delete_all |
38 | TaskSupport.config_import(@yaml_file) |
39 | Radiant::Config.to_hash.should == YAML.load(YAML.load_file(@yaml_file)) |
40 | end |
41 | end |
42 | |
43 | describe "self.cache_files" do |
44 | before do |
45 | @files = [ 'a.txt', 'b.txt' ] |
46 | @dir = "#{Rails.root}/tmp/cache_files_test" |
47 | @cache_file = 'all.txt' |
48 | |
49 | FileUtils.mkdir_p(@dir) |
50 | FileUtils.rm_rf(File.join(@dir, '*.txt')) |
51 | @files.each do |f_name| |
52 | File.open(File.join(@dir, f_name), "w+") do |f| |
53 | f.write("Contents of '#{f_name}'") |
54 | end |
55 | end |
56 | end |
57 | |
58 | it "should create a cache file containing the contents of the specified files" do |
59 | TaskSupport.cache_files(@dir, @files, @cache_file) |
60 | cache_path = File.join(@dir, @cache_file) |
61 | File.should exist(cache_path) |
62 | File.read(cache_path).should == "Contents of 'a.txt'\n\nContents of 'b.txt'" |
63 | end |
64 | end |
65 | |
66 | describe "self.find_admin_js" do |
67 | it "should return an array of JS files" do |
68 | js_files = TaskSupport.find_admin_js |
69 | js_files.should_not be_empty |
70 | js_files.each { |f| f.should =~ /^[^\/]+.js$/ } |
71 | end |
72 | end |
73 | |
74 | describe "self.cache_admin_js" do |
75 | before do |
76 | @js_files = [ 'a.js','b.js' ] |
77 | TaskSupport.stub!(:find_admin_js).and_return(@js_files) |
78 | TaskSupport.stub!(:cache_files) |
79 | end |
80 | |
81 | it "should cache all admin JS files as 'all.js'" do |
82 | TaskSupport.should_receive(:cache_files).with( |
83 | "#{Rails.root}/public/javascripts/admin", @js_files, 'all.js') |
84 | TaskSupport.cache_admin_js |
85 | end |
86 | end |
87 | end |