On 23 Oct 2007, at 09:49, Courtenay wrote:
>
> On 10/23/07, James Cox <[EMAIL PROTECTED]> wrote:
>> John,
>>
>> I still think the syntax is a little wet... When you're just
>> specifying
>> lists of things (like, apples, oranges and grapes):
>>
>> <snip>
>>
>> It'd be cool if you could collapse all that:
>>
>> fruits: grape, orange, apple
>>
>
> erm, IMO this is a case for some programattic record creation in your
> actual test helper.
>
> %w( apple orange banana ).each { |fruit| Fruit.create(:name =>
> fruit) }
>
>
> my fixtures tend to be named after their function, so
>
> invalid_name:
> name: Joe'"; DROP TABLE users
> id: 4
> address: 1 Main St, ..
> email: [EMAIL PROTECTED]
>
> missing_email:
> name: Joe
> id: 5
>
fixtures which are named after their function aren't a bad idea,
however, I tend to do this within my tests:
it "Should have a valid name" do
Fruit.create(valid_fruit_fixture.without(:name))
end
So having fewer valid fixtures, and remove/add values as i need them
to test.
so having some kind of shortcut for name and the name of the fixture
mightn't be horrible.
- james
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---