TDD in Ruby Course

Sunday, November 29, 2015

Could not find 'railties' (>= 0) among 46 total gems

This happened in a Rails 5 alpha installation. Use:

bundle exec rails -v
bundle exec rails c

to resolve this issue.

Thursday, November 26, 2015

Rails 5 Quickly Book

I am updating my Rails 4.2 Quickly book to Rails 5. If you want to read it online, here are the links:

Chapter 1 : Running the Server
Chapter 2 : Hello Rails
Chapter 3 : Model
Chapter 4 : Model View Controller
Chapter 5 : View to Model
Chapter 6 : Update Article

I will be updating this blog post with more chapters as I make progress. For initial setup, checkout this article : Creating a Rails 5 Project

Tuesday, November 24, 2015


       757: unexpected token at


Escape the double quotes:

`class_exec': no block given (LocalJumpError)

This happens in Rspec if you miss the it() method. For example:

describe Car
   expect(Car.speed).to eq(0)

The error message is not beginner friendly and can be improved.

Friday, November 20, 2015

Thursday, November 19, 2015

Rename all .css.scss to .scss file

Stolen script to make upgrade to Rails 4.2 easier: Save it as .sh file, run chmod 755

#! /usr/bin/env bash

for f in $(find . -type f -iname '*.css.scss'); do

renamed=$(echo "${f}" | sed 's/.css.scss$/.scss/g')

cmd="git mv ${f} ${renamed}"

echo $cmd

eval $cmd



Monday, November 16, 2015

Wait for Ajax calls to finish

Note to myself: Create an utility similar to this : to fix the sleep hack in Stripe project.

How to set default editor for bundle open

 export BUNDLER_EDITOR='mate'

Sunday, November 15, 2015

Testing Tip

Instead of checking each attribute of a JSON response in your test, you can use json-schema for api validation. Use to generate a valid JSON schema from a valid sample data. You can delete all the links that point to and save the json file in the fixtures directory.

Could not find 'railties' (>= 0) among 46 total gem(s) (Gem::LoadError) in Rails 5 Project


zepho-mac-pro:rails5 zepho$ rails -v
/Users/zepho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 46 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/zepho/.rvm/gems/ruby-2.2.3@r5blog:/Users/zepho/.rvm/gems/ruby-2.2.3@global', execute `gem env` for more information
from /Users/zepho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/zepho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /Users/zepho/.rvm/gems/ruby-2.2.3@r5blog/bin/rails:22:in `


zepho-mac-pro:rails5 zepho$ bundle check
Resolving dependencies...
The Gemfile's dependencies are satisfied
zepho-mac-pro:rails5 zepho$ gem list rails

*** LOCAL GEMS ***

jquery-rails (4.0.5)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-html-sanitizer (1.0.2)
sprockets-rails (2.3.3)
zepho-mac-pro:rails5 zepho$ gem list railties

*** LOCAL GEMS ***

zepho-mac-pro:rails5 zepho$ gem install rails
Fetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Fetching: activesupport-4.2.5.gem (100%)
Successfully installed activesupport-4.2.5
Fetching: actionview-4.2.5.gem (100%)
Successfully installed actionview-4.2.5
Fetching: actionpack-4.2.5.gem (100%)
Successfully installed actionpack-4.2.5
Fetching: railties-4.2.5.gem (100%)
Successfully installed railties-4.2.5
Fetching: activejob-4.2.5.gem (100%)
Successfully installed activejob-4.2.5
Fetching: actionmailer-4.2.5.gem (100%)
Successfully installed actionmailer-4.2.5
Fetching: arel-6.0.3.gem (100%)
Successfully installed arel-6.0.3
Fetching: activemodel-4.2.5.gem (100%)
Successfully installed activemodel-4.2.5
Fetching: activerecord-4.2.5.gem (100%)
Successfully installed activerecord-4.2.5
Fetching: rails-4.2.5.gem (100%)
Successfully installed rails-4.2.5
11 gems installed
zepho-mac-pro:rails5 zepho$ rails -v
Rails 5.0.0.alpha

Creating a Rails 5 Project

1. Create a Gemfile

source ""

ruby '2.2.3'

gem 'rack', github: 'rack/rack'
gem 'rails', git: 'git://'
gem 'arel', git: 'git://'

2. bundle

3. bundle exec rails new . --dev --force

4. bundle exec rails s

Go to localhost:3000, you should now see 5.0.0.alpha in the environment.


Setting up Rails 5 app from edge