• Stars
    star
    204
  • Rank 185,916 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An RCov-esque coverage tool for Ruby 1.9

CoverMe – Code Coverage for Ruby 1.9

Ruby 1.9(.2) is an amazing language to develop applications in. It’s faster, more powerful, cleaner, and a huge improvement over Ruby 1.8.×. Because of those reasons every Ruby developer should move to this exciting new version of our language.

When making a move of this size it’s important to have the right tools to help us along. Unfortunately, one of the most useful tools as a Ruby developer, RCov, does not work with Ruby 1.9.

RCov, for those unfamiliar analyzes your code and tells you which part of your code was not executed. This is INCREDIBLY useful when hooked up to your test suite. While, it’s not the only metric you should use when determining how good your test coverage it, it certainly is a great first step to point out exactly which parts of your code haven’t been touched at all!

Enter CoverMe.

History

While working on a Ruby 1.9/Rails 3 project, and loving everything about it (except for the lack of RCov), I came across a post by Aaron Patterson (of Nokogiri fame). In this post he quickly outlined a very basic coverage tool using the new built-in Coverage module in Ruby 1.9.

After spending a morning playing with it, I was quickly able to grow the idea into something useful for the project. Later that day the company I was consulting for (BiddingForGood.com), and in particular their chief architect, Stuart Garner, told me to take a day or two and clean it up and release it for the world to use, and so here it is.

Features

Index Page

  • Sortable column headers (File, Lines, Lines of Code, Tested %).
  • Searching/filtering by file name.
  • Filtering by coverage percent.
  • Color coded list of files to quickly see which ones are 100% covered, > 90% covered, or less than 90% covered.
  • Large color coded average coverage percent, for quick reference.

Detail Page

  • Line by line coverage report
  • Color coded lines to quickly see which lines where executed and which ones were not.
  • Side by side viewing with the corresponding test/spec file (if one exists).

Use

CoverMe is pretty easy to use, and has been tested with Ruby 1.9.2 and Rails 3. First, add CoverMe to your Gemfile:


  gem 'cover_me', '>= 1.2.0', :group => :test

Now make sure to install the gem with Bundler:


  $ bundle install

All that’s left now is to require it as the first line of your ‘spec_helper.rb’ or ‘test_helper.rb’ file:


  require 'cover_me'

Now the next time your run your test suite it will create a series of HTML files in the coverage folder at the root of your project. Open coverage/index.html and you’re off and running.

Rails 3

If you are using CoverMe with Rails 3 run the following to get the cover me Rake task:


  $ rails g cover_me:install

Configuration

CoverMe is easily configurable, under the covers it uses the Configatron library. Here are a few quick config options you might want to play with:


  CoverMe.config do |c|
    # where is your project's root:
    c.project.root # => "Rails.root" (default)
  
    # what files are you interested in coverage for:
    c.file_pattern # => [
      /(#{CoverMe.config.project.root}\/app\/.+\.rb)/i,
      /(#{CoverMe.config.project.root}\/lib\/.+\.rb)/i
    ] (default)
    
    # what files do you want to explicitly exclude from coverage
    c.exclude_file_patterns # => [] (default)
  
    # where do you want the HTML generated:
    c.html_formatter.output_path # => File.join(CoverMe.config.project.root, 'coverage') (default)
  
    # what do you want to happen when it finishes:
    c.at_exit # => Proc.new {
      if CoverMe.config.formatter == CoverMe::HtmlFormatter
        index = File.join(CoverMe.config.html_formatter.output_path, 'index.html')
        if File.exists?(index)
          `open #{index}`
        end
      end
    } (default)
  end

Contributors

  • Mark Bates
  • Andrea Campi
  • KITAITI Makoto
  • Alex Crichton
  • Leif Bladt
  • Will Marshall
  • Matthew Albright
  • Josef Sin
  • Lasse Koskela
  • Stephen Delano
  • George Anderson
  • Rob Zolkos
  • jmthomas

More Repositories

1

goth

Package goth provides a simple, clean, and idiomatic way to write authentication packages for Go web applications.
Go
4,979
star
2

pkger

Embed static files in Go binaries (replacement for gobuffalo/packr)
Go
1,187
star
3

configatron

A super cool, simple, and feature rich configuration system for Ruby apps.
Ruby
602
star
4

grift

Go based task runner
Go
431
star
5

coffee-rails-source-maps

DO NOT USE THIS!! I DO NOT MAINTAIN IT!
Ruby
241
star
6

coffeebeans

The parts of CoffeeScript they forgot in Rails 3.1!
Ruby
229
star
7

refresh

Go
190
star
8

jquery-bootstrap-pagination

CoffeeScript
91
star
9

Programming-In-CoffeeScript

Source code for the Programming in CoffeeScript book.
CoffeeScript
63
star
10

going

Some helpful packages for writing Go apps.
Go
55
star
11

dj_remixes

Enhancements and improvements for Delayed Job 2.x
Ruby
42
star
12

mack

A Ruby web application framework
Ruby
39
star
13

warp_drive

Screw Rails Engines! Why not install a Warp Drive! Completely bundle up an ENTIRE Rails application into a gem, then load it into another application! It's that easy!
Ruby
34
star
14

myvim

My VIM setup. Use at your own risk.
Vim Script
34
star
15

buffla

URL Shortner written in Buffalo
Go
30
star
16

inflect

DEPRECATED: use github.com/gobuffalo/flect instead
Go
24
star
17

