Skip to content

RSpec Tips & Tricks

antislice edited this page Feb 13, 2013 · 9 revisions

RSpec is the unit testing framework that we're using.

Running tests

/HelloRubyTuesdays> rspec spec/                          # runs all the tests
/HelloRubyTuesdays> rspec spec/model/game_spec.rb        # runs just the tests for the Game model
/HelloRubyTuesdays> rspec spec/model/game_spec.rb:3      # runs the unit test in the Game spec that's at line 3

Basic test structure/methods

Stumbling blocks

ActionView::MissingTemplate: Missing template games/create, application/create with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :haml]}. Searched in:
  * "#<RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator:0x007ff304011108>"
Clone this wiki locally