spec/integration/integration_helper.rb in lhm-1.2.0 vs spec/integration/integration_helper.rb in lhm-1.3.0
- old
+ new
@@ -48,10 +48,14 @@
elsif defined?(DataMapper)
adapter = DataMapper.setup(:default, "mysql://root@localhost:#{port}/lhm")
end
Lhm.setup(adapter)
+ unless defined?(@@cleaned_up)
+ Lhm.cleanup(true)
+ @@cleaned_up = true
+ end
@connection = Lhm::Connection.new(adapter)
end
def select_one(*args)
@connection.select_one(*args)
@@ -151,7 +155,20 @@
# Environment
#
def master_slave_mode?
!!ENV["MASTER_SLAVE"]
+ end
+
+ #
+ # Misc
+ #
+
+ def capture_stdout
+ out = StringIO.new
+ $stdout = out
+ yield
+ return out.string
+ ensure
+ $stdout = ::STDOUT
end
end