Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
705c0db0
Commit
705c0db0
authored
May 15, 2011
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#112
] Fix failing raw version for postgres
parent
d9010242
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
database.rb
lib/chili_project/database.rb
+1
-1
database_test.rb
test/unit/lib/chili_project/database_test.rb
+11
-0
No files found.
lib/chili_project/database.rb
View file @
705c0db0
...
...
@@ -64,7 +64,7 @@ module ChiliProject
version
=
ActiveRecord
::
Base
.
connection
.
select_value
(
'SELECT VERSION()'
)
when
:postgresql
version
=
ActiveRecord
::
Base
.
connection
.
select_value
(
'SELECT version()'
)
version
.
match
(
/^PostgreSQL (\S+)/i
)[
1
]
unless
raw
raw
?
version
:
version
.
match
(
/^PostgreSQL (\S+)/i
)[
1
]
when
:sqlite
if
SQLite3
.
const_defined?
'SQLITE_VERSION'
SQLite3
::
SQLITE_VERSION
...
...
test/unit/lib/chili_project/database_test.rb
View file @
705c0db0
...
...
@@ -36,4 +36,15 @@ class ChiliProject::DatabaseTest < ActiveSupport::TestCase
should
"return a version string"
do
assert_equal
"3.6.12"
,
ChiliProject
::
Database
.
version
end
should
"return long version string for raw==true"
do
ChiliProject
::
Database
.
stubs
(
:adapter_name
).
returns
"PostgreSQL"
raw_version
=
"PostgreSQL 8.3.11 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2"
ActiveRecord
::
Base
.
connection
.
stubs
(
:select_value
).
returns
raw_version
assert_equal
"8.3.11"
,
ChiliProject
::
Database
.
version
assert_equal
raw_version
,
ChiliProject
::
Database
.
version
(
true
)
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