describe '<%= plural_object_name %>View', -> view = collection = null beforeEach -> collection = new <%= plural_object_name %>() view = new <%= plural_object_name %>View({collection: collection}) view.render() it 'should render', -> expect($(view.el)).toContain('.list') expect($(view.el)).toContain('button.new') it 'should add a new model when new is clicked', -> view.$('button.new').trigger('click') expect(view.$('.list')).toContain('.<%= css_class_name %>') expect(collection.length).toEqual(1) it 'should render the models when re-rendered', -> expect(view.$('.list')).not.toContain('.<%= css_class_name %>') model = new <%= object_name %>({id: 1}) collection.add(model) view.render() expect(view.$('.list')).toContain('.<%= css_class_name %>')