Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Development Environment

Luc Donnet edited this page Jan 5, 2015 · 3 revisions

Find the Port Address and Pause the Test

Sometimes you just want to see what's going on in the browser. Although save_and_open_page gives you some idea of what's going on, you can't really click around, because the page it gives you is static and lacking assets.

Just above the broken line in your test, add these two lines of code. Note that you have to have pry installed in your current gemset or specified in the Gemfile for this to work.

puts current_url
require 'pry'; binding.pry

Run the specs, and when they pause, copy the url and port number from the test output. Open your browser and paste the address into the window. Voila! You're now browsing your site in test mode!

Use the gem byebug

Inside any Rails application you can then invoke the debugger by calling the byebug method. Here's an example:

class PeopleController < ApplicationController
  def new
    byebug
    @person = Person.new
  end
end

Use Rails Panel with Google Chrome

You can install RailsPanel extension from the Chrome Webstore. RailsPanel is a Chrome extension for Rails development that will end your tailing of development.log. Have all information about your Rails app requests in the browser - in the Developer Tools panel. Provides insight to db/rendering/total times, parameter list, rendered views and more.

Rails Panel Screenshot