spec/spec_helper.rb in torquebox-stompbox-0.3.0 vs spec/spec_helper.rb in torquebox-stompbox-0.3.1
- old
+ new
@@ -15,16 +15,24 @@
#
require 'rack/test'
require 'stompbox'
-ENV['DATABASE_URL'] = 'postgres://stompbox:stompbox@localhost/stompbox'
+# set test environment
+Sinatra::Base.set :environment, :test
+Sinatra::Base.set :run, false
+Sinatra::Base.set :raise_errors, true
+Sinatra::Base.set :logging, false
+DataMapper.setup(:default, "sqlite3::memory:")
+
def app
@app ||= StompBox::Application.new
end
RSpec.configure do |conf|
conf.include Rack::Test::Methods
+ # reset database before each example is run
+ conf.before(:each) { DataMapper.auto_migrate! }
end