Ember.js - Testing on Rails
With Membership
Minimum paid price

Ember.js - Testing on Rails

About the Book

Now that Ember.js is stabilizing many developers are looking for information on how to create a comprehensive test suite for their apps.  Integrating Ember with Ruby on Rails is great for developer happiness, but building an automated test suite which integrated the Ember fronted seems to be an area that needs more information.

In this book I will cover

  • Building an app with Rails 4 and Ember.js
  • Creating an automated test suite which covers both front and backend
  • The hooks available in Ember to allow testing
  • Testing relationships in Ember
  • Developing your own testing helpers

I hope you enjoy the book and look forward to your feedback.

In order to prevent any potential disappointment - this is not a beginners level book for Rails and JavaScript, there's an expectation that you know the basics.  I make every attempt to keep everything as straightforward as possible, but the focus here is on testing and integrating the two frameworks.  If you've got a fair bit of experience with Ember, you may find the book of limited use.


If you're not a Rails developer, you'll still find benefit from the testing strategies, but the book has a significant Rails focus.

Just to be really clear, Ember is still in constant development, but I will aim to keep up to date with what's going on and will adjust the book to deal with any changes that affect the content.  If you discover a problem, let me know and I'll get on to it as soon as possible!

WARNING - Given the speed with which Ember has developed much of the information is now outdated.  I'm leaving it out here for FREE now because the information about working in a test driven style is still relevant, but much of the implementation is no longer functional.

About the Author

Martin Feckie
Martin Feckie

I'm an enthusiastic explorer of Ember.js and all things open source.  I'm obsessive about Test Driven Development and automation and love to share the things I discover along the way.

Table of Contents

  • Acknowledgements
  • Erratum
  • Introduction
    • A Bit About My Motivation
    • First There Was Rails
    • Along Came jQuery
    • Javascript IV -Ember - A New Hope
    • Testing to the Rescue
  • Design Choices, the Golden Path and ‘Why Didn’t You Include / Use / Show X, Y, Z?”
  • Chapter One - Bootstrapping Our App
    • What are we going to build?
    • Prerequisites
    • Generating Our App
    • Getting Rid of Some Junk
    • Some Additional Development Dependencies
    • Install Ember
  • Chapter Two - Testing Setup
    • RSpec
    • Teaspoon
  • Chapter Three - Routing Specs
    • QUnit Specs (or Are They Tests?)
    • Creating a Contacts Route
    • And So a Problem Presents Itself
    • An Abstraction Trying to Get Out?
  • Chapter Four - Getting Started With Data Rendering
    • Models
    • Unit Testing Our Model
    • An Unexpected Problem
  • Chapter Five - Nested Routes
    • Defining Routes Within Resources
    • Rendering the Individual Contact
    • Refactor Tests
    • An Alternate Way of Viewing Our Specs
    • Navigating Around the App
  • Chapter Six - Persisting Data With Rails
    • Setting Up the Backend
    • Serializing the Data
    • Connecting the Backend to the Frontend!
    • More Routes Necessary
    • Adding Contacts
    • Deleting a Contact
  • Chapter 7 - Relationships in Ember
    • A Place to Store Emails
    • Testing Relationships
    • Rendering Relationships
    • Wiring Up the Relationships to Rails
    • An Email Model
    • Contact Relationship
    • Email Relationship
    • Email Controller and Routes
    • Serializing and Relationships
  • Chapter 8 - Unit Testing Computed Properties
  • Chapter 9 - Creating and Updating Emails on the Frontend
    • Faking HTTP Requests
    • Reimplementing RESTAdapter in Tests
    • Saving Associations
    • Dealing With Failed Saves
    • Testing JSON Responses in Rails

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub