backbone-generator/templates/view_spec.js.erb

30 lines
724 B
Plaintext
Raw Normal View History

2011-04-15 18:55:37 +00:00
describe('<%= object_name %>View', function() {
2011-04-29 19:05:54 +00:00
var view, model;
2011-04-15 18:55:37 +00:00
2011-04-29 19:05:54 +00:00
describe('new record', function() {
beforeEach(function() {
model = new <%= object_name %>();
});
2011-04-15 18:55:37 +00:00
2011-04-29 19:05:54 +00:00
it('should render with a create button', function() {
view = new <%= object_name %>View({model: model});
view.render();
expect(view.$('button')).toHaveText('Create');
});
});
describe('existing record', function() {
beforeEach(function() {
model = new <%= object_name %>({id: 1});
});
it('should render with an update button', function() {
view = new <%= object_name %>View({model: model});
view.render();
expect(view.$('button')).toHaveText('Update');
});
2011-04-15 18:55:37 +00:00
});
});