Created
March 13, 2012 04:46
-
-
Save MichaelMartinez/2026805 to your computer and use it in GitHub Desktop.
Coffee-Script Constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "constructor w/object", -> | |
beforeEach -> | |
@newUser = new User() | |
it "should instantiate new user", -> | |
(expect @newUser.firstName).toEqual 'Michael' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.User = class User | |
constructor: -> | |
@firstName = '' | |
$.getJSON "../user.json", (json) -> | |
for myobj, myattrs of json | |
@firstName = myattrs.firstName | |
return console.log @firstName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console.log shows the firstName but my Jasmine test doesn't