[rspec-users] How to run example group in transaction

Zhi-Qiang Lei zhiqiang.lei at gmail.com
Fri Mar 4 08:56:50 EST 2011

Dear All,

I want to wrap my example group in transaction to avoid record being created. How should I do? My rspec is 2.5.1, and ORM is Sequal. This way does not work for me. Thanks.

class RSpec::Core::ExampleGroup
  def self.run(reporter)
    DB.transaction { super(reporter); raise(Sequel::Error::Rollback) }

core_application_spec.rb:9:in `block in run': super: no superclass method `run' for RSpec::Core::ExampleGroup::Nested_1:Class (NoMethodError)

Best regards,
Zhi-Qiang Lei
zhiqiang.lei at gmail.com

More information about the rspec-users mailing list