Last active
May 12, 2016 14:12
-
-
Save tapickell/0522d66ca3a504d9f00d0c7fd3a9d203 to your computer and use it in GitHub Desktop.
An example of using the Sandi Metz Meter Gem in a test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
RSpec.describe 'Sandi Meter Results' do | |
before :all do | |
results = %x{ sandi_meter } | |
@classes,@methods,@parameters,@controllers = results.scan(/(...)[%]/).flatten.map{ |s| s.to_i } | |
end | |
it '100% of classes are under 100 lines' do | |
expect(@classes).to eq(100) | |
end | |
it '100% of methods are under 5 lines' do | |
expect(@methods).to eq(100) | |
end | |
it '100% of method calls accepted are less than 4 parameters' do | |
expect(@parameters).to eq(100) | |
end | |
it '100% of controllers have one instance variable per action' do | |
expect(@controllers).to eq(100) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment