Add metrics for testing / style / best practices
This commit is contained in:
parent
29600b12a3
commit
6708b4a501
|
@ -0,0 +1,7 @@
|
||||||
|
MetricFu::Configuration.run do |config|
|
||||||
|
config.configure_metric(:rcov) do |rcov|
|
||||||
|
rcov.coverage_file = MetricFu.run_path.join("coverage/rcov/rcov.txt")
|
||||||
|
rcov.enable
|
||||||
|
rcov.activate
|
||||||
|
end
|
||||||
|
end
|
2
Gemfile
2
Gemfile
|
@ -28,6 +28,7 @@ group :development do
|
||||||
gem 'bullet'
|
gem 'bullet'
|
||||||
gem 'better_errors'
|
gem 'better_errors'
|
||||||
gem 'quiet_assets'
|
gem 'quiet_assets'
|
||||||
|
gem 'metric_fu'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
@ -47,4 +48,5 @@ group :test do
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
gem 'capybara-webkit'
|
gem 'capybara-webkit'
|
||||||
gem 'shoulda'
|
gem 'shoulda'
|
||||||
|
gem 'simplecov', require: false
|
||||||
end
|
end
|
||||||
|
|
112
Gemfile.lock
112
Gemfile.lock
|
@ -1,6 +1,7 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
abstract_type (0.0.7)
|
||||||
actionmailer (4.2.3)
|
actionmailer (4.2.3)
|
||||||
actionpack (= 4.2.3)
|
actionpack (= 4.2.3)
|
||||||
actionview (= 4.2.3)
|
actionview (= 4.2.3)
|
||||||
|
@ -36,8 +37,13 @@ GEM
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
|
adamantium (0.2.0)
|
||||||
|
ice_nine (~> 0.11.0)
|
||||||
|
memoizable (~> 0.4.0)
|
||||||
addressable (2.3.8)
|
addressable (2.3.8)
|
||||||
arel (6.0.0)
|
arel (6.0.0)
|
||||||
|
arrayfields (4.9.2)
|
||||||
|
ast (2.0.0)
|
||||||
autoprefixer-rails (5.2.1)
|
autoprefixer-rails (5.2.1)
|
||||||
execjs
|
execjs
|
||||||
json
|
json
|
||||||
|
@ -53,6 +59,8 @@ GEM
|
||||||
bullet (4.14.7)
|
bullet (4.14.7)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.9.0)
|
uniform_notifier (~> 1.9.0)
|
||||||
|
cane (2.6.2)
|
||||||
|
parallel
|
||||||
capybara (2.4.4)
|
capybara (2.4.4)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
|
@ -62,6 +70,18 @@ GEM
|
||||||
capybara-webkit (1.6.0)
|
capybara-webkit (1.6.0)
|
||||||
capybara (>= 2.3.0, < 2.5.0)
|
capybara (>= 2.3.0, < 2.5.0)
|
||||||
json
|
json
|
||||||
|
chronic (0.10.2)
|
||||||
|
churn (0.0.35)
|
||||||
|
chronic (>= 0.2.3)
|
||||||
|
hirb
|
||||||
|
json_pure
|
||||||
|
main
|
||||||
|
rest-client (>= 1.6.0)
|
||||||
|
ruby_parser (~> 3.0)
|
||||||
|
sexp_processor (~> 4.1)
|
||||||
|
code_analyzer (0.4.5)
|
||||||
|
sexp_processor
|
||||||
|
code_metrics (0.1.3)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (4.1.0)
|
coffee-rails (4.1.0)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
|
@ -70,12 +90,20 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.9.1.1)
|
coffee-script-source (1.9.1.1)
|
||||||
|
colored (1.2)
|
||||||
|
concord (0.1.5)
|
||||||
|
adamantium (~> 0.2.0)
|
||||||
|
equalizer (~> 0.0.9)
|
||||||
database_cleaner (1.4.1)
|
database_cleaner (1.4.1)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
|
docile (1.1.5)
|
||||||
|
domain_name (0.5.24)
|
||||||
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (2.0.2)
|
dotenv (2.0.2)
|
||||||
dotenv-rails (2.0.2)
|
dotenv-rails (2.0.2)
|
||||||
dotenv (= 2.0.2)
|
dotenv (= 2.0.2)
|
||||||
railties (~> 4.0)
|
railties (~> 4.0)
|
||||||
|
equalizer (0.0.11)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.5.2)
|
execjs (2.5.2)
|
||||||
factory_girl (4.5.0)
|
factory_girl (4.5.0)
|
||||||
|
@ -85,7 +113,14 @@ GEM
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faker (1.4.3)
|
faker (1.4.3)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
|
fattr (2.2.2)
|
||||||
ffi (1.9.10)
|
ffi (1.9.10)
|
||||||
|
flay (2.6.1)
|
||||||
|
ruby_parser (~> 3.0)
|
||||||
|
sexp_processor (~> 4.0)
|
||||||
|
flog (4.3.2)
|
||||||
|
ruby_parser (~> 3.1, > 3.1.0)
|
||||||
|
sexp_processor (~> 4.4)
|
||||||
formatador (0.2.5)
|
formatador (0.2.5)
|
||||||
globalid (0.3.5)
|
globalid (0.3.5)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
|
@ -103,7 +138,11 @@ GEM
|
||||||
guard (~> 2.1)
|
guard (~> 2.1)
|
||||||
guard-compat (~> 1.1)
|
guard-compat (~> 1.1)
|
||||||
rspec (>= 2.99.0, < 4.0)
|
rspec (>= 2.99.0, < 4.0)
|
||||||
|
hirb (0.7.3)
|
||||||
|
http-cookie (1.0.2)
|
||||||
|
domain_name (~> 0.5)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
|
ice_nine (0.11.1)
|
||||||
jbuilder (2.3.1)
|
jbuilder (2.3.1)
|
||||||
activesupport (>= 3.0.0, < 5)
|
activesupport (>= 3.0.0, < 5)
|
||||||
multi_json (~> 1.2)
|
multi_json (~> 1.2)
|
||||||
|
@ -112,6 +151,7 @@ GEM
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.8.3)
|
json (1.8.3)
|
||||||
|
json_pure (1.8.2)
|
||||||
launchy (2.4.3)
|
launchy (2.4.3)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
listen (3.0.1)
|
listen (3.0.1)
|
||||||
|
@ -122,17 +162,45 @@ GEM
|
||||||
lumberjack (1.0.9)
|
lumberjack (1.0.9)
|
||||||
mail (2.6.3)
|
mail (2.6.3)
|
||||||
mime-types (>= 1.16, < 3)
|
mime-types (>= 1.16, < 3)
|
||||||
|
main (6.1.0)
|
||||||
|
arrayfields (>= 4.7.4)
|
||||||
|
chronic (>= 0.6.2)
|
||||||
|
fattr (>= 2.2.0)
|
||||||
|
map (>= 5.1.0)
|
||||||
|
map (6.5.5)
|
||||||
|
memoizable (0.4.2)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
|
metric_fu (4.12.0)
|
||||||
|
cane (~> 2.5, >= 2.5.2)
|
||||||
|
churn (~> 0.0.35)
|
||||||
|
code_metrics (~> 0.1)
|
||||||
|
coderay
|
||||||
|
flay (~> 2.1, >= 2.0.1)
|
||||||
|
flog (~> 4.1, >= 4.1.1)
|
||||||
|
launchy (~> 2.0)
|
||||||
|
metric_fu-Saikuro (~> 1.1, >= 1.1.3)
|
||||||
|
multi_json
|
||||||
|
rails_best_practices (~> 1.14, >= 1.14.3)
|
||||||
|
redcard
|
||||||
|
reek (>= 1.3.4, < 3.0)
|
||||||
|
roodi (~> 3.1)
|
||||||
|
metric_fu-Saikuro (1.1.3)
|
||||||
mime-types (2.6.1)
|
mime-types (2.6.1)
|
||||||
mini_portile (0.6.2)
|
mini_portile (0.6.2)
|
||||||
minitest (5.7.0)
|
minitest (5.7.0)
|
||||||
multi_json (1.11.2)
|
multi_json (1.11.2)
|
||||||
nenv (0.2.0)
|
nenv (0.2.0)
|
||||||
|
netrc (0.10.3)
|
||||||
nokogiri (1.6.6.2)
|
nokogiri (1.6.6.2)
|
||||||
mini_portile (~> 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
notiffany (0.0.6)
|
notiffany (0.0.6)
|
||||||
nenv (~> 0.1)
|
nenv (~> 0.1)
|
||||||
shellany (~> 0.0)
|
shellany (~> 0.0)
|
||||||
|
parallel (1.6.0)
|
||||||
|
parser (2.2.2.6)
|
||||||
|
ast (>= 1.1, < 3.0)
|
||||||
|
procto (0.0.2)
|
||||||
pry (0.10.1)
|
pry (0.10.1)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
|
@ -161,16 +229,38 @@ GEM
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
rails-deprecated_sanitizer (>= 1.0.1)
|
||||||
rails-html-sanitizer (1.0.2)
|
rails-html-sanitizer (1.0.2)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.0)
|
||||||
|
rails_best_practices (1.15.7)
|
||||||
|
activesupport
|
||||||
|
code_analyzer (>= 0.4.3)
|
||||||
|
colored
|
||||||
|
erubis
|
||||||
|
i18n
|
||||||
|
json
|
||||||
|
require_all
|
||||||
|
ruby-progressbar
|
||||||
railties (4.2.3)
|
railties (4.2.3)
|
||||||
actionpack (= 4.2.3)
|
actionpack (= 4.2.3)
|
||||||
activesupport (= 4.2.3)
|
activesupport (= 4.2.3)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
rainbow (2.0.0)
|
||||||
rake (10.4.2)
|
rake (10.4.2)
|
||||||
rb-fsevent (0.9.5)
|
rb-fsevent (0.9.5)
|
||||||
rb-inotify (0.9.5)
|
rb-inotify (0.9.5)
|
||||||
ffi (>= 0.5.0)
|
ffi (>= 0.5.0)
|
||||||
rdoc (4.2.0)
|
rdoc (4.2.0)
|
||||||
|
redcard (1.1.0)
|
||||||
|
reek (2.2.1)
|
||||||
|
parser (~> 2.2)
|
||||||
|
rainbow (~> 2.0)
|
||||||
|
unparser (~> 0.2.2)
|
||||||
|
require_all (1.3.2)
|
||||||
|
rest-client (1.8.0)
|
||||||
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
|
mime-types (>= 1.16, < 3.0)
|
||||||
|
netrc (~> 0.7)
|
||||||
|
roodi (3.3.1)
|
||||||
|
ruby_parser (~> 3.2, >= 3.2.2)
|
||||||
rspec (3.3.0)
|
rspec (3.3.0)
|
||||||
rspec-core (~> 3.3.0)
|
rspec-core (~> 3.3.0)
|
||||||
rspec-expectations (~> 3.3.0)
|
rspec-expectations (~> 3.3.0)
|
||||||
|
@ -192,6 +282,9 @@ GEM
|
||||||
rspec-mocks (~> 3.3.0)
|
rspec-mocks (~> 3.3.0)
|
||||||
rspec-support (~> 3.3.0)
|
rspec-support (~> 3.3.0)
|
||||||
rspec-support (3.3.0)
|
rspec-support (3.3.0)
|
||||||
|
ruby-progressbar (1.7.5)
|
||||||
|
ruby_parser (3.7.0)
|
||||||
|
sexp_processor (~> 4.1)
|
||||||
sass (3.4.15)
|
sass (3.4.15)
|
||||||
sass-rails (5.0.3)
|
sass-rails (5.0.3)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
|
@ -202,6 +295,7 @@ GEM
|
||||||
sdoc (0.4.1)
|
sdoc (0.4.1)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
rdoc (~> 4.0)
|
rdoc (~> 4.0)
|
||||||
|
sexp_processor (4.6.0)
|
||||||
shellany (0.0.1)
|
shellany (0.0.1)
|
||||||
shoulda (3.5.0)
|
shoulda (3.5.0)
|
||||||
shoulda-context (~> 1.0, >= 1.0.1)
|
shoulda-context (~> 1.0, >= 1.0.1)
|
||||||
|
@ -212,6 +306,11 @@ GEM
|
||||||
simple_form (3.1.0)
|
simple_form (3.1.0)
|
||||||
actionpack (~> 4.0)
|
actionpack (~> 4.0)
|
||||||
activemodel (~> 4.0)
|
activemodel (~> 4.0)
|
||||||
|
simplecov (0.10.0)
|
||||||
|
docile (~> 1.1.0)
|
||||||
|
json (~> 1.8)
|
||||||
|
simplecov-html (~> 0.10.0)
|
||||||
|
simplecov-html (0.10.0)
|
||||||
slim (3.0.6)
|
slim (3.0.6)
|
||||||
temple (~> 0.7.3)
|
temple (~> 0.7.3)
|
||||||
tilt (>= 1.3.3, < 2.1)
|
tilt (>= 1.3.3, < 2.1)
|
||||||
|
@ -241,7 +340,18 @@ GEM
|
||||||
uglifier (2.7.1)
|
uglifier (2.7.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
|
unf (0.1.4)
|
||||||
|
unf_ext
|
||||||
|
unf_ext (0.0.7.1)
|
||||||
uniform_notifier (1.9.0)
|
uniform_notifier (1.9.0)
|
||||||
|
unparser (0.2.4)
|
||||||
|
abstract_type (~> 0.0.7)
|
||||||
|
adamantium (~> 0.2.0)
|
||||||
|
concord (~> 0.1.5)
|
||||||
|
diff-lcs (~> 1.2.5)
|
||||||
|
equalizer (~> 0.0.9)
|
||||||
|
parser (~> 2.2.2)
|
||||||
|
procto (~> 0.0.2)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
|
@ -264,6 +374,7 @@ DEPENDENCIES
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
launchy
|
launchy
|
||||||
|
metric_fu
|
||||||
pry
|
pry
|
||||||
quiet_assets
|
quiet_assets
|
||||||
rails (= 4.2.3)
|
rails (= 4.2.3)
|
||||||
|
@ -272,6 +383,7 @@ DEPENDENCIES
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
shoulda
|
shoulda
|
||||||
simple_form
|
simple_form
|
||||||
|
simplecov
|
||||||
slim-rails
|
slim-rails
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
module UsersHelper
|
|
||||||
end
|
|
|
@ -1,6 +1,20 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe UsersController, type: :controller do
|
describe UsersController, type: :controller do
|
||||||
|
describe '#new' do
|
||||||
|
it 'should render :new' do
|
||||||
|
get :new
|
||||||
|
|
||||||
|
expect(response).to render_template(:new)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should assign new User to @user' do
|
||||||
|
get :new
|
||||||
|
|
||||||
|
expect(assigns(:user)).to be_a_new(User)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
let(:data) do
|
let(:data) do
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,10 @@ ENV['RAILS_ENV'] ||= 'test'
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
|
|
||||||
# Prevent database truncation if the environment is production
|
# Prevent database truncation if the environment is production
|
||||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
if Rails.env.production?
|
||||||
|
abort("The Rails environment is running in production mode!")
|
||||||
|
end
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'shoulda/matchers'
|
require 'shoulda/matchers'
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
require 'simplecov'
|
||||||
|
require 'metric_fu/logger'
|
||||||
|
require 'metric_fu/metrics/rcov/simplecov_formatter'
|
||||||
|
|
||||||
|
require 'support/simplecov'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.expect_with :rspec do |expectations|
|
config.expect_with :rspec do |expectations|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
||||||
|
SimpleCov::Formatter::HTMLFormatter,
|
||||||
|
SimpleCov::Formatter::MetricFu
|
||||||
|
]
|
||||||
|
SimpleCov.start
|
Loading…
Reference in New Issue