Skip to content

Commit

Permalink
Fix Coveralls inside cukes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Spataro committed Sep 30, 2014
1 parent a244ff5 commit 121afcd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -46,7 +46,7 @@ end

# Debuggers that are used during development & test (but not in CI)
group :debugger do
gem 'debugger', '>= 1.6.6', :platforms => [:ruby_19, :ruby_20]
gem 'debugger', '>= 1.6.6', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'pry', :platforms => [:ruby_21]
gem 'pry-byebug', :platforms => [:ruby_21]
end
34 changes: 17 additions & 17 deletions features/step_definitions/ruby_steps.rb
Expand Up @@ -5,7 +5,9 @@
end

Given /^a Gemfile$/ do
gemfile = ruby_app_path('Gemfile')
gemfile = ruby_app_path('Gemfile')
simplecov = ruby_app_path('.simplecov')

unless File.exist?(gemfile)
basedir = File.expand_path('../../..', __FILE__)
File.open(gemfile, 'w') do |file|
Expand All @@ -14,6 +16,16 @@
file.puts "gem 'coveralls'" unless RUBY_VERSION =~ /^1\.8/
end
end

unless File.exist?(simplecov)
File.open(simplecov, 'w') do |file|
dir = File.expand_path('../../../coverage', __FILE__)
file.puts "require 'coveralls'"
file.puts "Coveralls.wear! do"
file.puts " coverage_dir '#{dir}'"
file.puts "end"
end
end
end

Given /^a gem dependency on '(.*)'$/ do |dependency|
Expand Down Expand Up @@ -47,10 +59,7 @@
step 'a Rakefile'
rakefile = ruby_app_path('Rakefile')
File.open(rakefile, 'w') do |file|
unless RUBY_VERSION =~ /^1\.8/
file.puts "require 'coveralls'"
file.puts "Coveralls.wear! { coverage_dir '#{File.expand_path('../../../coverage,__FILE__')}' }"
end
file.puts "require 'simplecov'" unless RUBY_VERSION =~ /^1\.8/
file.puts "require 'right_develop'"
file.puts "#{mod}::RakeTask.new(#{ns})"
end
Expand All @@ -73,10 +82,7 @@
FileUtils.mkdir_p(spec_dir)
File.open(spec, 'w') do |file|
# ensure that our formatter's coverage gets handled
unless RUBY_VERSION =~ /^1\.8/
file.puts "require 'coveralls'"
file.puts "Coveralls.wear! { coverage_dir '#{File.expand_path('../../../coverage,__FILE__')}' }"
end
file.puts "require 'simplecov'" unless RUBY_VERSION =~ /^1\.8/

# always include one passing test case as a baseline
file.puts "describe String do"
Expand Down Expand Up @@ -114,10 +120,7 @@
FileUtils.mkdir_p(spec_dir)
File.open(spec, 'w') do |file|
# ensure that our formatter's coverage gets handled
unless RUBY_VERSION =~ /^1\.8/
file.puts "require 'coveralls'"
file.puts "Coveralls.wear! { coverage_dir '#{File.expand_path('../../../coverage,__FILE__')}' }"
end
file.puts "require 'simplecov'" unless RUBY_VERSION =~ /^1\.8/

content.split("\n").each do |line|
file.puts line
Expand All @@ -139,10 +142,7 @@
unless File.exist?(env)
File.open(env, 'w') do |file|
# ensure that our formatter's coverage gets handled
unless RUBY_VERSION =~ /^1\.8/
file.puts "require 'coveralls'"
file.puts "Coveralls.wear! { coverage_dir '#{File.expand_path('../../../coverage,__FILE__')}' }"
end
file.puts "require 'simplecov'" unless RUBY_VERSION =~ /^1\.8/
end
end

Expand Down

0 comments on commit 121afcd

Please sign in to comment.