diff --git a/lib/chili_project/database.rb b/lib/chili_project/database.rb index 3aea3959..c7837667 100644 --- a/lib/chili_project/database.rb +++ b/lib/chili_project/database.rb @@ -46,7 +46,7 @@ module ChiliProject self.adapter_name =~ regex }[0] end - + # Provide helper methods to quickly check the database type # ChiliProject::Database.mysql? returns true, if we have a MySQL DB supported_adapters.keys.each do |adapter| diff --git a/test/unit/lib/chili_project/database_test.rb b/test/unit/lib/chili_project/database_test.rb index 1296a0dd..e47c7a2f 100644 --- a/test/unit/lib/chili_project/database_test.rb +++ b/test/unit/lib/chili_project/database_test.rb @@ -22,7 +22,7 @@ class ChiliProject::DatabaseTest < ActiveSupport::TestCase ChiliProject::Database.stubs(:adapter_name).returns "SQLite" SQLite3::Driver::Native::API.stubs(:sqlite3_libversion).returns "3.6.12" end - + should "return the correct identifier" do assert_equal :sqlite, ChiliProject::Database.name end @@ -32,19 +32,19 @@ class ChiliProject::DatabaseTest < ActiveSupport::TestCase assert_equal false, ChiliProject::Database.postgresql? assert_equal true, ChiliProject::Database.sqlite? end - + 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