Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use a template for SimpleCov init

  • Loading branch information...
commit 2787281c56a143639a9a0fa7d6f87d20f2502c43 1 parent 44c51c1
Joe Ferris jferris authored croaky committed
Showing with 13 additions and 6 deletions.
  1. +10 −6 lib/suspenders/app_builder.rb
  2. +3 −0  templates/simplecov_init.rb
16 lib/suspenders/app_builder.rb
View
@@ -2,8 +2,6 @@ module Suspenders
class AppBuilder < Rails::AppBuilder
include Suspenders::Actions
- SIMPLECOV_INIT = %{require 'simplecov'\nSimpleCov.start 'rails'\n\n}
-
def readme
template 'README.md.erb', 'README.md'
end
@@ -138,7 +136,7 @@ def configure_action_mailer
def generate_rspec
generate 'rspec:install'
inject_into_file '.rspec', " --drb", :after => '--color'
- prepend_file 'spec/spec_helper.rb', SIMPLECOV_INIT
+ prepend_file 'spec/spec_helper.rb', simplecov_init
replace_in_file 'spec/spec_helper.rb',
'# config.mock_with :mocha', 'config.mock_with :mocha'
end
@@ -152,11 +150,13 @@ def configure_capybara_webkit
def generate_cucumber(options = {})
generate 'cucumber:install', '--rspec', '--capybara'
inject_into_file 'config/cucumber.yml',
- ' -drb -r features', :after => %{default: <%= std_opts %> features}
- copy_file 'features_support_env.rb', 'features/support/env.rb',
+ ' -drb -r features',
+ :after => %{default: <%= std_opts %> features}
+ copy_file 'features_support_env.rb',
+ 'features/support/env.rb',
:force => true
+ prepend_file 'features/support/env.rb', simplecov_init
- prepend_file 'features/support/env.rb', SIMPLECOV_INIT
if options[:webkit]
inject_into_file 'features/support/env.rb',
"\n Capybara.javascript_driver = :webkit",
@@ -275,5 +275,9 @@ def override_path_for_tests
"PATH=#{support_bin}:$PATH"
end
end
+
+ def simplecov_init
+ IO.read(find_in_source_paths('simplecov_init.rb'))
+ end
end
end
3  templates/simplecov_init.rb
View
@@ -0,0 +1,3 @@
+require 'simplecov'
+SimpleCov.start 'rails'
+
Please sign in to comment.
Something went wrong with that request. Please try again.