Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
testing-ember-apps.pdf
Search
Tom Kruijsen
March 12, 2014
Programming
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
testing-ember-apps.pdf
Tom Kruijsen
March 12, 2014
More Decks by Tom Kruijsen
See All by Tom Kruijsen
Functional Reactive Programming in Bacon.js
tomkr
2
120
To Framework or not to Framework
tomkr
0
87
Functional Reactive Programming with BaconJS
tomkr
0
88
Philosophy for Web Developers
tomkr
0
69
An Introduction to Leaflet
tomkr
0
110
Ember on Rails
tomkr
4
190
Other Decks in Programming
See All in Programming
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
1
370
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
190
高専キャリア LT 発表内容
crysta1221
4
4.3k
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
400
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
520
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
580
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
410
Cloudflare is Agents
chimame
0
180
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
120
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
670
信頼性の目標を誰も求めてない
shubox
0
230
Oxlintはいいぞ(続)
yug1224
1
480
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
A Tale of Four Properties
chriscoyier
163
24k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
390
How to train your dragon (web standard)
notwaldorf
97
6.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.1k
Designing for humans not robots
tammielis
254
26k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
950
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Done Done
chrislema
186
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Spectacular Lies of Maps
axbom
PRO
1
950
Transcript
Testing Ember Apps Tom Kruijsen Ember.js - 2014-03-12
Brightin
None
Warning: blatant self- promotion
Appuccino
Some questions
Integration tests with QUnit
Unit tests?
Why QUnit?
None
Konacha
Rails gem
Mocha & Chai
None
#= require 'sinon'! #= require 'application'! ! mocha.ui('bdd')! mocha.globals(['Ember', 'DS',
'Catstagram', 'MD5'])! mocha.timeout(5)! chai.Assertion.includeStack = true! ! ENV = {! TESTING: true! }! ! window.server = sinon.fakeServer.create()! ! window.testHelper =! lookup: (object, object_name) ->! name = object_name || "main"! Catstagram.__container__.lookup(object + ":" + name)! ! Catstagram.Router.reopen! location: 'none'! ! Konacha.reset = Ember.K! ! Catstagram.setupForTesting()! Catstagram.injectTestHelpers()! ! beforeEach ->! Ember.run ->! Catstagram.reset()! ! Ember.Test.adapter = Ember.Test.Adapter.create()
#= require spec_helper! ! describe "Cat", ->! it "is a
DS.Model", ->! expect(Catstagram.Cat).to.exist! expect(DS.Model.detect(Catstagram.Cat)).to.exist! ! it "has a name", =>! Ember.run( ->! cat = testHelper.lookup('store').createRecord 'cat', name: 'Mimi'! expect(cat.get 'name').to.equal 'Mimi'! )
#= require 'spec_helper'! ! describe 'Cats page', ->! beforeEach ->!
cat = Ember.Object.create! id: 1! name: 'Mimi'! ! stubStore = sinon.stub(testHelper.lookup('store'), 'find')! stubStore.withArgs('cat').returns([cat])! ! ! visit '/'! ! it 'shows the names of the cats', ->! expect($('li').text()).to.equal('Mimi')! ! it 'links to a cat page', ->! mock = sinon.mock(testHelper.lookup('route', 'cats_cat'))! mock.expects('setupController').once()! $('a').click()! mock.verify()
Mocha is nicer than QUnit
Use Sinon and mock a lot
How do you test your apps?
Testing Ember Apps Tom Kruijsen Ember.js - 2014-03-12