spec/generator/generator_spec.rb in rhosync-2.0.0.beta2 vs spec/generator/generator_spec.rb in rhosync-2.0.0.beta3
- old
+ new
@@ -3,12 +3,12 @@
describe "Generator" do
appname = 'mynewapp'
source = 'mysource'
path = File.expand_path(File.join(File.dirname(__FILE__)))
- after(:each) do
- #FileUtils.rm_rf path
+ before(:each) do
+ FileUtils.mkdir_p '/tmp'
end
describe "AppGenerator" do
it "should complain if no name is specified" do
lambda {
@@ -24,11 +24,12 @@
[
'config.ru',
"application.rb",
'settings/settings.yml',
'settings/license.key',
- 'Rakefile'
+ 'Rakefile',
+ 'spec/spec_helper.rb'
].each do |template|
@generator.should create("/tmp/#{appname}/#{template}")
end
end
end
@@ -39,15 +40,18 @@
Rhosync::SourceGenerator.new('/tmp',{})
}.should raise_error(Templater::TooFewArgumentsError)
end
before(:each) do
- @generator = Rhosync::SourceGenerator.new('/tmp',{},source)
+ FileUtils.rm_rf "/tmp/#{appname}"
+ @app_generator = Rhosync::AppGenerator.new('/tmp',{},appname)
+ @app_generator.invoke!
+ @generator = Rhosync::SourceGenerator.new("/tmp/#{appname}",{},source)
end
- it "should create new source adapter" do
- pending
- @generator.should create("/tmp/sources/#{source}.rb")
+ it "should create new source adapter and spec" do
+ @generator.should create("/tmp/#{appname}/sources/#{source}.rb")
+ @generator.should create("/tmp/#{appname}/spec/sources/#{source}_spec.rb")
end
end
end
\ No newline at end of file