ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

RSpec basics

draft
Date: 2013-08-10
Tags: rspec unittesting programming notes

RSpec is a Ruby library designed for creating Specifications, to test the intended behavior of Ruby code. Unit-test your code =)

So, RSpec files follow a basic format, and understanding this format can help make test-writing easier.

context describe ... Feature before ... specify object state it ... verify Behavior

repeat =)

Using the 'context' or 'describe' command, describe a Feature

context "on homepage" do describe "the sign-up process" do before do # create User # specify website basics, generate Companies for Apartment, etc.

By Ryan Wold · © 2013–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Tip: $afomi on HandCash · afomi@handcash.io