Re: Creating generator tests

Jeremy Kemper
Mon, 21 May 2007 19:04:25 -0000

On 5/21/07, Pelle <pelleb@gmail.com> wrote:
> I want to go in and improve the default scaffold (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 the scaffold generator as 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 the scaffold
> 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