Skip to content

Instantly share code, notes, and snippets.

@timwingfield
Created January 15, 2013 18:32
Show Gist options
  • Save timwingfield/4540824 to your computer and use it in GitHub Desktop.
Save timwingfield/4540824 to your computer and use it in GitHub Desktop.
extend 'the.models.OurModel', class OurModel extends Backbone.Model
url: ->
"#{relativeUrlRoot}/some_controller/some_action#{@get 'channel_type'}_data/#{@get 'end_point_id'}"
parse: (response) ->
response.id = "#{response.end_point_id}_#{response.channel_type}"
response
xdescribe "#parse", ->
#how to set this up correctly??
Given -> @json =
end_point_id: 44
channel_type: 'spongebob'
Given -> @model = new the.models.OurModel
Given -> spyOn(@model, 'fetch').andReturn(@json)
When -> @model.fetch()
Then -> expect(@model.get 'channel_type').toEqual('spongebob')
Then -> expect(@model.get 'id').toEqual('44_spongebob')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment