Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use a template for SimpleCov init

  • Loading branch information...
commit 2787281c56a143639a9a0fa7d6f87d20f2502c43 1 parent 44c51c1
Joe Ferris authored October 22, 2012 croaky committed October 22, 2012
16  lib/suspenders/app_builder.rb
@@ -2,8 +2,6 @@ module Suspenders
2 2
   class AppBuilder < Rails::AppBuilder
3 3
     include Suspenders::Actions
4 4
 
5  
-    SIMPLECOV_INIT = %{require 'simplecov'\nSimpleCov.start 'rails'\n\n}
6  
-
7 5
     def readme
8 6
       template 'README.md.erb', 'README.md'
9 7
     end
@@ -138,7 +136,7 @@ def configure_action_mailer
138 136
     def generate_rspec
139 137
       generate 'rspec:install'
140 138
       inject_into_file '.rspec', " --drb", :after => '--color'
141  
-      prepend_file 'spec/spec_helper.rb', SIMPLECOV_INIT
  139
+      prepend_file 'spec/spec_helper.rb', simplecov_init
142 140
       replace_in_file 'spec/spec_helper.rb',
143 141
         '# config.mock_with :mocha', 'config.mock_with :mocha'
144 142
     end
@@ -152,11 +150,13 @@ def configure_capybara_webkit
152 150
     def generate_cucumber(options = {})
153 151
       generate 'cucumber:install', '--rspec', '--capybara'
154 152
       inject_into_file 'config/cucumber.yml',
155  
-        ' -drb -r features', :after => %{default: <%= std_opts %> features}
156  
-      copy_file 'features_support_env.rb', 'features/support/env.rb',
  153
+        ' -drb -r features',
  154
+        :after => %{default: <%= std_opts %> features}
  155
+      copy_file 'features_support_env.rb',
  156
+        'features/support/env.rb',
157 157
         :force => true
  158
+      prepend_file 'features/support/env.rb', simplecov_init
158 159
 
159  
-      prepend_file 'features/support/env.rb', SIMPLECOV_INIT
160 160
       if options[:webkit]
161 161
         inject_into_file 'features/support/env.rb',
162 162
           "\n  Capybara.javascript_driver = :webkit",
@@ -275,5 +275,9 @@ def override_path_for_tests
275 275
         "PATH=#{support_bin}:$PATH"
276 276
       end
277 277
     end
  278
+
  279
+    def simplecov_init
  280
+      IO.read(find_in_source_paths('simplecov_init.rb'))
  281
+    end
278 282
   end
279 283
 end
3  templates/simplecov_init.rb
... ...
@@ -0,0 +1,3 @@
  1
+require 'simplecov'
  2
+SimpleCov.start 'rails'
  3
+

0 notes on commit 2787281

Please sign in to comment.
Something went wrong with that request. Please try again.