Skip to Content
Docker for Rails Developers
book

Docker for Rails Developers

by Rob Isenberg
February 2019
Intermediate to advanced
240 pages
5h 25m
English
Pragmatic Bookshelf
Content preview from Docker for Rails Developers

Our First Test

Having installed RSpec in our project, it’s not very satisfying to see zero tests running. Let’s rectify that right now by creating our first test, so that we can see some actual test code running.

Let’s generate a spec for our User model:

 $ ​​docker-compose​​ ​​exec​​ ​​web​​ ​​bin/rails​​ ​​generate​​ ​​rspec:model​​ ​​user
  create spec/models/user_spec.rb

Linux Users: File Ownership

images/aside-icons/warning.png

Remember to chown the files we’ve generated so you can edit them (see File Ownership and Permissions):

 $ ​​sudo​​ ​​chown​​ ​​<your_user>:<your_group>​​ ​​-R​​ ​​.

Open the newly created spec/models/user_spec.rb file in your editor. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Rails 6: Accelerated Web Development with Ruby on Rails

Learn Rails 6: Accelerated Web Development with Ruby on Rails

Adam Notodikromo
Mastering Ruby Closures

Mastering Ruby Closures

Benjamin Tan Wei Hao

Publisher Resources

ISBN: 9781680506730Errata Page