Skip to content

Instantly share code, notes, and snippets.

@eriktrom
Forked from walter/provider_test.coffee
Created May 15, 2013 06:48
Show Gist options
  • Save eriktrom/5582064 to your computer and use it in GitHub Desktop.
Save eriktrom/5582064 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()
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