Skip to content

Instantly share code, notes, and snippets.

@bturnbull
Created September 26, 2011 21:38
Show Gist options
  • Save bturnbull/1243484 to your computer and use it in GitHub Desktop.
Save bturnbull/1243484 to your computer and use it in GitHub Desktop.
CoffeeScript Namespacing
#### app/assets/javascripts/foo.js.coffee
Foo =
bar: ->
"baz"
# Have to add this to get Foo into the global namespace
# so Jasmine tests can see it
window.Foo = Foo
#### spec/javascripts/foo_spec.js.coffee
describe "Foo", ->
describe "bar", ->
it "should return 'baz'", ->
expect(Foo.bar).toEqual("baz")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment