Commit bddf8eb8
Changed files (2)
app
assets
javascripts
presenters
spec
javascripts
presenters
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');
+ });
+ });
+});