Skip to content

Instantly share code, notes, and snippets.

@knomedia
Created January 13, 2014 20:03
Show Gist options
  • Select an option

  • Save knomedia/8407012 to your computer and use it in GitHub Desktop.

Select an option

Save knomedia/8407012 to your computer and use it in GitHub Desktop.

Revisions

  1. knomedia created this gist Jan 13, 2014.
    35 changes: 35 additions & 0 deletions quiz.spec.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    define [
    '../start_app',
    'ember',
    'ic-ajax',
    '../../controllers/quiz_controller',
    '../environment_setup',
    ], (startApp, Ember, ajax, QuizController) ->

    App = null

    module 'quizzes_controller',
    setup: ->
    App = startApp()
    cont = new Em.Container()
    cont.register('controller:quizzes', Em.Object)
    @qc = App.QuizController.create({container: cont})
    @qc.set('model', {points_possible: 1, title: 'Assignment test'})

    teardown: ->
    Ember.run App, 'destroy'

    test 'display singular points possible', ->
    equal(@qc.get('pointsPossible'), '1 pt')

    test 'display mulitple points possible', ->
    @qc.set('model', {points_possible: 2, title: 'Assignment test'})
    equal(@qc.get('pointsPossible'), '2 pts')

    test 'doesnt display when zero points possible', ->
    @qc.set('model', {points_possible: 0, title: 'Assignment test'})
    equal(@qc.get('pointsPossible'), '')

    test 'doesnt display when undefined points possible', ->
    @qc.set('model', {title: 'Assignment test'})
    equal(@qc.get('pointsPossible'), '')