spec/shared/database.rb in rom-repository-1.2.0 vs spec/shared/database.rb in rom-repository-1.3.0

- old
+ new

@@ -1,19 +1,28 @@ -RSpec.shared_context 'database' do +RSpec.shared_context 'database setup' do let(:configuration) { ROM::Configuration.new(:sql, uri) } + let(:conn) { configuration.gateways[:default].connection } + let(:rom) { ROM.container(configuration) } + let(:uri) do if defined? JRUBY_VERSION 'jdbc:postgresql://localhost/rom_repository' else 'postgres://localhost/rom_repository' end end before do conn.loggers << LOGGER + end +end +RSpec.shared_context 'database' do + include_context 'database setup' + + before do [:tags, :tasks, :posts, :users, :posts_labels, :labels, :books, :reactions, :messages].each { |table| conn.drop_table?(table) } conn.create_table :books do primary_key :id