Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Configure RSpec

* Use `--profile` flag to display slowest-running specs.
* Re-organize methods so `generate_rspec` only generates RSpec and
  `configure_rspec` only configures RSpec.
  • Loading branch information...
commit 69c7fdd5323d73b5d9eb920e452671a1732a012b 1 parent 5270a72
Dan Croak croaky authored
12 lib/suspenders/app_builder.rb
View
@@ -100,6 +100,13 @@ def add_capybara_webkit_gem
end
def configure_rspec
+ remove_file '.rspec'
+ copy_file 'rspec', '.rspec'
+ prepend_file 'spec/spec_helper.rb', simplecov_init
+ replace_in_file 'spec/spec_helper.rb',
+ '# config.mock_with :mocha',
+ 'config.mock_with :mocha'
+
generators_config = <<-RUBY
config.generators do |generate|
generate.test_framework :rspec
@@ -109,6 +116,7 @@ def configure_rspec
generate.view_specs false
end
RUBY
+
inject_into_class 'config/application.rb', 'Application', generators_config
end
@@ -133,10 +141,6 @@ 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
- replace_in_file 'spec/spec_helper.rb',
- '# config.mock_with :mocha', 'config.mock_with :mocha'
end
def configure_capybara_webkit
17 lib/suspenders/generators/app_generator.rb
View
@@ -28,13 +28,13 @@ def finish_template
def suspenders_customization
invoke :remove_files_we_dont_need
+ invoke :customize_gemfile
invoke :setup_development_environment
invoke :setup_test_environment
invoke :setup_staging_environment
invoke :create_suspenders_views
invoke :create_common_javascripts
invoke :add_jquery_ui
- invoke :customize_gemfile
invoke :setup_database
invoke :configure_app
invoke :setup_stylesheets
@@ -62,6 +62,14 @@ def setup_test_environment
say 'Setting up the test environment'
build :enable_factory_girl_syntax
build :test_factories_first
+ build :generate_rspec
+ build :configure_rspec
+
+ if options[:webkit]
+ build :configure_capybara_webkit
+ end
+
+ build :setup_guard_spork
end
def setup_staging_environment
@@ -115,17 +123,10 @@ def setup_database
def configure_app
say 'Configuring app'
- build :configure_rspec
build :configure_action_mailer
- build :generate_rspec
build :configure_time_zone
build :configure_time_formats
- if options[:webkit]
- build :configure_capybara_webkit
- end
-
- build :setup_guard_spork
build :add_email_validator
build :setup_default_rake_task
build :setup_clearance
3  templates/rspec
View
@@ -0,0 +1,3 @@
+--colour
+--drb
+--profile
Please sign in to comment.
Something went wrong with that request. Please try again.