Skip to content

Commit 7a0bc56

Browse files
committed
Refactor database connection setup in fixtures to improve clarity and maintainability
1 parent 2ea722e commit 7a0bc56

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

spec/support/fixtures.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def self.execute
77
connector = MysqlFramework::Connector.new(
88
host: ENV.fetch('MYSQL_HOST'),
99
port: ENV.fetch('MYSQL_PORT'),
10-
database: ENV.fetch('MYSQL_DATABASE'),
10+
database: nil,
1111
username: ENV.fetch('MYSQL_USERNAME'),
1212
password: ENV.fetch('MYSQL_PASSWORD')
1313
)
@@ -39,6 +39,16 @@ def self.execute
3939
SQL
4040

4141
connector.check_in(client)
42+
connector.dispose
43+
44+
connector = MysqlFramework::Connector.new(
45+
host: ENV.fetch('MYSQL_HOST'),
46+
port: ENV.fetch('MYSQL_PORT'),
47+
database: ENV.fetch('MYSQL_DATABASE'),
48+
username: ENV.fetch('MYSQL_USERNAME'),
49+
password: ENV.fetch('MYSQL_PASSWORD')
50+
)
51+
connector.setup
4252

4353
manager = MysqlFramework::Scripts::Manager.new(connector)
4454
manager.execute

0 commit comments

Comments
 (0)