fluent-2014

Source code for the Angular Fundamentals workshop at FluentConf 2014.
JavaScript
22
star
18

ghi

Offline GitHub Issues Client
Go
19
star
19

cachetastic

A very simple, yet very powerful caching framework for Ruby
Ruby
18
star
20

delayed_job_extras

This project has moved to markbates/dj_remixes. Please do not follow this project!
Ruby
17
star
21

buffalo-heroku

Archived use github.com/gobuffalo/buffalo-heroku
Go
17
star
22

mongoid-tags-arent-hard

A tagging gem for Mongoid 3 that doesn't actually suck.
Ruby
16
star
23

distribunaut

A framework agnostic port of the mack-distributed package.
Ruby
16
star
24

yamler

Tools for using YAML w/ Ruby easier.
Ruby
11
star
25

gormrecipe

An example of using Gorm with Buffalo
Go
10
star
26

mack-more

All the extra stuff you could want for the Mack Framework.
Ruby
10
star
27

mongoid_delorean

THIS PROJECT IS NOT MAINTAINED. USE AT YOUR OWN RISK. NO PRs ACCEPTED.
Ruby
9
star
28

genosaurus

A simple and easy to use generator system for Ruby
Ruby
9
star
29

gocker

Go
9
star
30

informit_articles

InformIT Articles
Ruby
7
star
31

macker-s-guide

A User's Guide to the Mack Framework
JavaScript
7
star
32

gemstub

A simple gem for creating the stub of other gems
Ruby
7
star
33

api_doc

Easily generate API docs from RSpec/Rails
Ruby
7
star
34

faraday_bang

Adds error raising ! methods to Faraday
Ruby
6
star
35

gem-freezer

A simple gem that helps you freeze gems, and their dependencies into your project.
Ruby
5
star
36

contextual

context.Context utilities
Go
5
star
37

wailsx

WIP: Tools for working with Wails.io
Go
5
star
38

nor-dev

Development Playground for Node on Rails (NOR)
CoffeeScript
4
star
39

willie

Easy testing of Go web type stuff
Go
4
star
40

cash

A Go package for working with cash.Money :)
Go
4
star
41

oncer

Go
4
star
42

markdownr

Go
4
star
43

gobular

Go Regular Expression Tester
Go
4
star
44

gemtronics

A much better of managing your gem dependencies
Ruby
3
star
45

breach

Ruby
3
star
46

buffalo-bootstrap

A plugin for github.com/gobuffalo/buffalo for generating Bootstrap stuff
Go
3
star
47

deplist

Get a list of all the Go dependencies for the current directory
Go
3
star
48

braai

Fully Extensible Templates
Ruby
3
star
49

mack-user_auth_portlet

A collection of Portlets for the Mack Framework
Ruby
3
star
50

deano

A starter template for Sinatra Applications
Ruby
3
star
51

buffalo-rails

Go
3
star
52

sigtx

a context implementation for signal capturing
Go
3
star
53

micro-mack

A 'micro' version of the Mack Framework
Ruby
3
star
54

miki

A lightweight, Mack-based Wiki powering www.mackwiki.com
Ruby
3
star
55

jim

Go
3
star
56

mocha-coffeescript-tmbundle

TextMate/Sublime Text 2 bundle for Mocha (CoffeeScript)
2
star
57

bluffalo

Go
2
star
58

errx

Makefile
2
star
59

coke

Go
2
star
60

mark_facets

Just a collection of common extensions and add-ons I use in most Ruby/Rails projects.
Ruby
2
star
61

assoc

Go
2
star
62

chalk

Quickly and easily create a pool of `go routines`.
Go
2
star
63

rails_templates

Templates for building Rails applications
Ruby
2
star
64

control

Go
2
star
65

ekar

Ekar, a Rake replacement, maybe?
Ruby
2
star
66

rack-cachely

Rack Middleware for working with the CachelyApp Page Cache Service
Ruby
2
star
67

syncx

Go
2
star
68

opal-rb-example

A "todo" example using the Opal.rb Project.
Ruby
2
star
69

snooze_force

SnoozeForce - A Client for Saleforce.com's REST API
Ruby
2
star
70

blabber_mouth

Easy model-like notification system for Ruby. (A framework agnostic port of the mack-notifier package.)
Ruby
2
star
71

bostongo

Go
2
star
72

mytmux

1
star
73

ringo

Go
1
star
74

labs

Go
1
star
75

gjs

HTML
1
star
76

haste

Go
1
star
77

ek

A simple echo server
Go
1
star
78

content_o_matic

A gem to download the contents of a page and include them into your application.
Ruby
1
star
79

FakeWeb.js

A port of FakeWeb (Ruby) to help test JavaScript AJAX apps
CoffeeScript
1
star
80

gurl

Go
1
star
81

tt

T.T. The Test Running Bear!
Go
1
star
82

gonit

Go
1
star
83

bert

Go
1
star
84

cleo

Go
1
star
85

buffalo-trash

Go
1
star
86

bloggy

HTML
1
star
87

markbates.github.com

HTML
1
star
88

gentronics

Go
1
star
89

clio

Go
1
star
90

clam

Go
1
star
91

cobble

A very simple and easy library to help facilitate the building and creating of objects.
Ruby
1
star
92

konacha-sinatra

Ruby
1
star
93

hmax

A Golang package to make working with HMAC requests easier.
Go
1
star
94

safe

Go
1
star