# Why is sentry's test fixtures nil?

**URL:** <https://www.ruby-forum.com/t/why-is-sentrys-test-fixtures-nil/121001>\
**Category:** Rails\
**Created:** [November 22, 2007, 2:51pm UTC](https://www.ruby-forum.com/t/why-is-sentrys-test-fixtures-nil/121001 "2007-11-22T14:51:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![takuo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ba0ec/32.png) [@takuo](https://www.ruby-forum.com/u/takuo)\
**Post date:** [November 22, 2007, 2:51pm UTC](https://www.ruby-forum.com/t/why-is-sentrys-test-fixtures-nil/121001/1 "2007-11-22T14:51:11Z")

</div>

## I tried sentry plugin’s test. It occured error with below message.

# rake test DB=‘mysql’

– create\_table(“users”, {:force=\>true})  
-\> 0.0214s  
– initialize\_schema\_information()  
-\> 0.0006s  
– columns(“schema\_info”)  
-\> 0.0021s  
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/  
rake\_test\_loader  
Started  
EE…EE…E.FE…  
Finished in 0.049832 seconds.

1. Error:  
test\_should\_decrypt\_creditcard(AsymmetricSentryCallbackTest):  
NoMethodError: undefined method `[]' for nil:NilClass /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/fixtures.rb:498:in`users’  
./test/asymmetric\_sentry\_callback\_test.rb:28:in  
`test\_should\_decrypt\_creditcard’

2. Error:  
test\_should\_decrypt\_encrypted\_creditcard(AsymmetricSentryCallbackTest):  
NoMethodError: undefined method `[]' for nil:NilClass /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/fixtures.rb:498:in`users’  
./test/asymmetric\_sentry\_callback\_test.rb:54:in  
`test\_should\_decrypt\_encrypted\_creditcard’

…

1. Error:  
test\_should\_return\_nil\_on\_invalid\_key(SymmetricSentryCallbackTest):  
NoMethodError: undefined method `[]' for nil:NilClass /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/fixtures.rb:498:in`users’  
./test/symmetric\_sentry\_callback\_test.rb:26:in  
`test\_should\_return\_nil\_on\_invalid\_key’

30 tests, 53 assertions, 1 failures, 6 errors

* * *

These error may be caused by failure of fixtures initializations.  
How can i fix this problem?  
I tried it under below environment.

Ruby version 1.8.6 (i686-darwin8.10.2)  
RubyGems version 0.9.4  
Rails version 1.2.3  
Active Record version 1.15.3  
Action Pack version 1.13.3  
Action Web Service version 1.2.3  
Action Mailer version 1.3.3  
Active Support version 1.4.2

---

<div class="post-metadata">

**Author:** ![takuo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7ba0ec/32.png) [@takuo](https://www.ruby-forum.com/u/takuo)\
**Post date:** [November 23, 2007, 6:08am UTC](https://www.ruby-forum.com/t/why-is-sentrys-test-fixtures-nil/121001/2 "2007-11-23T06:08:50Z")

</div>

I found the reason why fixtures had not been initialized.  
The fixtures is initialized by  
Test::Unit::TestCase#setup\_with\_fixtures, it is aliased :setup,  
which is required that ActiveRecord::Base.configurations is not nil

I added code to set ActiveRecord::Base.configurations below code.

– abstract\_unit.rb 2007-11-23 14:00:26.000000000 +0900  
+++ abstract\_unit.new 2007-11-23 14:04:40.000000000 +0900  
@@ -12,6 +12,7 @@

config = YAML::load(IO.read(config\_location))  
ActiveRecord::Base.logger = Logger.new(File.dirname( **FILE** ) + “/  
debug.log”)  
+ActiveRecord::Base.configurations=config  
ActiveRecord::Base.establish\_connection(config[ENV[‘DB’] ||  
‘sqlite’])

load(File.dirname( **FILE** ) + “/schema.rb”)
