spec/shared/users_and_tasks.rb in rom-sql-0.1.1 vs spec/shared/users_and_tasks.rb in rom-sql-0.2.0

- old
+ new

@@ -1,35 +1,8 @@ shared_context 'users and tasks' do - subject(:rom) { setup.finalize } + include_context 'database setup' - let(:setup) { ROM.setup(postgres: 'postgres://localhost/rom') } - let(:conn) { setup.postgres.connection } - before do - [:users, :tasks, :tags, :task_tags].each { |name| conn.drop_table?(name) } - - conn.create_table :users do - primary_key :id - String :name - end - - conn.create_table :tasks do - primary_key :id - Integer :user_id - String :title - end - - conn.create_table :tags do - primary_key :id - String :name - end - - conn.create_table :task_tags do - primary_key :tag_id, :task_id - Integer :tag_id - Integer :task_id - end - conn[:users].insert id: 1, name: 'Piotr' conn[:tasks].insert id: 1, user_id: 1, title: 'Finish ROM' conn[:tags].insert id: 1, name: 'important' conn[:task_tags].insert(tag_id: 1, task_id: 1) end