Rspec-2 around/before(:all) hooks
I’m trying to create several model instances before all of our tests are
run. I’m having trouble defining the behavior in my Rspec.configure
block. I’ve tried before(:all) and around(:all), but to no avail.
before(:all) successfully creates the models, but it appears that
everything in the block passed is rolled back before the test runs:
@person = Person.create(:name => ‘not here!’)
p Person.where(:short_name => ‘not here!’).first #=> nil
p @person #=> <Person id: 1050608284, name: “not here!”>
@person.reload #=> Error: Couldn’t find Person with ID=1050608284
It seems that around(:all) is not supported, either. Is that correct?
This code in the block passed to configure results in a nil.<< error:
I’m running rspec-2.0.1 and rails-3.0.0. Is there a preferred way to do
this that I’m missing? Thanks in advance!