[rspec-users] Does RSpec work nicely with UUID primary keys?

Jarkko Laine jarkko at jlaine.net
Sat Jul 5 16:11:29 EDT 2008


On 5.7.2008, at 18.37, John Knox wrote:

> David Chelimsky wrote:
>> What happens when you run the generated examples?
>
> My code uses single table inheritance (STI) and a MySQL database, so I
> thought it best to create some new simple projects with a single  
> model.
>
> (1) I created a new project using SQLite with a single model.  All 58
> auto-generated specifications ran successfully.
>
> (2) I created a new single-model project using SQLite but added a UUID
> primary key.  All 58 auto-generated specifications ran successfully.
>
> (3) I created a new project using MySQL with a single model.  Again,  
> all
> 58 auto-generated specifications ran successfully.
>
> (4) (2) I created a new single-model project using MySQL but added a
> UUID primary key.  All 58 auto-generated specifications ran
> successfully.
>
> Hmm.  So, it's not the UUIDs that are causing problems with my
> application... but perhaps single table inheritance.  Will do more  
> tests
> and post again when I've better defined the problem.

The thing is, the scaffolding specs are specs for the behaviour of the  
scaffolded controllers/models/views. If you want to change that  
behaviour, your specs should reflect that assumption. If you add some  
new code (without writing new specs for it), even in the form of using  
plugins,  and your existing specs still run, it doesn't mean your code  
is working correctly because you didn't write specs for that part of  
the functionality yet. Using UUID probably changes things so little  
that (especially if/when they mock the models) it won't trip the  
scaffolding specs per se.

//jarkko

--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080705/1ef777a7/attachment.bin>


More information about the rspec-users mailing list