** Create the plugin without test-unit and specify the path for the dummy application:
rails plugin new $project_name --skip-test-unit --dummy-path=spec/dummy --mountable
** Add rspec-rails as a development dependency to the gemspec file (foobar.gemspec):
Gem::Specification.new do |s|
.
.
.
s.add_development_dependency "rspec-rails"
end
Run bundle install
**Create a symlink from the dummy app to the plugin spec directory and run the Rspec install generator:
cd spec/dummy
ln -s ../../spec
rails generate rspec:install
cd -
** Now edit spec/spec_helper.rb changing this line (line 3):
require File.expand_path("../../config/environment", __FILE__)
To this:
require File.expand_path("../dummy/config/environment", __FILE__)
Now you can run Rspec from the root of your plugin and it will pick up specs from the dummy application as well.
bundle exec rspec spec