Forum: RSpec script/general rspec_*

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nicholas Van W. (Guest)
on 2009-04-30 17:20
(Received via mailing list)
I have started using rspec after generating much of my applications
models
and controllers. Much of the code is plain vanilla scaffolding.
I accept that this is not very BDD, but I'm building a tool that
required I
do this.

Is there a quick way to generate the test stubs- i.e. the equivalent of
the
Test::Unit ones I now have? Can I run "script/generate rspec_model
<model>"
and the same for controllers on over-top of things?

Thanks,
Nick
David C. (Guest)
on 2009-04-30 17:25
(Received via mailing list)
On Thu, Apr 30, 2009 at 8:19 AM, Nicholas Van W.
<removed_email_address@domain.invalid> wrote:
> I have started using rspec after generating much of my applications models
> and controllers. Much of the code is plain vanilla scaffolding.
> I accept that this is not very BDD, but I'm building a tool that required I
> do this.
> Is there a quick way to generate the test stubs- i.e. the equivalent of the
> Test::Unit ones I now have? Can I run "script/generate rspec_model <model>"
> and the same for controllers on over-top of things?

$ script/generate
....
Installed Generators
  Rubygems: acts_as_taggable_on_migration, cucumber, feature,
install_rubigen_scripts, rspec, rspec_controller, rspec_model,
rspec_scaffold, session
  Builtin: controller, helper, integration_test, mailer, metal,
migration, model, observer, performance_test, plugin, resource,
scaffold, session_migration

Note rspec_controller, rspec_model, rspec_scaffold

Cheers,
David
Nicholas Van W. (Guest)
on 2009-05-01 08:17
(Received via mailing list)
On Thu, Apr 30, 2009 at 9:24 AM, David C.
<removed_email_address@domain.invalid>wrote:

> > Test::Unit ones I now have? Can I run "script/generate rspec_model
> migration, model, observer, performance_test, plugin, resource,
> > rspec-users mailing list
> > removed_email_address@domain.invalid
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/rspec-users
>

I saw those. My question is whether they run fine if model, controller,
scaffold have already been run.

Thanks,
Nick
David C. (Guest)
on 2009-05-01 08:29
(Received via mailing list)
On Thu, Apr 30, 2009 at 8:57 AM, Nicholas Van W.
<removed_email_address@domain.invalid> wrote:
>> > do this.
>> install_rubigen_scripts, rspec, rspec_controller, rspec_model,
>> > Thanks,
>> > Nick
> I saw those. My question is whether they run fine if model, controller,
> scaffold have already been run.

No reason they shouldn't. You should get the opportunity to
approve/deny any files that already exist, and the new files will just
get written.

Let us know if you run into any problems.

Cheers,
David
Josh Nichols (Guest)
on 2009-05-01 08:58
(Received via mailing list)
If its existing models you're dealing with, you probably will want to
add --skip-migration. Just skip over replacing the model.

- Josh
This topic is locked and can not be replied to.