Hi,

Not sure this is the best place, traffic seems quite low these days.

I am wondering what is the best practice to tear down classes declared 
inside `describe` blocks.
For example:

```ruby # ./spec/foo_spec.rb require 'spec_helper' describe 'Foo' do class 
Person < ActiveRecord::Base has_many :abilities end it 'has relations' do 
expect(Person.reflections.keys).to eq %w(abilities) end end # 
./spec/bar_spec.rb require 'spec_helper' describe 'Bar' do class Person < 
ActiveRecord::Base has_many :children end it 'has relations' do 
expect(Person.reflections.keys).to eq %w(children) end end ```

Running each individual file passes but when I run both files then it fails 
(in both files with `["children", "abilities"]` in relations array).

To solve that problem, we use an `after(:all)` block to remove the constant 
with `Object.send(:remove_const, 'Person').

I'd love to hear if other people use that tear down or what is the best 
practice.

Thanks,

JM

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rspec+unsubscr...@googlegroups.com.
To post to this group, send email to rspec@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/8e469a6b-1175-4299-bf99-c90ffd587ca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to