add coverage tool
This commit is contained in:
parent
062aebe5f2
commit
ba25c41082
@ -36,4 +36,5 @@ end
|
|||||||
group :devepoment do
|
group :devepoment do
|
||||||
gem 'byebug'
|
gem 'byebug'
|
||||||
gem 'guard-rspec', require: false
|
gem 'guard-rspec', require: false
|
||||||
|
gem 'simplecov', require: false
|
||||||
end
|
end
|
||||||
|
|||||||
@ -60,6 +60,7 @@ GEM
|
|||||||
gherkin (~> 2.12.0)
|
gherkin (~> 2.12.0)
|
||||||
daemons (1.2.3)
|
daemons (1.2.3)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
|
docile (1.1.5)
|
||||||
em-websocket (0.3.8)
|
em-websocket (0.3.8)
|
||||||
addressable (>= 2.1.1)
|
addressable (>= 2.1.1)
|
||||||
eventmachine (>= 0.12.9)
|
eventmachine (>= 0.12.9)
|
||||||
@ -291,6 +292,11 @@ GEM
|
|||||||
json
|
json
|
||||||
redis (>= 3.0.6)
|
redis (>= 3.0.6)
|
||||||
redis-namespace (>= 1.3.1)
|
redis-namespace (>= 1.3.1)
|
||||||
|
simplecov (0.11.1)
|
||||||
|
docile (~> 1.1.0)
|
||||||
|
json (~> 1.8)
|
||||||
|
simplecov-html (~> 0.10.0)
|
||||||
|
simplecov-html (0.10.0)
|
||||||
sinatra (1.4.5)
|
sinatra (1.4.5)
|
||||||
rack (~> 1.4)
|
rack (~> 1.4)
|
||||||
rack-protection (~> 1.4)
|
rack-protection (~> 1.4)
|
||||||
@ -352,9 +358,13 @@ DEPENDENCIES
|
|||||||
rspec (~> 3.3)
|
rspec (~> 3.3)
|
||||||
rspec_junit_formatter
|
rspec_junit_formatter
|
||||||
sidekiq (= 3.2.6)
|
sidekiq (= 3.2.6)
|
||||||
|
simplecov
|
||||||
sinatra (= 1.4.5)
|
sinatra (= 1.4.5)
|
||||||
sinatra-contrib
|
sinatra-contrib
|
||||||
sinatra-websocket
|
sinatra-websocket
|
||||||
test-unit
|
test-unit
|
||||||
thin (~> 1.5.1)
|
thin (~> 1.5.1)
|
||||||
wisper
|
wisper
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.6
|
||||||
|
|||||||
@ -4,32 +4,49 @@ require 'factory_girl'
|
|||||||
require 'active_support/core_ext/hash/indifferent_access'
|
require 'active_support/core_ext/hash/indifferent_access'
|
||||||
require 'active_support/inflector'
|
require 'active_support/inflector'
|
||||||
|
|
||||||
# setup load_path and require support files
|
def suppress_output!
|
||||||
root = File.join(File.dirname(__FILE__), "..")
|
original_stdout = $stdout
|
||||||
$LOAD_PATH.push root unless $LOAD_PATH.include? root
|
$stdout = File.open(File::NULL, "w")
|
||||||
|
RSpec.configure do |config|
|
||||||
# suppress output
|
|
||||||
original_stdout = $stdout
|
|
||||||
$stdout = File.open(File::NULL, "w")
|
|
||||||
|
|
||||||
Dir[("./spec/support/**/*.rb")].each { |f| require f }
|
|
||||||
Dir[("./spec/shared_contexts/**/*.rb")].each { |f| require f }
|
|
||||||
|
|
||||||
# Factory girl configuration
|
|
||||||
FactoryGirl.define do
|
|
||||||
# do not try to persist, but raise validation errors
|
|
||||||
to_create { |model| model.validate! }
|
|
||||||
end
|
|
||||||
FactoryGirl.find_definitions
|
|
||||||
|
|
||||||
# RSpec configuration
|
|
||||||
RSpec.configure do |config|
|
|
||||||
config.include FactoryGirl::Syntax::Methods
|
|
||||||
|
|
||||||
config.after(:all) do
|
config.after(:all) do
|
||||||
$stdout = original_stdout
|
$stdout = original_stdout
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_coverage
|
||||||
|
require 'simplecov'
|
||||||
|
SimpleCov.start do
|
||||||
|
add_filter { |src| src.filename =~ /spec\// }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def require_support_files
|
||||||
|
root = File.join(File.dirname(__FILE__), "..")
|
||||||
|
$LOAD_PATH.push root unless $LOAD_PATH.include?(root)
|
||||||
|
Dir[("#{root}/spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
Dir[("#{root}/spec/shared_contexts/**/*.rb")].each { |f| require f }
|
||||||
|
end
|
||||||
|
|
||||||
|
def setup_factory_girl
|
||||||
|
FactoryGirl.define do
|
||||||
|
# do not persist, but raise validation errors
|
||||||
|
to_create { |model| model.validate! }
|
||||||
|
end
|
||||||
|
FactoryGirl.find_definitions
|
||||||
|
RSpec.configure { |config| config.include FactoryGirl::Syntax::Methods }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# extra configuration
|
||||||
|
suppress_output!
|
||||||
|
check_coverage if ENV['COVERAGE']
|
||||||
|
require_support_files
|
||||||
|
setup_factory_girl
|
||||||
|
|
||||||
|
|
||||||
|
# RSpec configuration
|
||||||
|
RSpec.configure do |config|
|
||||||
# rspec-expectations config goes here. You can use an alternate
|
# rspec-expectations config goes here. You can use an alternate
|
||||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||||
# assertions if you prefer.
|
# assertions if you prefer.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user