Sha256: f56d335b94230d71053c930ec829b2fdc598a81eb0150cdbd0b3af9465d07cd0

Contents?: true

Size: 813 Bytes

Versions: 3

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "hanami db", type: :integration do
  describe "console" do
    it "starts database console" do
      with_project do
        generate_migrations
        hanami "db prepare"

        db_console do |input, _, _|
          input.puts('INSERT INTO users (id, name, age) VALUES(1, "Luca", 34);')
          input.puts("SELECT * FROM users;")
          input.puts(".quit")
        end

        expect(out).to include("1|Luca|34")
      end
    end

    it "prints help message" do
      with_project do
        output = <<~OUT
Command:
  hanami db console

Usage:
  hanami db console

Description:
  Starts a database console

Options:
  --help, -h                        # Print this help
OUT

        run_cmd "hanami db console --help", output
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hanami-2.0.0.beta2 spec/integration/cli/db/console_spec.rb
hanami-2.0.0.beta1.1 spec/integration/cli/db/console_spec.rb
hanami-2.0.0.beta1 spec/integration/cli/db/console_spec.rb