views:

227

answers:

2

Hi,

I am used to generating my rspec controllers & models using rspec_X syntax, e.g.

script/generate rspec_model Person
script/generate rspec_controller Person

However if I want to use devise to create a Person model the syntax is:

script/generate devise Person

which works OK, but does not create any of the rspec test files / dirs.

Is there are command I can use to generate both?

(Ruby 1.8, Rails 2.3)

Thanks!

A: 

These models and controllers are tested internally to Devise and so you shouldn't be duplicating the effort yourself. If you'd like to test that users can sign in, sign out, register and retrieve their password, I would recommend you use Cucumber to write tests to test Devise's integration with your application.

Ryan Bigg
A: 

I am used to generating my rspec controllers & models using rspec_X syntax

You can still use that if you want to create the rspec structures but you'll likely want to decline overwriting your model. For example, here's my rspec_model output:

$ script/generate rspec_model Person
      exists  app/models/
      create  spec/models/
      create  spec/fixtures/
overwrite app/models/person.rb? (enter "h" for help) [Ynaqdh] n
        skip  app/models/person.rb
      create  spec/models/person_spec.rb
      create  spec/fixtures/people.yml
      exists  db/migrate
      create  db/migrate/20100826043436_create_people.rb

I just told it not to overwrite app/models/person.rb.

Kaleb Pederson