rspec_skel: A minimal RSpec skeleton

👉This project’s page at GitHub

This project’s homepage is published at GitHub: dadooda/rspec_skel. All links point there, too.

Overview

This is a minimal stand-alone Ruby project with a ready-to-use RSpec setup. It can be used as a starting point to try and prototype your own tests on almost every OS, version of Ruby, or RSpec itself.

Setup

💡 It’s assumed that you have Git installed.

Clone this repository:

git clone git@github.com:dadooda/rspec_skel.git

Install the gems:

bundle install

Edit .gitignore and remove these two lines:

# REMOVE this comment and the line following it …
/Gemfile.lock

Remove linkage to the skeleton repo, and initialize your own:

rm -rf .git &&
git init

Usage

💡 It’s assumed that you have Ruby installed.

The class files are located in lib/. The spec files are located in spec/.

Run RSpec

bundle exec rspec

With coverage:

SPEC_COV=! bundle exec rspec

Generate YARD documentation

bundle exec yard

The docs are rendered in doc/. Open doc/index.html to browse.

Shell extensions

The project comes bundled with a few optional shell extensions some may find convenient. The extensions are located in shell/. To load them all at once, do a:

. shell/all.sh

⚠️ Only Bash is supported at the moment.

Here’s a brief summary:

Command File Action
b bundler.sh A shorter alias to bundle.
bx bundler.sh A shorter alias to bundle exec.
cov rspec.sh Run sp with coverage enabled.
rc rg.sh rg with colors and other friendly options baked in.
sp rspec.sh Run RSpec tests matching a given Egrep mask.

Please contribute

All contributions are welcome. Please fork and propose your changes via pull requests, or contact me directly.

Spread a word

If you like this product, please star⭐ it and mention it in friendly social media. That’d be fantastic if more people use and contribute to this product.

The product is free software distributed under the terms of the MIT license.

— © 2024 Alex Fortuna