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:
- 8458 Bytes
1 | require File.dirname(__FILE__) + "/extension_generators_spec_helper" |
2 | |
3 | describe "ExtensionGenerator with normal options" do |
4 | it_should_behave_like AllGenerators |
5 | |
6 | before(:each) do |
7 | cp_r File.join(BASE_ROOT, 'lib/generators/extension'), File.join(RADIANT_ROOT, 'vendor/generators') |
8 | git_config = {'user.name' => 'Ext Author', 'user.email' => 'ext@radiantcms.org', 'github.user' => 'extauthor'} |
9 | Git.should_receive(:global_config).and_return git_config |
10 | run_generator('extension', %w(Sample)) |
11 | end |
12 | |
13 | it "should generate README file" do |
14 | 'vendor/extensions/sample'.should have_generated_file('README') |
15 | end |
16 | |
17 | it "should generate a Rakefile" do |
18 | 'vendor/extensions/sample'.should have_generated_file('Rakefile') do |body| |
19 | body.should match(/Spec::Rake::SpecTask\.new\(:spec\)/) |
20 | end |
21 | end |
22 | |
23 | it "should generate a config/routes.rb file" do |
24 | 'vendor/extensions/sample'.should have_generated_file('config/routes.rb') do |body| |
25 | body.should match(/ActionController::Routing::Routes.draw do \|map\|((\n|\s*.*\n)*)\s+\# end/) |
26 | end |
27 | end |
28 | |
29 | it "should generate extension init file" do |
30 | 'vendor/extensions/sample'.should have_generated_class('sample_extension', 'Radiant::Extension') do |body| |
31 | body.should match(/version "1.0"\n\s+description "Describe your extension here"\n\s+url "http:\/\/github.com\/extauthor\/radiant-sample-extension"/) |
32 | body.should match(/extension_config do \|config\|((\n|\s*.*\n)*)\s+\# end/) |
33 | body.should have_method('activate') |
34 | end |
35 | end |
36 | |
37 | it "should generate extension Rake tasks file" do |
38 | 'vendor/extensions/sample'.should have_generated_file('lib/tasks/sample_extension_tasks.rake') do |body| |
39 | body.should match(r = /namespace :radiant do\n namespace :extensions do\n namespace :sample do\n((\n|\s*.*\n)*) end\n end\nend/) |
40 | tasks = body.match(r)[1] |
41 | tasks.should match(/task :migrate => :environment do\n((\n|\s*.*\n)*)\s+end/) |
42 | tasks.should match(/task :update => :environment do\n((\n|\s*.*\n)*)\s+end/) |
43 | end |
44 | end |
45 | |
46 | it "should populate Rakefile with gem info" do |
47 | 'vendor/extensions/sample'.should have_generated_file('Rakefile') do |body| |
48 | body.should match(%r(gem.name = "radiant-sample-extension")) |
49 | body.should match(%r(gem.email = "ext@radiantcms.org")) |
50 | body.should match(%r(gem.homepage = "http://github.com/extauthor/radiant-sample-extension")) |
51 | body.should match(%r(gem.authors = \["Ext Author"\])) |
52 | end |
53 | end |
54 | |
55 | it "should generate extension controllers directory" do |
56 | 'vendor/extensions/sample'.should have_generated_directory('app/controllers') |
57 | end |
58 | |
59 | it "should generate extension helpers directory" do |
60 | 'vendor/extensions/sample'.should have_generated_directory('app/helpers') |
61 | end |
62 | |
63 | it "should generate extension models directory" do |
64 | 'vendor/extensions/sample'.should have_generated_directory('app/models') |
65 | end |
66 | |
67 | it "should generate extension views directory" do |
68 | 'vendor/extensions/sample'.should have_generated_directory('app/views') |
69 | end |
70 | |
71 | it "should generate extension views directory" do |
72 | 'vendor/extensions/sample'.should have_generated_directory('db/migrate') |
73 | end |
74 | |
75 | it "should generate extension controllers spec directory" do |
76 | 'vendor/extensions/sample'.should have_generated_directory('spec/controllers') |
77 | end |
78 | |
79 | it "should generate extension helpers spec directory" do |
80 | 'vendor/extensions/sample'.should have_generated_directory('spec/helpers') |
81 | end |
82 | |
83 | it "should generate extension models spec directory" do |
84 | 'vendor/extensions/sample'.should have_generated_directory('spec/models') |
85 | end |
86 | |
87 | it "should generate extension views spec directory" do |
88 | 'vendor/extensions/sample'.should have_generated_directory('spec/views') |
89 | end |
90 | |
91 | it "should generate extension spec helper file" do |
92 | 'vendor/extensions/sample'.should have_generated_file('spec/spec_helper.rb') |
93 | end |
94 | |
95 | it "should generate extension spec opts file" do |
96 | 'vendor/extensions/sample'.should have_generated_file('spec/spec.opts') |
97 | end |
98 | |
99 | it "should generate extension cucumber.yml file" do |
100 | 'vendor/extensions/sample'.should have_generated_file('cucumber.yml') |
101 | end |
102 | |
103 | it "should generate extension config directory" do |
104 | 'vendor/extensions/sample'.should have_generated_directory('config') |
105 | end |
106 | |
107 | it "should generate extension routes.rb file" do |
108 | 'vendor/extensions/sample'.should have_generated_file('config/routes.rb') |
109 | end |
110 | |
111 | it "should generate extension locales directory" do |
112 | 'vendor/extensions/sample'.should have_generated_directory('config/locales') |
113 | end |
114 | |
115 | it "should generate extension en.yml file" do |
116 | 'vendor/extensions/sample'.should have_generated_file('config/locales/en.yml') |
117 | end |
118 | |
119 | it "should generate extension features support directory" do |
120 | 'vendor/extensions/sample'.should have_generated_directory('features/support') |
121 | end |
122 | |
123 | it "should generate extension features step_definitions directory" do |
124 | 'vendor/extensions/sample'.should have_generated_directory('features/step_definitions/admin') |
125 | end |
126 | |
127 | after(:each) do |
128 | rm_rf Dir["#{RADIANT_ROOT}/vendor/extensions/*"] |
129 | rm_rf Dir["#{RADIANT_ROOT}/vendor/generators/*"] |
130 | end |
131 | end |
132 | |
133 | describe "ExtensionGenerator with test-unit option" do |
134 | it_should_behave_like AllGenerators |
135 | |
136 | before(:each) do |
137 | Git.stub!(:global_config).and_return({}) |
138 | cp_r File.join(BASE_ROOT, 'lib/generators/extension'), File.join(RADIANT_ROOT, 'vendor/generators') |
139 | run_generator('extension', %w(Sample --with-test-unit)) |
140 | end |
141 | |
142 | it "should generate README file" do |
143 | 'vendor/extensions/sample'.should have_generated_file('README') |
144 | end |
145 | |
146 | it "should generate Rake file" do |
147 | 'vendor/extensions/sample'.should have_generated_file('Rakefile') do |body| |
148 | body.should match(/Rake::TestTask\.new\(:test\)/) |
149 | end |
150 | end |
151 | |
152 | it "should generate extension init file" do |
153 | 'vendor/extensions/sample'.should have_generated_class('sample_extension', 'Radiant::Extension') do |body| |
154 | body.should match(/version "1.0"\n\s+description "Describe your extension here"\n\s+url "http:\/\/yourwebsite.com\/sample"/) |
155 | body.should have_method('activate') |
156 | end |
157 | end |
158 | |
159 | it "should generate extension Rake tasks file" do |
160 | 'vendor/extensions/sample'.should have_generated_file('lib/tasks/sample_extension_tasks.rake') do |body| |
161 | body.should match(r = /namespace :radiant do\n namespace :extensions do\n namespace :sample do\n((\n|\s*.*\n)*) end\n end\nend/) |
162 | tasks = body.match(r)[1] |
163 | tasks.should match(/task :migrate => :environment do\n((\n|\s*.*\n)*)\s+end/) |
164 | tasks.should match(/task :update => :environment do\n((\n|\s*.*\n)*)\s+end/) |
165 | end |
166 | end |
167 | |
168 | it "should generate extension controllers directory" do |
169 | 'vendor/extensions/sample'.should have_generated_directory('app/controllers') |
170 | end |
171 | |
172 | it "should generate extension helpers directory" do |
173 | 'vendor/extensions/sample'.should have_generated_directory('app/helpers') |
174 | end |
175 | |
176 | it "should generate extension models directory" do |
177 | 'vendor/extensions/sample'.should have_generated_directory('app/models') |
178 | end |
179 | |
180 | it "should generate extension views directory" do |
181 | 'vendor/extensions/sample'.should have_generated_directory('app/views') |
182 | end |
183 | |
184 | it "should generate extension views directory" do |
185 | 'vendor/extensions/sample'.should have_generated_directory('db/migrate') |
186 | end |
187 | |
188 | it "should generate extension functional test directory" do |
189 | 'vendor/extensions/sample'.should have_generated_directory('test/functional') |
190 | end |
191 | |
192 | it "should generate extension test fixtures directory" do |
193 | 'vendor/extensions/sample'.should have_generated_directory('test/fixtures') |
194 | end |
195 | |
196 | it "should generate extension test unit directory" do |
197 | 'vendor/extensions/sample'.should have_generated_directory('test/unit') |
198 | end |
199 | |
200 | it "should generate extension test helper file" do |
201 | 'vendor/extensions/sample'.should have_generated_file('test/test_helper.rb') do |body| |
202 | body.should match(/require 'test\/unit'/) |
203 | body.should match(/class ActiveSupport::TestCase\n((\n|\s*.*\n)*)end/) |
204 | end |
205 | end |
206 | |
207 | it "should generate extension functional test file" do |
208 | 'vendor/extensions/sample'.should have_generated_file('test/functional/sample_extension_test.rb') |
209 | end |
210 | |
211 | after(:each) do |
212 | rm_rf Dir["#{RADIANT_ROOT}/vendor/extensions/*"] |
213 | rm_rf Dir["#{RADIANT_ROOT}/vendor/generators/*"] |
214 | end |
215 | end |