In your spec_helper...
RSpec.configure do |config|
# setup transactional factory for sequel, when running transactional
tests
config.around(:each, :transactional => true) do |example|
Sequel::DATABASES.first.transaction do
example.run
raise Sequel::Error::Rollback
end
end
end
On Mar 4, 5:56?am, Zhi-Qiang Lei <zhiqiang.... at gmail.com>
wrote:> 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) }
> ? end
> end
>
> 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.... at gmail.com
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at
rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users