Skip to content
Permalink
Browse files

Merge pull request #22 from codenize-tools/fix_spec

Fix spec
  • Loading branch information...
winebarrel committed Oct 14, 2018
2 parents 79ab681 + a45ae41 commit f3044ed9b42e23eb3f370607a2fcff6fd58071a7
Showing with 43 additions and 32 deletions.
  1. +18 −13 .travis.yml
  2. +0 −16 .travis/install_mysql.sh
  3. +10 −1 README.md
  4. +12 −0 docker-compose.yml
  5. +3 −2 spec/spec_helper.rb
@@ -4,20 +4,25 @@ rvm:
- 2.3
- 2.4
- 2.5
cache:
- bundler
- apt
env:
- MYSQL_VERSION=mysql-5.6
- MYSQL_VERSION=mysql-5.7
matrix:
allow_failures:
- env: MYSQL_VERSION=mysql-5.7
services:
- mysql
before_install:
- gem update bundler
- sudo apt-get -qq update
- bash .travis/install_mysql.sh
matrix:
- MYSQ_PORT=14406 # MySQL 5.6
- MYSQ_PORT=14407 # MySQL 5.7
before_script:
- mysql --version
script:
- sudo service mysql stop
- bundle install
- docker-compose up -d
- function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P $MYSQ_PORT ping; }
- for i in {1..60}; do mysql_ping && break; sleep 1; done
script:
- bundle exec rake
services:
- docker
addons:
apt:
packages:
- mysql-client-core-5.6
- mysql-client-5.6

This file was deleted.

@@ -73,7 +73,7 @@ Usage: gratan [options]
-h, --help
```

A default connection to a database can be established by setting the following environment variables:
A default connection to a database can be established by setting the following environment variables:
- `GRATAN_DB_HOST`: database host
- `GRATAN_DB_PORT`: database port
- `GRATAN_DB_SOCKET`: database socket
@@ -136,6 +136,15 @@ user 'scott', 'localhost', identified: 'tiger' do
end
```

## Run tests

```sh
bundle install
docker-compose up -d
bundle exec rake
#MYSQL_PORT=14407 bundle exec rake # MySQL 5.7
```

## Similar tools
* [Codenize.tools](http://codenize.tools/)

@@ -0,0 +1,12 @@
mysql56:
image: "mysql:5.6"
ports:
- "14406:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
mysql57:
image: "mysql:5.6"
ports:
- "14407:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
@@ -28,7 +28,7 @@ def mysql
retval = nil

begin
client = Mysql2::Client.new(host: 'localhost', username: 'root')
client = Mysql2::Client.new(host: '127.0.0.1', username: 'root', port: ENV.fetch('MYSQL_PORT', 14406))
retval = yield(client)
ensure
client.close if client
@@ -139,8 +139,9 @@ def client(user_options = {})
end

options = {
host: 'localhost',
host: '127.0.0.1',
username: 'root',
port: ENV.fetch('MYSQL_PORT', 14406),
ignore_user: IGNORE_USER,
logger: Logger.new('/dev/null'),
}

0 comments on commit f3044ed

Please sign in to comment.
You can’t perform that action at this time.