~michael.nelson/open-goal-tracker/brunch-test

« back to all changes in this revision

Viewing changes to test/unit/models/user_goal_test.coffee

  • Committer: Michael Nelson
  • Date: 2012-02-17 12:59:30 UTC
  • Revision ID: michael.nelson@canonical.com-20120217125930-jchi22zn3ama1gtt
Initial test, update package to include brunch locally.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
describe 'app.models.UserGoal', ->
 
2
 
 
3
    errorCallBack = jasmine.createSpy '-error event callback-'
 
4
 
 
5
    it "can validate a goal", ->
 
6
        userGoal = new UserGoal
 
7
        userGoal.bind 'error', @errorCallBack
 
8
 
 
9
        userGoal.set goal:""
 
10
 
 
11
        errorArgs = @errorCallBack.mostRecentCall.args
 
12
        (expect errorArgs).toBeDefined()
 
13
        (expect errorArgs[0]).to.be userGoal
 
14
        (expect errorArgs[1]).to.be "UserGoal.goal should not be empty."
 
15
 
 
16
    it "can be created with default attribute values", ->
 
17
        userGoal = new UserGoal
 
18
 
 
19
        (expect userGoal.get "goal").to.be ""
 
20