Sha256: 8d8a9e76ff644f6cbb2ceb41e477366b49eeb62e3c2ec796a9d92fa0b123343b
Contents?: true
Size: 871 Bytes
Versions: 11
Compression:
Stored size: 871 Bytes
Contents
# =require fake_ajax_server createProducts = -> [ {id: 1, name: 'One'} {id: 2, name: 'Two'} ] extendClass 'specs.<%= class_name %>Spec', -> createFakeServer: -> @fakeServer = new FakeAjaxServer (url, settings)-> if settings then settings.url = url else settings = url handled = false switch settings.dataType when 'json' then switch settings.type when 'get' then switch settings.url when '/products' then handled = true; settings.success createProducts() # when 'post' then switch settings.url # when ... # when undefined then switch settings.type # when 'get' then switch settings.url # when ... # when 'post' then switch settings.url # when ... return if handled console.log arguments throw "Unexpected AJAX call: #{settings.url}"
Version data entries
11 entries across 11 versions & 1 rubygems