I have a set of Test::Unit tests for a Rails application. It was developed on OS X under Ruby 1.8.6, Rails 2.3.4.
I'm also using thoughtbot-shoulda 2.10.2.
I'm using standard Rails fixtures, not factories.
I've checked out the project onto a CentOS Linux 5 workstation for another developer to work on. He's running Ruby 1.8.7.
(The app is running on CentOS Linux 5 in production, and it's working fine there.)
On my coworker's CentOS dev machine, all of the unit tests are passing.
However, most, but not all, of the functional tests are erroring out. I've isolated one test (removing all the others from the project) to narrow down the troubleshooting scope.
context 'on DELETE to :destroy' do
setup {
delete(:destroy, { :id => addresses(:mary_publics_address).id }, stans_id)
}
should 'delete the address' do
assert Address.find(:all, :conditions => {
:id => addresses(:mary_publics_address).id
} ).blank?
end
should 'delete the addresses phone numbers' do
assert PhoneNumber.find(:all, :conditions => {
:id => phone_numbers(:mary_publics_phone_number).id
} ).blank?
end
end
The error we're getting is...
[abc@abc contactdb]$ rake test:functionals --trace
(in /home/abc/projects/contactdb)
[ ... ]
/usr/local/ruby_187/bin/ruby -I"lib:test" "/home/abc/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/addresses_controller_test.rb"
Loaded suite /home/abc/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.E
Finished in 0.426749 seconds.
1) Error:
test: on DELETE to :destroy should delete the addresses phone numbers. (AddressesControllerTest):
ActiveRecord::RecordNotFound: Couldn't find Address with ID=1254595889
/test/functional/addresses_controller_test.rb:107:in `__bind_1255114457_160068'
/usr/local/ruby_187/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:369:in `call'
/usr/local/ruby_187/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:369:in `run_current_setup_blocks'
/usr/local/ruby_187/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:368:in `each'
/usr/local/ruby_187/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:368:in `run_current_setup_blocks'
/usr/local/ruby_187/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:350:in `test: on DELETE to :destroy should delete the addresses phone numbers. '
2 tests, 1 assertions, 0 failures, 1 errors
rake aborted!
Command failed with status (1): [/usr/local/ruby_187/bin/ruby -I"lib:test" ...]
I think the key mystery is why it can't find the Address
with that ID.
Another factor is that when I comment out this block, the remaining test passes.
should 'delete the addresses phone numbers' do
assert PhoneNumber.find(:all, :conditions => {
:id => phone_numbers(:mary_publics_phone_number).id
} ).blank?
end
Anyone seen this before?
Troubleshooting suggestions?