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();
|
|
|
|
|
2011-05-03 19:43:19 +00:00
|
|
|
expect(view.$('button.save')).toHaveText('Create');
|
2011-04-29 19:05:54 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2011-05-03 19:43:19 +00:00
|
|
|
expect(view.$('button.save')).toHaveText('Update');
|
2011-04-29 19:05:54 +00:00
|
|
|
});
|
2011-04-15 18:55:37 +00:00
|
|
|
});
|
|
|
|
});
|