Constructing Basic Tests

The simplest tests are designed to test just one component of our code at a time, independent of how it interacts with other classes or the global state of our app. Tests consist of simple assertions such as object equality or existence. If any of our assertions fail, then the entire test fails and stops executing. We’re going to write some simple tests for an app and go through some common use cases you might run into.

Let’s create a new RubyMotion project with motion create TestFun. Remember way back in Chapter 1, Creating a New App when we discussed the default files and folders motion create generates? Well, we’re going to take a look at one folder we previously neglected: spec.

RubyMotion reads your tests ...

Get RubyMotion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.