user938363
user938363

Reputation: 10350

rails generator does not create rspec file/directory in rails 3.2.9 engine

We create rails 3.2.9 engine with the command below:

rails plugin new my_eng --mountable --dummy-path=spec/dummy

in my_eng.gemspec, rspec was added:

s.add_development_dependency "rspec-rails", ">= 2.0.0"

Run bundle install. Then in engine's root directory:

rails g rspec:install

A spec_helper.rb file is created under spec/.

The problem is that when a model or controller is created,ex, rails g model my_model..., under spec/, there is no models directory and my_model_spec.rb were created. We tried to run rails g rspec:install under spec/dummy/ and the problem remains. What's wrong with our code? Thanks for the help.

Upvotes: 2

Views: 723

Answers (1)

Rodrigo Oliveira
Rodrigo Oliveira

Reputation: 913

You gotta insert in config/application.rb something like:

config.generators do |g|
  g.template_engine :erb
  g.test_framework  :rspec, :fixture => true, :views => false
  g.integration_tool :rspec, :fixture => true, :views => true
  g.fixture_replacement :factory_girl, :dir => "spec/support/factories" 
end

Upvotes: 3

Related Questions