- The -T option tells rails not to include Test::Unit
- The --database=mysql tells rails to include Mysql gem and configs
- The --skip-bundle is self explanatory... rails new myapp -T --skip-bundle --database=mysql
gem 'rspec-rails'
Rails.application.config.generators do |g|
g.test_framework = :rspec
end
bundle install
rails g rspec:install
rails plugin new myengine --mountable --dummy-path=spec/dummy -T --skip-bundle
gem 'rspec-rails'
bundle install
bundle exec rails g rspec:install
The default generated spec_helper will try to load your Rails environment from the wrong place. So, change: require File.expand_path("../../config/environment", FILE) to: require File.expand_path("../../spec/dummy/config/environment", FILE)
Add the following to your “lib/myengine/engine.rb” file, inside the Engine class:
config.generators do |g|
g.test_framework :rspec
g.integration_tool :rspec
end
http://stackoverflow.com/questions/6728618/how-can-i-tell-rails-to-use-rspec-instead-of-test-unit-when-creating-a-new-rails http://whilefalse.net/2012/01/25/testing-rails-engines-rspec/