Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use simplecov for C0 coverage

* Include simplecov gem in Gemfile, test group
* Insert simplecov init into spec_helper.rb, env.rb
  • Loading branch information...
commit 44c51c1a87f68f884e54083bfdc127c14298ddea 1 parent 52444eb
Joe Ferris authored August 08, 2012
18  lib/suspenders/app_builder.rb
@@ -2,6 +2,8 @@ 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
+
5 7
     def readme
6 8
       template 'README.md.erb', 'README.md'
7 9
     end
@@ -136,6 +138,7 @@ def configure_action_mailer
136 138
     def generate_rspec
137 139
       generate 'rspec:install'
138 140
       inject_into_file '.rspec', " --drb", :after => '--color'
  141
+      prepend_file 'spec/spec_helper.rb', SIMPLECOV_INIT
139 142
       replace_in_file 'spec/spec_helper.rb',
140 143
         '# config.mock_with :mocha', 'config.mock_with :mocha'
141 144
     end
@@ -146,6 +149,21 @@ def configure_capybara_webkit
146 149
       end
147 150
     end
148 151
 
  152
+    def generate_cucumber(options = {})
  153
+      generate 'cucumber:install', '--rspec', '--capybara'
  154
+      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',
  157
+        :force => true
  158
+
  159
+      prepend_file 'features/support/env.rb', SIMPLECOV_INIT
  160
+      if options[:webkit]
  161
+        inject_into_file 'features/support/env.rb',
  162
+          "\n  Capybara.javascript_driver = :webkit",
  163
+          :after => /Capybara.default_selector = :css/
  164
+      end
  165
+    end
  166
+
149 167
     def setup_guard_spork
150 168
       copy_file 'Guardfile', 'Guardfile'
151 169
     end
1  templates/Gemfile_additions
@@ -25,6 +25,7 @@ group :test do
25 25
   gem 'timecop'
26 26
   gem 'shoulda-matchers'
27 27
   gem 'launchy'
  28
+  gem 'simplecov', require: false
28 29
 end
29 30
 
30 31
 group :staging, :production do

0 notes on commit 44c51c1

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