Ember.js - Testing on Rails
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.
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.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 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