clean up test
This commit is contained in:
parent
5c2e078c02
commit
3b1f15f9ab
|
@ -8,9 +8,20 @@ describe 'backbone-generator' do
|
||||||
FileUtils.rm_rf 'app'
|
FileUtils.rm_rf 'app'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run(*opts)
|
||||||
|
system %{bin/backbone-generator #{opts.join(' ')}}
|
||||||
|
end
|
||||||
|
|
||||||
before { clean! }
|
before { clean! }
|
||||||
after { clean! }
|
after { clean! }
|
||||||
|
|
||||||
|
describe 'coffeescript' do
|
||||||
|
describe 'model' do
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'javascript' do
|
||||||
def should_generate_model
|
def should_generate_model
|
||||||
File.file?(model = 'public/javascripts/models/section/model.js').should be_true
|
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
|
File.file?(spec = 'spec/javascripts/models/section/model_spec.js').should be_true
|
||||||
|
@ -57,7 +68,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'model' do
|
describe 'model' do
|
||||||
it "should generate the model files" do
|
it "should generate the model files" do
|
||||||
system %{bin/backbone-generator model Section::Model}
|
run "model", "Section::Model"
|
||||||
|
|
||||||
should_generate_model
|
should_generate_model
|
||||||
end
|
end
|
||||||
|
@ -65,7 +76,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'view' do
|
describe 'view' do
|
||||||
it "should generate the view files" do
|
it "should generate the view files" do
|
||||||
system %{bin/backbone-generator view Section::Model}
|
run "view", "Section::Model"
|
||||||
|
|
||||||
should_generate_view
|
should_generate_view
|
||||||
end
|
end
|
||||||
|
@ -74,7 +85,7 @@ describe 'backbone-generator' do
|
||||||
describe 'collection view' do
|
describe 'collection view' do
|
||||||
context 'without trailing s' do
|
context 'without trailing s' do
|
||||||
it "should generate the collection view files" 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
|
should_generate_collection_view
|
||||||
end
|
end
|
||||||
|
@ -82,7 +93,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
context 'with trailing s' do
|
context 'with trailing s' do
|
||||||
it "should generate the collection view files" 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
|
should_generate_collection_view
|
||||||
end
|
end
|
||||||
|
@ -92,7 +103,7 @@ describe 'backbone-generator' do
|
||||||
describe 'collection' do
|
describe 'collection' do
|
||||||
context 'without trailing s' do
|
context 'without trailing s' do
|
||||||
it "should generate the collection files" do
|
it "should generate the collection files" do
|
||||||
system %{bin/backbone-generator collection Section::Model}
|
run "collection", "Section::Model"
|
||||||
|
|
||||||
should_generate_collection
|
should_generate_collection
|
||||||
end
|
end
|
||||||
|
@ -100,7 +111,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
context 'with trailing s' do
|
context 'with trailing s' do
|
||||||
it "should generate the collection files" do
|
it "should generate the collection files" do
|
||||||
system %{bin/backbone-generator collection Section::Models}
|
run "collection", "Section::Models"
|
||||||
|
|
||||||
should_generate_collection
|
should_generate_collection
|
||||||
end
|
end
|
||||||
|
@ -109,7 +120,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'scaffold' do
|
describe 'scaffold' do
|
||||||
it "should generate everything!" do
|
it "should generate everything!" do
|
||||||
system %{bin/backbone-generator scaffold Section::Model}
|
run "scaffold", "Section::Model"
|
||||||
|
|
||||||
should_generate_model
|
should_generate_model
|
||||||
should_generate_view
|
should_generate_view
|
||||||
|
@ -120,7 +131,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'spec helper' do
|
describe 'spec helper' do
|
||||||
it "should generate a 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
|
File.file?(collection = 'spec/javascripts/helpers/backbone_spec_helper.js').should be_true
|
||||||
end
|
end
|
||||||
|
@ -128,7 +139,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'app helper' do
|
describe 'app helper' do
|
||||||
it "should generate an 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
|
File.file?(collection = 'public/javascripts/applications/backbone_helper.js').should be_true
|
||||||
end
|
end
|
||||||
|
@ -136,7 +147,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
describe 'application scaffold' do
|
describe 'application scaffold' do
|
||||||
it "should generate an 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 = 'public/javascripts/application/app_view.js').should be_true
|
||||||
File.file?(app_view = 'app/views/application/app_view.jst').should be_true
|
File.file?(app_view = 'app/views/application/app_view.jst').should be_true
|
||||||
|
@ -144,4 +155,5 @@ describe 'backbone-generator' do
|
||||||
File.file?(spec = 'spec/javascripts/application/app_view_spec.js').should be_true
|
File.file?(spec = 'spec/javascripts/application/app_view_spec.js').should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue