Carina C. Zona bio photo

Carina C. Zona

Email Twitter LinkedIn

Writing tests with Rspec is all about disssing your code and mockery. Feel free to point and laugh at it, too.

Kidding. But it does give us a handy-dandy mnemonic for basic Rspec syntax

describe Project do
  it "should be able to abbreviate its name" do
    mock_project = mock_model(Project, :name => "My Big Project")
    mock_project.abbr.should == "MyBP"
  end
end
  1. Describe
  2. It
  3. Spec
  4. Mock

Hmm. An optional Context throws this off a bit.  Well, you'll just have to memorize "d(c)is" on your own.

(Example courtesy of "Rails Test Prescriptions")