JC: changed first state to initial_state. Added Rails.env.test? in model and routes.rb for spec test.