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
Jérome Perrin
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
end
def
true_value
if
self
.
class
.
postgresql?
if
Gitlab
::
Database
.
postgresql?
"'t'"
else
1
...
...
@@ -25,7 +25,7 @@ module Gitlab
end
def
false_value
if
self
.
class
.
postgresql?
if
Gitlab
::
Database
.
postgresql?
"'f'"
else
0
...
...
@@ -47,9 +47,5 @@ module Gitlab
row
.
first
end
end
def
connection
self
.
class
.
connection
end
end
end
spec/lib/gitlab/database_spec.rb
View file @
447568d1
require
'spec_helper'
class
MigrationTest
include
Gitlab
::
Database
end
describe
Gitlab
::
Database
,
lib:
true
do
# These are just simple smoke tests to check if the methods work (regardless
# of what they may return).
...
...
@@ -34,4 +38,32 @@ describe Gitlab::Database, lib: true do
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
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