rails generator does not create associated directory and file in rail 3.2.8 engine #8296

Closed
emclab opened this Issue Nov 22, 2012 · 9 comments

Projects

None yet

4 participants

@emclab

In rails 3.2.8 engine, when a model is created with "rails generator model my_model", there is no models/my_model_spec.rb was generated under spec directory. The rspec-rails used is 2.12.0. In engine's gemspec file, there is:

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

"rails generator rspec;Install" was executed for rspec installation. Here is the output of the rails generator:

$ rails g model category name:string description:string last_updated_by_id:integer active:boolean
invoke active_record
create db/migrate/20121122142155_create_rfqx_emc_categories.rb
create app/models/rfqx_emc/category.rb
invoke test_unit
create test/unit/rfqx_emc/category_test.rb
create test/fixtures/rfqx_emc/categories.yml

@senny
Ruby on Rails member

This could be related to #8229, which was fixed with #8262

@emclab can you verify this behavior agains rails 3-2-stable ?

@emclab

We are using rails 3.2.8 and how do I verify this behavior against rails 3-2-stable? I am kind of new to rails issue reporting. Here is the command we use to create rails engine:

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

Do we need to add option --full to command above?

@emclab

"rails plugin new my_eng --mountable --dummy-path=spec/dummy --full" did not change anything on rails 3.2.8 engine. There still is no spec file/directory created under spec.

@senny
Ruby on Rails member

I verified against 3-2-master and the problem persists. I'll investigate and report when I found the cause.

@emclab

Here is a workaround. The following code in rails engine's lib/../engine.rb will enable rspec and factory girl with rails generator:

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

If not using factory girl, the last line (about factory girl) could be removed. The code works in rails 3.2.9.

@senny senny was assigned Nov 26, 2012
@arunagw
Ruby on Rails member

Hey @senny did you got anything here ? Or this can be closed if already fixed :-)

@senny
Ruby on Rails member
@senny senny removed their assignment Feb 26, 2014
@rails-bot

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Rails team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

@emclab emclab added the stale label May 27, 2014
@rails-bot rails-bot closed this Aug 19, 2014
@rails-bot

This issue has been automatically closed because of inactivity.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment