» tagged pages
» logout

(Feed found, click Add Page to syndicate.) Error finding feed, please try again » Find feed title

A Blog Page allows you to add entries, for news or other time sensitive postings

(Login required to save to your tagged pages.)
(or Cancel)

Recent Page Changes for Ruby, Rails and Related

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

February 22, 2006

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html...

» complete change

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , using [[MySQL]] as my database, I had a some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rails now, by default, relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state in this scheme.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> in your Rails project to disable transactional fixtures to set <pre>use_transactional_fixtures=false</pre> and <pre>use_instantiated_fixtures=true</pre>

This gets things behaving as the book (which BTW is very good) would lead you believe they would.

Undo this change because:
edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> in your Rails project to disable transactional...

» complete change

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rails now, by default, relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state in this scheme.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> in your Rails project to disable transactional fixtures to set <pre>use_transactional_fixtures=false</pre> and <pre>use_instantiated_fixtures=true</pre> <pre>use_instantiated_fixtures=true</pre>.

This gets things behaving as the book (which BTW is very good) would lead you believe they would.

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> in your Rails project to disable transactional...

» complete change

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rails now, by default, relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state in this scheme.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> in your Rails project to disable transactional fixtures to set <pre>use_transactional_fixtures=false</pre> =use_transactional_fixtures=false= and <pre>use_instantiated_fixtures=true</pre>. =use_instantiated_fixtures=true=.

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> =test/test_helper.rb= in your Rails project...

» complete change

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rails now, by default, relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state in this scheme.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit <pre>test/test_helper.rb</pre> =test/test_helper.rb= in your Rails project to disable transactional fixtures to set =use_transactional_fixtures=false= and =use_instantiated_fixtures=true=.

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

It seems that Rails Rail now, by default, default relies on database transactions to restore the database to its pre-test-run...

» complete change

While following the discussion in chapter 12 of "Agile Web Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rails Rail now, by default, default relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state in this scheme. state.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit =test/test_helper.rb= in your Rails project to disable transactional fixtures to set =use_transactional_fixtures=false= and =use_instantiated_fixtures=true=.

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

While following the discussion in chapter 12 of "Agile Web _Agile Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html...

» complete change

While following the discussion in chapter 12 of "Agile Web _Agile Development in Rails":http://pragmaticprogrammer.com/titles/rails/index.html , Rails_, using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rail now, by default relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit =test/test_helper.rb= in your Rails project to disable transactional fixtures to set =use_transactional_fixtures=false= and =use_instantiated_fixtures=true=.

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006
User:jerryk Ruby Rails database transactions unit-testing fixtures MySQL

While following the discussion in chapter 12 of _Agile Development in Rails_, Rails_ by Dave Thomas, using [[MySQL]] as my database,...

» complete change

While following the discussion in chapter 12 of _Agile Development in Rails_, Rails_ by Dave Thomas, using [[MySQL]] as my database, I had some few frustrating moments with test fixtures.

I found that the database contents specified in my test fixture were _not_ being restored between the runs of individual test cases, thereby causing every test after the first one that removed something from the database to fail.

Some digging around seemed to show that the behavior had changed in Rails 1.0 and that the text of my printing of the book seems to be, understandably, a bit out of date.

It seems that Rail now, by default relies on database transactions to restore the database to its pre-test-run state. If your MySQL setup is using the defaut MyISAM engine for its tables, transactions aren't supported, and the database will _not_ be returned to its initial state.

To deal with this problem you have two options:

* *Use MySQL Transactions:* Create your database tables using the transaction-supporting InnoDB engine. There's a good chance you want to do this for other reasons anyway.

* *Change Rails' Behavior to that of pre-1.0:* Edit =test/test_helper.rb= in your Rails project to disable transactional fixtures to set =use_transactional_fixtures=false= and =use_instantiated_fixtures=true=.

database...

edit by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006

While following the discussion in chapter 12 of _Agile Development in Rails_ by Dave Thomas, using [[MySQL]] {{MySQL}} as my database...

created by jerryk

A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

January 10, 2006
The entry was created.
User:jerryk
http://
A Surprising Change in Rails 1.0 Involving Test Fixtures and Transactions

While following the discussion in chapter 12 of _Agile Development in Rails_ by Dave Thomas, using {{MySQL}} as my database...

Undo this change because:
Username:
Password:
(or Cancel)