Skip to content

Instantly share code, notes, and snippets.

@ebryn
Forked from walter/provider_test.coffee
Last active December 16, 2015 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebryn/5499010 to your computer and use it in GitHub Desktop.
Save ebryn/5499010 to your computer and use it in GitHub Desktop.
App = require 'app'
require 'models/provider'
require 'stores/provider'
# Sample test case
describe 'Provider', ->
describe '#create()', ->
# essentially this is testing that our configuration is working
# so somewhat of a redundant test
it 'should return a new Provider record matching input', ->
titleValue = "Example.com"
domainValue = 'example.com'
Ember.run ->
provider = App.Provider.create
title: titleValue
domain: domainValue
provider.save()
providers = App.Provider.find()
providers.then ->
console.log Ember.inspect providers.get('firstObject')
console.log providers.get('isLoaded')
# there should now be 1 provider
expect( providers.get('length') ).to.equal 1
provider = providers.firstObject()
# properties of provider should match parameter values
expect( provider.get('title') ).to.equal titleValue
expect( provider.get('domain') ).to.equal domainValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment