From c1ca338fdb32b05fd047730be9ca6569d22c6806 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 20 Mar 2017 14:08:34 +0000 Subject: Updated gems to (roughly) jessie versions; removed XMPP support. Also changed the postgres tests to "skip" if no postgres db is available. --- test/tc_mauve_database_peculiarities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/tc_mauve_database_peculiarities.rb') diff --git a/test/tc_mauve_database_peculiarities.rb b/test/tc_mauve_database_peculiarities.rb index ceef9ad..78459e2 100644 --- a/test/tc_mauve_database_peculiarities.rb +++ b/test/tc_mauve_database_peculiarities.rb @@ -69,7 +69,7 @@ class TcMauveDatabasePostgresPeculiarities < TcMauveDatabasePeculiarities unless $?.success? msg = "Skipping postgres tests, as DB creation (#{@temp_db}) failed." @temp_db = nil - flunk(msg) + skip(msg) end # @pg_conn = PGconn.open(:dbname => @temp_db) @db_url = "postgres:///#{@temp_db}" -- cgit v1.2.1 From 28e99f9de3f42a566011985c22e51c907ee27681 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 20 Mar 2017 15:56:44 +0000 Subject: Moved most gems into debian deps; fixed test "skip" to "omit"; renamed test with duped name --- test/tc_mauve_database_peculiarities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/tc_mauve_database_peculiarities.rb') diff --git a/test/tc_mauve_database_peculiarities.rb b/test/tc_mauve_database_peculiarities.rb index 78459e2..9c20faa 100644 --- a/test/tc_mauve_database_peculiarities.rb +++ b/test/tc_mauve_database_peculiarities.rb @@ -69,7 +69,7 @@ class TcMauveDatabasePostgresPeculiarities < TcMauveDatabasePeculiarities unless $?.success? msg = "Skipping postgres tests, as DB creation (#{@temp_db}) failed." @temp_db = nil - skip(msg) + omit(msg) end # @pg_conn = PGconn.open(:dbname => @temp_db) @db_url = "postgres:///#{@temp_db}" -- cgit v1.2.1 From 9497809c98ba16d93d5291b6753e9cc3fb562684 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 20 Mar 2017 22:20:39 +0000 Subject: Added postgres service + tests for jessie --- test/tc_mauve_database_peculiarities.rb | 69 ++++++++++++++++----------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'test/tc_mauve_database_peculiarities.rb') diff --git a/test/tc_mauve_database_peculiarities.rb b/test/tc_mauve_database_peculiarities.rb index 9c20faa..8696ce7 100644 --- a/test/tc_mauve_database_peculiarities.rb +++ b/test/tc_mauve_database_peculiarities.rb @@ -1,5 +1,5 @@ # encoding: utf-8 -$:.unshift "../lib" +$LOAD_PATH.unshift '../lib' require 'th_mauve' require 'mauve/datamapper' @@ -14,7 +14,7 @@ class TcMauveDatabasePeculiarities < Mauve::UnitTest def setup super setup_database - @temp_db = "mauve_test.#{10.times.collect{ rand(36).to_s(36) }.join}" + @temp_db = "mauve_test.#{Array.new(10) { rand(36).to_s(36) }.join}" end def teardown @@ -28,7 +28,7 @@ class TcMauveDatabasePeculiarities < Mauve::UnitTest # return unless @db_url - config=< :replace, :undef => :replace, :replace => '?') - } + assert_nothing_raised("Failed to use iconv to convert to #{enc}") do + str = str.encode(enc, invalid: :replace, undef: :replace, replace: '?') + end alert = Alert.new( - :alert_id => "#{lang}:#{enc}", - :source => "test", - :subject => str + alert_id: "#{lang}:#{enc}", + source: 'test', + subject: str ) assert_nothing_raised("failed to insert #{enc}") { alert.save } @@ -60,30 +60,32 @@ EOF end end - - class TcMauveDatabasePostgresPeculiarities < TcMauveDatabasePeculiarities def setup super - system("createdb #{@temp_db} --encoding UTF8") - unless $?.success? - msg = "Skipping postgres tests, as DB creation (#{@temp_db}) failed." + + if ENV['POSTGRES_URL'] + @db_url = ENV['POSTGRES_URL'] @temp_db = nil - omit(msg) + else + system("createdb #{@temp_db} --encoding UTF8") + unless $?.success? + msg = "Skipping postgres tests, as DB creation (#{@temp_db}) failed." + @temp_db = nil + omit(msg) + end + # @pg_conn = PGconn.open(:dbname => @temp_db) + @db_url = "postgres:///#{@temp_db}" end - # @pg_conn = PGconn.open(:dbname => @temp_db) - @db_url = "postgres:///#{@temp_db}" end def teardown - # @pg_conn.finish if @pg_conn.is_a?(PGconn) and @pg_conn.status == PGconn::CONNECTION_OK super (system("dropdb #{@temp_db}") || puts("Failed to drop #{@temp_db}")) if @temp_db end - def test_reminders_only_go_once - config=< "test", - :source => "test", - :subject => "test" + a = Alert.new( + alert_id: 'test', + source: 'test', + subject: 'test' ) - assert(a.raise!, "raise was not successful") + assert(a.raise!, 'raise was not successful') assert(a.saved?) assert_equal(1, notification_buffer.length) notification_buffer.pop @@ -133,17 +135,14 @@ EOF assert_equal(1, notification_buffer.length) notification_buffer.pop end - end - - end class TcMauveDatabaseSqlite3Peculiarities < TcMauveDatabasePeculiarities def setup super # @pg_conn = PGconn.open(:dbname => @temp_db) - @db_url = "sqlite3::memory:" + @db_url = 'sqlite3::memory:' end # @@ -153,6 +152,4 @@ class TcMauveDatabaseSqlite3Peculiarities < TcMauveDatabasePeculiarities assert DataMapper::Adapters::SqliteAdapter.private_instance_methods.include?(:with_connection_old) assert DataMapper::Adapters::SqliteAdapter.public_instance_methods.include?(:synchronize) end - end - -- cgit v1.2.1