no, wait, *now* i've got it right
This commit is contained in:
parent
3c8342fca4
commit
f8fa5573c8
|
@ -6,8 +6,8 @@ Currently only works with Rails-ish projects and with Jasmine & Jammit. I'm self
|
||||||
|
|
||||||
`backbone-generate model Admin::User` creates an AdminUserModel object in:
|
`backbone-generate model Admin::User` creates an AdminUserModel object in:
|
||||||
|
|
||||||
* `public/javascripts/models/admin/user_model.js`
|
* `public/javascripts/models/admin/user.js`
|
||||||
* `spec/javascripts/models/admin/user_model_spec.js`
|
* `spec/javascripts/models/admin/user_spec.js`
|
||||||
|
|
||||||
### View
|
### View
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ class BackboneGenerator < Thor
|
||||||
desc 'model Namespaced::Name', "Create a model"
|
desc 'model Namespaced::Name', "Create a model"
|
||||||
def model(name)
|
def model(name)
|
||||||
@name = name
|
@name = name
|
||||||
template('model.js.erb', "public/javascripts/models/#{underscore_name}_model.js")
|
template('model.js.erb', "public/javascripts/models/#{underscore_name}.js")
|
||||||
template('model_spec.js.erb', "spec/javascripts/models/#{underscore_name}_model_spec.js")
|
template('model_spec.js.erb', "spec/javascripts/models/#{underscore_name}_spec.js")
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'view Namespaced::Name', "Create a view"
|
desc 'view Namespaced::Name', "Create a view"
|
||||||
|
|
|
@ -15,8 +15,8 @@ describe 'backbone-generator' do
|
||||||
it "should generate the model files" do
|
it "should generate the model files" do
|
||||||
system %{bin/backbone-generator model Section::Model}
|
system %{bin/backbone-generator model Section::Model}
|
||||||
|
|
||||||
File.file?(model = 'public/javascripts/models/section/model_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_model_spec.js').should be_true
|
File.file?(spec = 'spec/javascripts/models/section/model_spec.js').should be_true
|
||||||
|
|
||||||
File.read(model).should match(/SectionModel/)
|
File.read(model).should match(/SectionModel/)
|
||||||
File.read(spec).should match(/SectionModel/)
|
File.read(spec).should match(/SectionModel/)
|
||||||
|
|
Loading…
Reference in New Issue