clean up test

This commit is contained in:
John Bintz 2011-05-07 12:50:06 -04:00
parent 5c2e078c02
commit 3b1f15f9ab
1 changed files with 122 additions and 110 deletions

View File

@ -8,9 +8,20 @@ describe 'backbone-generator' do
FileUtils.rm_rf 'app'
end
def run(*opts)
system %{bin/backbone-generator #{opts.join(' ')}}
end
before { clean! }
after { clean! }
describe 'coffeescript' do
describe 'model' do
end
end
describe 'javascript' do
def should_generate_model
File.file?(model = 'public/javascripts/models/section/model.js').should be_true
File.file?(spec = 'spec/javascripts/models/section/model_spec.js').should be_true
@ -57,7 +68,7 @@ describe 'backbone-generator' do
describe 'model' do
it "should generate the model files" do
system %{bin/backbone-generator model Section::Model}
run "model", "Section::Model"
should_generate_model
end
@ -65,7 +76,7 @@ describe 'backbone-generator' do
describe 'view' do
it "should generate the view files" do
system %{bin/backbone-generator view Section::Model}
run "view", "Section::Model"
should_generate_view
end
@ -74,7 +85,7 @@ describe 'backbone-generator' do
describe 'collection view' do
context 'without trailing s' do
it "should generate the collection view files" do
system %{bin/backbone-generator collection-view Section::Model}
run "collection-view", "Section::Model"
should_generate_collection_view
end
@ -82,7 +93,7 @@ describe 'backbone-generator' do
context 'with trailing s' do
it "should generate the collection view files" do
system %{bin/backbone-generator collection-view Section::Models}
run "collection-view", "Section::Models"
should_generate_collection_view
end
@ -92,7 +103,7 @@ describe 'backbone-generator' do
describe 'collection' do
context 'without trailing s' do
it "should generate the collection files" do
system %{bin/backbone-generator collection Section::Model}
run "collection", "Section::Model"
should_generate_collection
end
@ -100,7 +111,7 @@ describe 'backbone-generator' do
context 'with trailing s' do
it "should generate the collection files" do
system %{bin/backbone-generator collection Section::Models}
run "collection", "Section::Models"
should_generate_collection
end
@ -109,7 +120,7 @@ describe 'backbone-generator' do
describe 'scaffold' do
it "should generate everything!" do
system %{bin/backbone-generator scaffold Section::Model}
run "scaffold", "Section::Model"
should_generate_model
should_generate_view
@ -120,7 +131,7 @@ describe 'backbone-generator' do
describe 'spec helper' do
it "should generate a spec helper" do
system %{bin/backbone-generator spec-helper}
run "spec-helper"
File.file?(collection = 'spec/javascripts/helpers/backbone_spec_helper.js').should be_true
end
@ -128,7 +139,7 @@ describe 'backbone-generator' do
describe 'app helper' do
it "should generate an app helper" do
system %{bin/backbone-generator app-helper}
run "app-helper"
File.file?(collection = 'public/javascripts/applications/backbone_helper.js').should be_true
end
@ -136,7 +147,7 @@ describe 'backbone-generator' do
describe 'application scaffold' do
it "should generate an application scaffold" do
system %{bin/backbone-generator app-scaffold}
run "app-scaffold"
File.file?(app = 'public/javascripts/application/app_view.js').should be_true
File.file?(app_view = 'app/views/application/app_view.jst').should be_true
@ -145,3 +156,4 @@ describe 'backbone-generator' do
end
end
end
end