setup_database

in spec/integration/graphql_spec.rb [35:65]


    def setup_database
      ActiveRecord::Base.logger = Logger.new(SpecLogger)
      ActiveRecord::Base.logger = Logger.new(nil)

      ActiveRecord::Base.establish_connection(
        adapter: 'sqlite3',
        database: '/tmp/graphql.sqlite3'
      )

      ActiveRecord::Migration.suppress_messages do
        ActiveRecord::Schema.define do
          create_table :posts, force: true do |t|
            t.string :slug, null: false
            t.string :title, null: false
            t.timestamps
          end

          create_table :comments, force: true do |t|
            t.text :body, null: false
            t.belongs_to :post, null: false, index: true
            t.timestamps
          end
        end
      end

      a = Post.create!(slug: 'a', title: 'A')
      Post.create!(slug: 'b', title: 'B')
      Post.create!(slug: 'c', title: 'C')
      Comment.create!(post: a, body: 'So good')
    end