Skip to content

Commit

Permalink
Unify simplecov setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tooky committed Nov 6, 2013
1 parent 9d9dd2f commit 4b8343a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
12 changes: 1 addition & 11 deletions bin/cucumber
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')

if ENV['SIMPLECOV']
begin
require 'simplecov'
SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..'))
SimpleCov.start do
add_filter 'iso-8859-1_steps.rb'
end
rescue LoadError
warn("Unable to load simplecov")
end
end
load File.expand_path(File.dirname(__FILE__) + '/../spec/simplecov_setup.rb')

require 'cucumber/rspec/disable_option_parser'
require 'cucumber/cli/main'
Expand Down
15 changes: 15 additions & 0 deletions spec/simplecov_setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if ENV['SIMPLECOV']
begin
require 'simplecov'
SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..'))
SimpleCov.start do
add_filter 'iso-8859-1_steps.rb'
add_filter '.-ruby-core/'
add_filter '/spec/'
add_filter '/features/'
end
rescue LoadError
warn("Unable to load simplecov")
end
end

8 changes: 1 addition & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
Encoding.default_internal = 'utf-8'
end

if ENV['SIMPLECOV']
require 'simplecov'
SimpleCov.start do
command_name 'rspec'
add_filter 'iso-8859-1_steps.rb'
end
end
load File.expand_path(File.dirname(__FILE__) + '/../spec/simplecov_setup.rb')

require 'cucumber'

Expand Down

0 comments on commit 4b8343a

Please sign in to comment.