Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
447568d1
Commit
447568d1
authored
Feb 15, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undefined method `postgresql?` during migration
parent
c29517aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
lib/gitlab/database.rb
lib/gitlab/database.rb
+2
-6
spec/lib/gitlab/database_spec.rb
spec/lib/gitlab/database_spec.rb
+32
-0
No files found.
lib/gitlab/database.rb
View file @
447568d1
...
@@ -17,7 +17,7 @@ module Gitlab
...
@@ -17,7 +17,7 @@ module Gitlab
end
end
def
true_value
def
true_value
if
self
.
class
.
postgresql?
if
Gitlab
::
Database
.
postgresql?
"'t'"
"'t'"
else
else
1
1
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
end
end
def
false_value
def
false_value
if
self
.
class
.
postgresql?
if
Gitlab
::
Database
.
postgresql?
"'f'"
"'f'"
else
else
0
0
...
@@ -47,9 +47,5 @@ module Gitlab
...
@@ -47,9 +47,5 @@ module Gitlab
row
.
first
row
.
first
end
end
end
end
def
connection
self
.
class
.
connection
end
end
end
end
end
spec/lib/gitlab/database_spec.rb
View file @
447568d1
require
'spec_helper'
require
'spec_helper'
class
MigrationTest
include
Gitlab
::
Database
end
describe
Gitlab
::
Database
,
lib:
true
do
describe
Gitlab
::
Database
,
lib:
true
do
# These are just simple smoke tests to check if the methods work (regardless
# These are just simple smoke tests to check if the methods work (regardless
# of what they may return).
# of what they may return).
...
@@ -34,4 +38,32 @@ describe Gitlab::Database, lib: true do
...
@@ -34,4 +38,32 @@ describe Gitlab::Database, lib: true do
end
end
end
end
end
end
describe
'#true_value'
do
it
'returns correct value for PostgreSQL'
do
expect
(
described_class
).
to
receive
(
:postgresql?
).
and_return
(
true
)
expect
(
MigrationTest
.
new
.
true_value
).
to
eq
"'t'"
end
it
'returns correct value for MySQL'
do
expect
(
described_class
).
to
receive
(
:postgresql?
).
and_return
(
false
)
expect
(
MigrationTest
.
new
.
true_value
).
to
eq
1
end
end
describe
'#false_value'
do
it
'returns correct value for PostgreSQL'
do
expect
(
described_class
).
to
receive
(
:postgresql?
).
and_return
(
true
)
expect
(
MigrationTest
.
new
.
false_value
).
to
eq
"'f'"
end
it
'returns correct value for MySQL'
do
expect
(
described_class
).
to
receive
(
:postgresql?
).
and_return
(
false
)
expect
(
MigrationTest
.
new
.
false_value
).
to
eq
0
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment