Skip to content

Instantly share code, notes, and snippets.

@MichaelMartinez
Created March 13, 2012 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelMartinez/2026805 to your computer and use it in GitHub Desktop.
Save MichaelMartinez/2026805 to your computer and use it in GitHub Desktop.
Coffee-Script Constructor
describe "constructor w/object", ->
beforeEach ->
@newUser = new User()
it "should instantiate new user", ->
(expect @newUser.firstName).toEqual 'Michael'
window.User = class User
constructor: ->
@firstName = ''
$.getJSON "../user.json", (json) ->
for myobj, myattrs of json
@firstName = myattrs.firstName
return console.log @firstName
@MichaelMartinez
Copy link
Author

console.log shows the firstName but my Jasmine test doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment