Commit bddf8eb8

mo k <mo@mokhan.ca>
2012-09-18 20:22:12
start to build the new tutorial presenter.
1 parent 657e20a
Changed files (2)
app
assets
javascripts
spec
javascripts
app/assets/javascripts/presenters/new_tutorial_presenter.js.coffee
@@ -0,0 +1,6 @@
+class window.NewTutorialPresenter
+  constructor:(@view) ->
+
+  add_tag: (tag) ->
+    @view.add_tag('<li><a href="#" class="label">'+tag+'</a></li>')
+
spec/javascripts/presenters/new_tutorial_presenter_spec.js
@@ -0,0 +1,17 @@
+describe ("NewTutorialPresenter", function() {
+  beforeEach (function() {
+    view = {add_tag:null};
+    sut = new NewTutorialPresenter(view);
+  });
+  var sut;
+  var view;
+  describe ("when a new tag is added", function() {
+    it ("should add the new tag to the list of tags", function() {
+      expect(view.add_tag).toHaveBeenCalledWith('<li><a href="#" class="label">blah</a></li>');
+    });
+    beforeEach (function() {
+      spyOn(view, 'add_tag');
+      sut.add_tag('blah');
+    });
+  });
+});