]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - test/mailshears_test.rb
Run "gem 'minitest'" to silence a stupid warning.
[mailshears.git] / test / mailshears_test.rb
index 8e80c063f0a3a07092996d2eab49f82d50db5d8d..2b653ede18100dc64e4afcaaaef3f757ebc8b8f6 100644 (file)
@@ -1,9 +1,17 @@
+# Without this, I get...
+#
+#   Warning: you should require 'minitest/autorun' instead.
+#   Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
+#
+# Whatever.
+gem 'minitest'
+require 'minitest/autorun'
+
 require 'common/configuration'
 require 'fileutils'
-require 'minitest/unit'
 require 'pg'
 
-class MailshearsTest < MiniTest::Unit::TestCase
+class MailshearsTest < MiniTest::Test
   # This is that class that most (if not all) of our test cases will
   # inherit. It provides the automatic setup and teardown of the
   # filesystem and database that the test cases will exercise.
@@ -32,8 +40,8 @@ class MailshearsTest < MiniTest::Unit::TestCase
     db_user = 'postgres'
     db_pass = nil
 
-    connection = PGconn.connect(db_host, db_port, db_opts, db_tty,
-                                db_name, db_user, db_pass)
+    connection = PG::Connection.new(db_host, db_port, db_opts, db_tty,
+                                    db_name, db_user, db_pass)
 
     return connection
   end
@@ -71,15 +79,15 @@ class MailshearsTest < MiniTest::Unit::TestCase
     #   +------------------  +---------+
     #
     #
-    #   +---------------------------------------------------------+
-    #   |                         shared                          |
-    #   +-----+--------------------+----------+-------------------+
-    #   | sid |     user_from      | calendar |    user_which     |
-    #   +-----+--------------------+----------+-------------------+
-    #   |   1 |  adam@example.net  | derp     | beth@example.net  |
-    #   +-----+--------------------+----------+-------------------+
-    #   |   2 | booger@example.com | derp     | carol@example.net |
-    #   +-----+--------------------+----------+-------------------+
+    #   +---------------------------------------------------------------------------------------------------------------------+
+    #   |                                                       shares                                                        |
+    #   +-----+-----------------------------------+---------------------------------------------------+-----------------------+
+    #   | sid |              owner                |                      calendar                     |          with         |
+    #   +-----+-----------------------------------+---------------------------------------------------+-----------------------+
+    #   |   1 | /caldav.php/adam%40example.net/   | /caldav.php/adam%40example.net/calendar-default   | /beth%40example.net/  |
+    #   +-----+-----------------------------------+---------------------------------------------------+-----------------------+
+    #   |   2 | /caldav.php/booger%40example.com/ | /caldav.php/booger%40example.com/calendar-default | /carol%40example.net/ |
+    #   +-----+-----------------------------------+---------------------------------------------------+-----------------------+
     #
     #
     # 2. davical_test
@@ -138,21 +146,24 @@ class MailshearsTest < MiniTest::Unit::TestCase
     #   +-------------------+-------------+------------+
     #
     #
-    #   +------------------------------------------------------+
-    #   |                          alias                       |
-    #   +-------------------+-------------------+--------------+
-    #   |     address       |       goto        |   domain     |
-    #   +-------------------+-------------------+--------------+
-    #   | alice@example.com | alice@example.com | example.com  |
-    #   +-------------------+-------------------+--------------+
-    #   | bob@example.com   | bob@example.com   | example.com  |
-    #   +-------------------+-------------------+--------------+
-    #   | adam@example.net  | adam@example.net  | example.net  |
-    #   +-------------------+-------------------+--------------+
-    #   | beth@example.net  | beth@example.net  | example.net  |
-    #   +-------------------+-------------------+--------------+
-    #   | carol@example.net | carol@example.net | example.net  |
-    #   +-------------------+-------------------+--------------+
+    #   +-------------------------------------------------------+
+    #   |                          alias                        |
+    #   +-------------------+--------------------+--------------+
+    #   |     address       |       goto         |   domain     |
+    #   +-------------------+--------------------+--------------+
+    #   | alice@example.com | alice@example.com, | example.com  |
+    #   |                   | adam@example.net,  |              |
+    #   |                   | bob@example.com,   |              |
+    #   |                   | carol@example.net  |              |
+    #   +-------------------+--------------------+--------------+
+    #   | bob@example.com   | bob@example.com    | example.com  |
+    #   +-------------------+--------------------+--------------+
+    #   | adam@example.net  | adam@example.net   | example.net  |
+    #   +-------------------+--------------------+--------------+
+    #   | beth@example.net  | beth@example.net   | example.net  |
+    #   +-------------------+--------------------+--------------+
+    #   | carol@example.net | carol@example.net  | example.net  |
+    #   +-------------------+--------------------+--------------+
     #
     #
     #   +---------------------------------+
@@ -206,9 +217,10 @@ class MailshearsTest < MiniTest::Unit::TestCase
       plugin_dbuser = cfg.send("#{plugin}_dbuser")
       plugin_dbpass = cfg.send("#{plugin}_dbpass")
 
-      plugin_conn = PGconn.connect(plugin_dbhost, plugin_dbport, plugin_dbopts,
-                                   plugin_dbtty, plugin_dbname, plugin_dbuser,
-                                   plugin_dbpass)
+      plugin_conn = PG::Connection.new(plugin_dbhost, plugin_dbport,
+                                       plugin_dbopts, plugin_dbtty,
+                                       plugin_dbname, plugin_dbuser,
+                                       plugin_dbpass)
 
       sql = File.open("test/sql/#{plugin}.sql").read()
       plugin_conn.query(sql)