Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ember Testing: is it a mirage?

Ember Testing: is it a mirage?

Garrett Heinlen

July 30, 2015
Tweet

More Decks by Garrett Heinlen

Other Decks in Technology

Transcript

  1. A tail of ember-rails testing · tons of setup ·

    very manual process · copy-a-pasta files ! · asset pipeline biz · never had any real success
  2. Why did we struggle so much? · Stubbing current_user reliably

    · Mocking out current_user's progress · setup data in test · Stubbing out side-loaded content · reqiurejs dependencies caused test to timeout
  3. What do we get? · mock server · runs in

    development & testing · simple to setup
  4. · Export raw json to use for objects · Simple

    to get started · Might be easier to manage associations this way (for now)
  5. · Comes built in with Faker to create dynamic values

    · Allows for functions to build information · Supports all/most data types
  6. · Import fixtures · Helper method to find a specific

    object · stub endpoints to return data we need
  7. config.js - stubbing api endpoints // GET shorthands // Collections

    this.get('/contacts'); this.get('/contacts', 'users'); // define which resource to use // Single objects this.get('/contacts/:id'); // POST shorthands this.post('/contacts'); // PUT shorthands this.put('/contacts/:id'); DELETE shorthands this.del('/contacts/:id');
  8. Fin