railsapp_factory 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,124 @@
1
+ require 'rspec'
2
+
3
+ require 'railsapp_factory/class_methods'
4
+ require 'railsapp_factory/helper_methods'
5
+
6
+ describe 'RailsappFactory::ClassMethods' do
7
+
8
+ class SubjectClass
9
+ extend RailsappFactory::ClassMethods
10
+ include RailsappFactory::HelperMethods
11
+
12
+ # from server_methods
13
+ attr_accessor :port, :pid
14
+
15
+ # from RunInAppMethods
16
+ attr_accessor :using
17
+
18
+ end
19
+
20
+ subject { SubjectClass.new }
21
+
22
+ describe "#uri" do
23
+ before do
24
+ subject.port = 123
25
+ end
26
+
27
+ it "should return a URI" do
28
+ subject.uri('/a/path').should be_a_kind_of(URI)
29
+ end
30
+ it "should be for 127.0.0.1" do
31
+ subject.uri('/a/path').to_s.should start_with('http://127.0.0.1:123/')
32
+ end
33
+ it "should end in given path" do
34
+ subject.uri('/a/path').to_s.should end_with('/a/path')
35
+ end
36
+
37
+ end
38
+
39
+ describe "#url" do
40
+ before do
41
+ subject.port = 567
42
+ end
43
+
44
+
45
+ it "should return a URI" do
46
+ subject.url('/a/path').should be_a_kind_of(String)
47
+ end
48
+ it "should be for 127.0.0.1" do
49
+ subject.url('/a/path').should start_with('http://127.0.0.1:567/')
50
+ end
51
+ it "should end in given path" do
52
+ subject.url('/a/path').should end_with('/a/path')
53
+ end
54
+
55
+ end
56
+
57
+
58
+ describe "#env=" do
59
+ before do
60
+ subject.env = 'development'
61
+ end
62
+
63
+ it "should set @override_ENV RAILS_ENV/RACK_ENV" do
64
+ subject.override_ENV['RAILS_ENV'].should == 'development'
65
+ subject.override_ENV['RACK_ENV'].should == 'development'
66
+ end
67
+
68
+ it "should be reflected in env" do
69
+ subject.env.test?.should be_false
70
+ subject.env.should be_development
71
+ end
72
+
73
+ end
74
+
75
+ describe "#env" do
76
+ it "should be test by default" do
77
+ subject.env.to_s.should == 'test'
78
+ subject.env.should be_test
79
+ subject.env.should_not be_development
80
+ end
81
+ end
82
+
83
+ #describe "#rubies" do
84
+ #
85
+ # it "should return a list of rubies" do
86
+ # list = subject.rubies(nil)
87
+ # list.should be_a_kind_of(Array)
88
+ # list.should_not be_empty
89
+ # end
90
+ #end
91
+
92
+ describe "#alive?" do
93
+
94
+ it "should report an alive process as alive" do
95
+ IO.popen('cat', 'w') do |pipe|
96
+ subject.pid = pipe.pid
97
+ subject.should be_alive
98
+ end
99
+ end
100
+
101
+ it "should report a completed process as dead" do
102
+ IO.popen('cat', 'w') do |pipe|
103
+ subject.pid = pipe.pid
104
+ end
105
+ subject.should_not be_alive
106
+ end
107
+
108
+ it "should report nil pid as dead" do
109
+ subject.pid = nil
110
+ subject.should_not be_alive
111
+ end
112
+
113
+ end
114
+
115
+ describe "logger" do
116
+ it "has valid logger" do
117
+ subject.logger.should respond_to(:info, :warn, :debug, :error)
118
+ end
119
+ end
120
+
121
+
122
+ end
123
+
124
+
@@ -0,0 +1,24 @@
1
+ require 'rspec'
2
+
3
+ require 'railsapp_factory/string_inquirer'
4
+
5
+ describe 'RailsappFactory::StringInquirer' do
6
+ subject { RailsappFactory::StringInquirer.new('example_string') }
7
+
8
+ it 'should be a kind of string' do
9
+ subject.should be_a_kind_of(String)
10
+ end
11
+
12
+ it 'should equal the string it was initialized with' do
13
+ subject.should == 'example_string'
14
+ end
15
+
16
+ it 'should respond to example_string? with true' do
17
+ subject.example_string?.should be_true
18
+ end
19
+
20
+ it 'should respond to all other questions with false' do
21
+ subject.test?.should be_false
22
+ end
23
+
24
+ end
@@ -0,0 +1,98 @@
1
+ require 'rspec'
2
+ require 'spec_helper'
3
+
4
+ require 'railsapp_factory/class_methods'
5
+ require 'railsapp_factory/template_methods'
6
+ require 'railsapp_factory/helper_methods'
7
+
8
+ describe 'RailsappFactory::TemplateMethods' do
9
+
10
+ class SubjectClass
11
+ extend RailsappFactory::ClassMethods
12
+ # include for logger
13
+ include RailsappFactory::HelperMethods
14
+ include RailsappFactory::TemplateMethods
15
+
16
+ def base_dir
17
+ "/tmp"
18
+ end
19
+
20
+ def version
21
+ '4.0'
22
+ end
23
+ end
24
+
25
+ subject { SubjectClass.new }
26
+
27
+ describe '#process_template' do
28
+ it 'should call nothing when nothing has been added' do
29
+ subject.process_template
30
+ subject.template.should be_nil
31
+ end
32
+
33
+ describe 'with template contents' do
34
+ before { subject.append_to_template('gem "one"') }
35
+
36
+ it "should have contents" do
37
+ subject.template.should_not be_nil
38
+ File.size?(subject.template).should be_true
39
+ end
40
+
41
+ describe "before build" do
42
+ before { subject.stub(:built?).and_return(false) }
43
+ it "should call build" do
44
+ subject.built?.should be_false
45
+ subject.should_receive(:build).with()
46
+ subject.process_template
47
+ # checked elsewhere that build clears the template
48
+ end
49
+ end
50
+
51
+ describe "when built" do
52
+ before { subject.stub(:built?).and_return(true) }
53
+ it "should call process_template" do
54
+ subject.should_receive(:system_in_app).and_return(true)
55
+ subject.process_template
56
+ subject.template.should be_nil
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+
63
+ it '#append_to_template(text) should append text to a template' do
64
+ subject.append_to_template('gem "one"')
65
+ subject.append_to_template('gem "two"')
66
+ File.exist?(subject.template).should be_true
67
+ File.read(subject.template).should include("\ngem \"one\"\n")
68
+ File.read(subject.template).should include("\ngem \"two\"\n")
69
+ end
70
+
71
+ it '#use_template(template) should append text to a template from a local file' do
72
+ subject.use_template('templates/add_json_pure.rb')
73
+ File.exist?(subject.template).should be_true
74
+ File.read(subject.template).should include("\ngem 'json_pure'\n")
75
+ end
76
+
77
+ it '#use_template(template) should append text to a template from a remote file' do
78
+ subject.use_template('https://raw2.github.com/ianheggie/railsapp_factory/master/spec/templates/add-file.rb')
79
+ File.exist?(subject.template).should be_true
80
+ File.read(subject.template).should include("file.txt")
81
+ end
82
+
83
+ it 'should merge the contents of multiple appends and use_template calls' do
84
+ subject.append_to_template('gem "one"')
85
+ subject.use_template('templates/add_json_pure.rb')
86
+ subject.append_to_template('gem "two"')
87
+ subject.use_template('https://raw2.github.com/ianheggie/railsapp_factory/master/spec/templates/add-file.rb')
88
+ File.exist?(subject.template).should be_true
89
+ File.read(subject.template).should include("\ngem \"one\"\n")
90
+ File.read(subject.template).should include("\ngem \"two\"\n")
91
+ File.read(subject.template).should include("\ngem 'json_pure'\n")
92
+ File.read(subject.template).should include("file.txt")
93
+ end
94
+
95
+
96
+ end
97
+
98
+
@@ -0,0 +1,387 @@
1
+ require 'rspec'
2
+ require 'spec_helper'
3
+ require 'net/http'
4
+
5
+ require 'railsapp_factory'
6
+
7
+ describe 'RailsappFactory' do
8
+
9
+ # order by number at start of the description and then by random
10
+ # note 'describe' groups always sort after 'it' examples
11
+ RSpec.configure do |config|
12
+ config.order_groups_and_examples do |list|
13
+ list.sort_by { |item| [item.description.sub(/^(\d*).*/, '\1').to_i, rand] }
14
+ end
15
+ end
16
+
17
+ before(:all) do
18
+ puts '(before(:all) doing cleanup: rm -rf tmp/railsapp)'
19
+ RailsappFactory.cleanup
20
+ end
21
+
22
+ shared_examples_for RailsappFactory do
23
+
24
+ it "A RUBY VERSION MANAGER MUST BE MADE AVAILABLE!!" do
25
+ RailsappFactory.has_ruby_version_manager?.should be_true
26
+ end
27
+
28
+ describe "Ruby version manager" do
29
+ before do
30
+ # TODO: put back rubies(nil) when I get it working
31
+ @ruby_vs = RailsappFactory.rubies().collect {|s| s.sub(/.*?(\d+\.\d+\.\d+).*/, '\1')}
32
+ end
33
+
34
+ it 'must have ruby 1.8.7' do
35
+ @ruby_vs.should include('1.8.7')
36
+ end
37
+
38
+ it 'must have ruby 1.9.3' do
39
+ @ruby_vs.should include('1.9.3')
40
+ end
41
+
42
+ end
43
+
44
+ #unless RailsappFactory.has_ruby_version_manager?
45
+ # it 'should suggest rubies that can be used with this rails version' do
46
+ # list = @factory.rubies
47
+ # list.should be_a_kind_of(Array)
48
+ # list.should_not be_empty
49
+ # end
50
+ #
51
+ #end
52
+
53
+ it '#use should set using' do
54
+ fake_version = '3.14.159'
55
+ @factory.using.should == ''
56
+ @factory.use(fake_version)
57
+ @factory.using.should == fake_version
58
+ @factory.use(nil)
59
+ @factory.using.should == ''
60
+ end
61
+
62
+ it '#use should accept a block and only set using within it' do
63
+ fake_version = '3.14.159'
64
+ @factory.using.should == ''
65
+ ran_block = false
66
+ @factory.use(fake_version) do
67
+ @factory.using.should == fake_version
68
+ ran_block = true
69
+ end
70
+ ran_block.should == true
71
+ @factory.using.should == ''
72
+ end
73
+
74
+ it 'new should not build the application' do
75
+ @factory.should_not be_built
76
+ end
77
+
78
+ it 'should pick an appropriate version' do
79
+ if @factory.version =~ /2.3-lts/
80
+ @factory.release.should == '2.3.18'
81
+ else
82
+ @factory.release.should match(/^#{@factory.version}\./)
83
+ end
84
+ end
85
+
86
+ describe '2: when built using #build with templates' do
87
+ include SpecHelper
88
+
89
+ before(:all) do
90
+ @factory.use_template('spec/templates/add-ruby_version-controller.rb')
91
+ @factory.use_template('spec/templates/add-file.rb')
92
+ @factory.build
93
+ end
94
+
95
+ it '#built? should be true' do
96
+ @factory.should be_built
97
+ end
98
+
99
+ it 'a rails app should have been installed at root' do
100
+ Dir.chdir(@factory.root) do
101
+ Kernel.system 'find . -print | sort'
102
+ expected = %w{ app config db lib log public test tmp }
103
+ have = expected.select { |d| File.directory?(d) }
104
+ have.should == expected
105
+ expected = %w{app/controllers/application_controller.rb
106
+ config/database.yml config/environment.rb config/routes.rb }
107
+ have = expected.select { |fn| File.exists?(fn) }
108
+ have.should == expected
109
+ end
110
+ end
111
+
112
+ it 'it should have gems installed by bundler' do
113
+ Dir.chdir(@factory.root) do
114
+ expected = %w{ Gemfile Gemfile.lock }
115
+ have = expected.select { |fn| File.exists?(fn) }
116
+ have.should == expected
117
+ end
118
+ end
119
+
120
+ it 'the first template should have been processed' do
121
+ file = File.join(@factory.root, 'app/controllers/ruby_version_controller.rb')
122
+ File.exists?(file).should be_true
123
+ File.open(file).read.should =~ /RUBY_VERSION/
124
+ end
125
+
126
+ it 'the 2nd template should have been processed' do
127
+ file = File.join(@factory.root, 'public/file.txt')
128
+ File.exists?(file).should be_true
129
+ File.open(file).read.should =~ /a short poem/
130
+ end
131
+
132
+ it 'the template should have been cleared' do
133
+ @factory.template.should be_nil
134
+ end
135
+
136
+ it 'shell_eval should return stdout' do
137
+ @factory.shell_eval('date').should =~ /\d\d:\d\d/
138
+ @factory.shell_eval('env').should =~ /PATH=/
139
+ end
140
+
141
+ it 'RAILS_ENV should be set to test' do
142
+ @factory.env.should be_test
143
+ @factory.env.to_s.should == 'test'
144
+ @factory.shell_eval('echo $RAILS_ENV').should == "test\n"
145
+ @factory.shell_eval('echo $RACK_ENV').should == "test\n"
146
+ end
147
+
148
+ it 'ruby_eval should handle simple values' do
149
+ @factory.ruby_eval('1 + 2').should == 3
150
+ @factory.ruby_eval("'a-' + \"string\"").should == 'a-string'
151
+ @factory.ruby_eval('[1, :pear]').should == [1, 'pear']
152
+ @factory.ruby_eval("{ 'apple' => 23 }").should == {'apple' => 23}
153
+ end
154
+
155
+ it 'rails_eval should report rails specific values' do
156
+ @factory.rails_eval('Rails.env').should == @factory.env.to_s
157
+ end
158
+
159
+ if RUBY_VERSION !~ /^1\.8/
160
+ # ruby_eval uses runner for ruby 1.8.7
161
+ it 'ruby_eval should not report rails specific values' do
162
+ lambda { @factory.ruby_eval('Rails.env') }.should raise_error(NameError)
163
+ end
164
+ end
165
+
166
+ it 'ruby_eval should try and reproduce exceptions thrown' do
167
+ lambda { @factory.ruby_eval('1 / 0') }.should raise_error(ZeroDivisionError)
168
+ end
169
+
170
+ it 'ruby_eval should handle require and multi line commands' do
171
+ @factory.ruby_eval("before = 123\nrequire 'cgi'\nafter = defined?(CGI)\n[before,after]").should == [123, 'constant']
172
+ end
173
+
174
+ it 'ruby_eval should throw argument error on syntax errors' do
175
+ lambda { @factory.ruby_eval('def missing_an_arg(=2); end') }.should raise_error(ArgumentError)
176
+ end
177
+
178
+ it 'ruby_eval allows choice of :yaml' do
179
+ @factory.ruby_eval('Set.new([1,2])', :yaml).should == Set.new([1, 2])
180
+ end
181
+
182
+ it 'ruby_eval by default uses :json which converts non simple objects to either their class name or a simple object' do
183
+ ret = @factory.ruby_eval('Set.new([1,2])', :json)
184
+ if ret.is_a? Array
185
+ ret.should == [1, 2]
186
+ else
187
+ ret.should be_kind_of(String)
188
+ ret.should match(/#<Set:0x\w+>/)
189
+ end
190
+ end
191
+
192
+ it 'override_ENV should allow arbitrary environment variables to be set' do
193
+ @factory.override_ENV['ARBITRARY_VAR'] = 'some value'
194
+ @factory.in_app do
195
+ ENV['ARBITRARY_VAR']
196
+ end.should == 'some value'
197
+ @factory.shell_eval('echo $ARBITRARY_VAR').should == "some value\n"
198
+ @factory.ruby_eval("ENV['ARBITRARY_VAR']").should == 'some value'
199
+ ENV['ARBITRARY_VAR'].should == nil
200
+ end
201
+
202
+ #unless RailsappFactory.has_ruby_version_manager?
203
+ #
204
+ # it 'ruby_eval should work with all the rubies' do
205
+ # RUBY_VERSION.should == @factory.ruby_eval('RUBY_VERSION')
206
+ # @factory.rubies.each do |ruby_v|
207
+ # @factory.use(ruby_v) do
208
+ # actual_ruby_v = @factory.ruby_eval('RUBY_VERSION')
209
+ # actual_version_should_match_rubies_version(actual_ruby_v, ruby_v, false)
210
+ # end
211
+ # end
212
+ # end
213
+ #
214
+ # it 'rails_eval should work with all the rubies' do
215
+ # begin
216
+ # RUBY_VERSION.should == @factory.ruby_eval('RUBY_VERSION')
217
+ # @factory.rubies.each do |ruby_v|
218
+ # @factory.use(ruby_v)
219
+ # actual_ruby_v = @factory.rails_eval('RUBY_VERSION')
220
+ # actual_version_should_match_rubies_version(actual_ruby_v, ruby_v, false)
221
+ # end
222
+ # ensure
223
+ # # and nil should return to default
224
+ # @factory.use(nil)
225
+ # RUBY_VERSION.should == @factory.ruby_eval('RUBY_VERSION')
226
+ # end
227
+ # end
228
+ #
229
+ # it 'shell_eval should work with all the rubies' do
230
+ # RUBY_VERSION.should == @factory.ruby_eval('RUBY_VERSION')
231
+ # @factory.rubies.each do |ruby_v|
232
+ # @factory.use(ruby_v) do
233
+ # actual_ruby_v = @factory.shell_eval('ruby -v')
234
+ # actual_version_should_match_rubies_version(actual_ruby_v, ruby_v)
235
+ # end
236
+ # end
237
+ # end
238
+ #
239
+ # it 'system_in_app should work with all the rubies' do
240
+ # RUBY_VERSION.should == @factory.ruby_eval('RUBY_VERSION')
241
+ # @factory.rubies.each do |ruby_v|
242
+ # @factory.use(ruby_v) do
243
+ # tmp_filename = Tempfile.new('ruby_version').path
244
+ # @factory.system_in_app("ruby -v > #{tmp_filename}")
245
+ # actual_ruby_v = File.read(tmp_filename)
246
+ # actual_version_should_match_rubies_version(actual_ruby_v, ruby_v)
247
+ # FileUtils.rm_f tmp_filename
248
+ # end
249
+ # end
250
+ # end
251
+ #end
252
+
253
+ it 'should allow templates to be processed after build' do
254
+ @factory.use_template('spec/templates/add-yet-another-file.rb')
255
+ @factory.process_template
256
+ @factory.template.should be_nil
257
+ file = File.join(@factory.root, 'public/yet-another-file.txt')
258
+ File.exists?(file).should be_true
259
+ File.open(file).read.should =~ /Lorem ipsum/
260
+ end
261
+
262
+ describe 'when server is run using #start' do
263
+ before(:all) do
264
+ @factory.start.should be_true
265
+ end
266
+
267
+ after(:all) do
268
+ @factory.stop
269
+ end
270
+
271
+ it 'start should run the application' do
272
+ @factory.should be_alive
273
+ end
274
+
275
+ it 'the application should be on a non privileged port' do
276
+ @factory.port.should > 1024
277
+ end
278
+
279
+ it 'should have a http server running on port' do
280
+ response = Net::HTTP.get(URI(@factory.url))
281
+ response.should be_an_instance_of(String)
282
+ end
283
+
284
+ it 'should serve static files' do
285
+ response = Net::HTTP.get(@factory.uri('file.txt'))
286
+ response.should be_an_instance_of(String)
287
+ response.should =~ /a short poem/
288
+ end
289
+
290
+ it 'should serve dynamic page: /ruby_version' do
291
+ response = Net::HTTP.get(@factory.uri('/ruby_version'))
292
+ response.should be_an_instance_of(String)
293
+ response.should include(RUBY_VERSION)
294
+ end
295
+
296
+ it 'should respond with an error for missing paths' do
297
+ response = Net::HTTP.get_response(@factory.uri('/no_such_path'))
298
+ %w{404 500}.should include(response.code)
299
+ response.body.should =~ /No route matches/
300
+ end
301
+
302
+ it '9: stop should stop the application' do
303
+ @factory.stop.should be_true
304
+ @factory.should_not be_alive
305
+ end
306
+ end
307
+
308
+ #describe "#rubies" do
309
+ #
310
+ # # fails ruby 1.9.2 (new, 3.0, 3.1)
311
+ #
312
+ # it "lists ruby versions that are compatible with this version of rails" do
313
+ # list = @factory.rubies
314
+ # list.should be_a(Array)
315
+ # list.should_not be_empty
316
+ # end
317
+ #
318
+ # it 'the server should work with all the ruby versions' do
319
+ # @factory.using.should == ''
320
+ # @factory.rubies.each do |ruby_v|
321
+ # @factory.logger.info("Checking ruby #{ruby_v} for compatibility with rails #{@factory.version}")
322
+ # @factory.use(ruby_v) do
323
+ # @factory.using.should == ruby_v
324
+ # @factory.stop
325
+ # @factory.system_in_app('bundle').should be_true
326
+ # @factory.start.should be_true
327
+ # actual_ruby_v = Net::HTTP.get(@factory.uri('/ruby_version'))
328
+ # actual_version_should_match_rubies_version(actual_ruby_v, ruby_v, false)
329
+ # end
330
+ # end
331
+ # end
332
+ #
333
+ # it '9: stop server and rerun bundle' do
334
+ # @factory.stop
335
+ # @factory.system_in_app('bundle').should be_true
336
+ # end
337
+ #end
338
+
339
+ end
340
+
341
+ describe '9: at the end' do
342
+ it 'the server log file should have contents' do
343
+ @factory.system_in_app 'du'
344
+ @factory.system_in_app 'ls -laR log'
345
+ File.size(File.join(@factory.root, "log/#{@factory.env}.log")).should > 0
346
+ end
347
+
348
+ it '9: destroy should remove the root directory' do
349
+ root = @factory.root
350
+ @factory.destroy
351
+ File.directory?(root).should be_false if root
352
+ end
353
+ end
354
+
355
+ end
356
+
357
+ # latest compatible rails version
358
+ context '::new (latest compatible version)' do
359
+ before(:all) do
360
+ @factory = RailsappFactory.new()
361
+ end
362
+ after(:all) do
363
+ @factory.destroy
364
+ end
365
+
366
+ it_behaves_like RailsappFactory
367
+ end
368
+
369
+ RailsappFactory.versions.each do |ver|
370
+ before(:all) do
371
+ @factory = RailsappFactory.new(ver)
372
+ end
373
+ after(:all) do
374
+ @factory.destroy
375
+ end
376
+
377
+ next if ver == RailsappFactory.versions.last # don't retest last version
378
+
379
+ context "::new(#{ver})" do
380
+
381
+ it_behaves_like RailsappFactory
382
+
383
+ end
384
+ #break unless ENV['TRAVIS'] == 'true'
385
+ end
386
+
387
+ end
@@ -0,0 +1,41 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
18
+
19
+ module SpecHelper
20
+ def actual_version_should_match_rubies_version(actual_ruby_v, rubies_ruby_v, expect_prefix_and_patch = true)
21
+ prefix_string = rubies_ruby_v.sub(/^([a-zA-Z]*).*/, '\1')
22
+ if prefix_string == 'rbx'
23
+ prefix_string = 'rubinius'
24
+ elsif prefix_string == 'ree'
25
+ prefix_string = 'Ruby Enterprise Edition'
26
+ elsif prefix_string === ''
27
+ prefix_string = 'ruby'
28
+ end
29
+ ver_string = rubies_ruby_v.sub(/^\D*([\d\.]*).*/, '\1')
30
+ patch_string = if rubies_ruby_v =~ /.*?-p(\d+).*/
31
+ "#{$1}"
32
+ end
33
+ #puts "Matching #{prefix_string.inspect}, #{ver_string.inspect}, #{patch_string.inspect}"
34
+ actual_ruby_v.should include(ver_string)
35
+ if expect_prefix_and_patch
36
+ actual_ruby_v.should include(patch_string) if patch_string
37
+ actual_ruby_v.should include(prefix_string)
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,6 @@
1
+ file 'public/file.txt', <<-TEXT
2
+ a short poem:
3
+ Fleas
4
+ Adam
5
+ Had 'em.
6
+ TEXT
@@ -0,0 +1,9 @@
1
+ generate :controller, 'ruby_version', 'index'
2
+
3
+ file 'app/controllers/ruby_version_controller.rb', <<-TEXT
4
+ class RubyVersionController < ApplicationController
5
+ def index
6
+ render :text => RUBY_VERSION
7
+ end
8
+ end
9
+ TEXT
@@ -0,0 +1,6 @@
1
+ file 'public/yet-another-file.txt', <<-TEXT
2
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
3
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
4
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
5
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
6
+ TEXT