Re: Creating generator tests

Pelle
Wed, 23 May 2007 17:48:00 -0000

OK. I''ve uploaded my patch with the scaffold generator tests at:

http://dev.rubyonrails.org/ticket/8443

It also includes a generator_test_helper module, which has lots of
helpful assertions, which could be used for testing most kinds of
generators.

Regards
Pelle

On May 21, 12:04 pm, "Jeremy Kemper" <jer...@bitsweat.net>
wrote:
> On 5/21/07, Pelle <pel...@gmail.com> wrote:
>
> > I want to go in and improve the defaultscaffold(ex
> > resource_scaffold) a bit and noticed the lack of tests for generators.
>
> > So I thought I''d give people a heads up that I''m
working on creating
> > initially tests for thescaffoldgeneratoras well as test helpers to
> > make it simpler to test generators in the future. I''ll
probably go
> > through and create tests for the built in generators as well
> > eventually.
>
> Sounds great, Pelle.
>
>
>
> > I have a question about layout. I''m currently placing
thescaffold
> > tests in:
>
> > railties/test/rails_scaffold_generator_test.rb
>
> > Does that make sense naming wise? So afterwards there could be:
>
> > railties/test/rails_model_generator_test.rb
> > etc.
>
> > I''ve also created the test helpers in
>
> > railties/test/generator_test_helpers.rb
>
> > Does that follow convension or should I rather put them somewhere
> > else, to make it easier for say plugin developers to use them?
>
> how about a test subdirectory, like railties/test/generators/*
>
> > Finally as part of my testing I build up a very basic rails directory
> > structure under railties/test/fixtures/tmp and then delete it again in
> > the teardown. I have seen similar things done in the tests from
> > various plugins and it works, can anyone see any issues with that?
>
> Nope. All good.
>
> jeremy