[ap4r-devel] [199] trunk/samples/HelloWorld/test/integration: test support trial: just inside rails' integration test

shino at rubyforge.org shino at rubyforge.org
Mon May 28 22:20:36 EDT 2007


Revision: 199
Author:   shino
Date:     2007-05-28 22:20:35 -0400 (Mon, 28 May 2007)

Log Message:
-----------
test support trial: just inside rails' integration test

Added Paths:
-----------
    trunk/samples/HelloWorld/test/integration/just_inside_integration_test/ap4r_queue_stub.rb
    trunk/samples/HelloWorld/test/integration/just_inside_integration_test/hello_rails_integration_with_ap4r_test.rb

Removed Paths:
-------------
    trunk/samples/HelloWorld/test/integration/hello_rails_integration_with_ap4r_test.rb

Deleted: trunk/samples/HelloWorld/test/integration/hello_rails_integration_with_ap4r_test.rb
===================================================================
--- trunk/samples/HelloWorld/test/integration/hello_rails_integration_with_ap4r_test.rb	2007-05-29 02:19:19 UTC (rev 198)
+++ trunk/samples/HelloWorld/test/integration/hello_rails_integration_with_ap4r_test.rb	2007-05-29 02:20:35 UTC (rev 199)
@@ -1,29 +0,0 @@
-# Author:: Shunichi Shinohara
-# Copyright:: Copyright (c) 2007 Future Architect Inc.
-# Licence:: MIT Licence
-
-require "#{File.dirname(__FILE__)}/../test_helper"
-# require "#{File.dirname(__FILE__)}/../ap4r_test_helper"
-require "#{File.dirname(__FILE__)}/../ap4r_queue_stub"
-
-# TODO: transactional fixtures vs. multiple http calls? 2007/05/29 by shino
-class HelloRailsIntegrationWithAp4rTest < ActionController::IntegrationTest
-
-  # Trivial test case to test the ap4r test helper.
-  def test_truth
-    assert true
-    assert_not_nil ap4r_helper
-  end
-
-  def test_hello_via_http_and_async
-    puts '===== test start ====='
-    get "/sync_hello/execute_via_http"
-    puts '===== test end ====='
-    assert_equal 200, status
-    puts '===== assert end ====='
-    assert_equal 1, @controller.ap4r.async_messages.size
-    sleep 1
-    puts '===== sleep 10 end ====='
-  end
-
-end

Added: trunk/samples/HelloWorld/test/integration/just_inside_integration_test/ap4r_queue_stub.rb
===================================================================
--- trunk/samples/HelloWorld/test/integration/just_inside_integration_test/ap4r_queue_stub.rb	                        (rev 0)
+++ trunk/samples/HelloWorld/test/integration/just_inside_integration_test/ap4r_queue_stub.rb	2007-05-29 02:20:35 UTC (rev 199)
@@ -0,0 +1,42 @@
+# Author:: Shunichi Shinohara
+# Copyright:: Copyright (c) 2007 Future Architect Inc.
+# Licence:: MIT Licence
+
+require 'reliable-msg'
+require 'ap4r'
+
+class Ap4rTestHelper
+
+  def clear(*queues)
+  end
+end
+
+ap4r_test_helper = Ap4rTestHelper.new
+
+class ActionController::IntegrationTest
+  cattr_accessor :ap4r_helper
+
+  def ap4r_helper
+    @@ap4r_helper
+  end
+end
+
+ActionController::IntegrationTest.ap4r_helper = ap4r_test_helper
+
+module Ap4r
+  module AsyncHelper
+    module Base
+      def async_messages
+        @messages ||= []
+      end
+
+      private
+      def __queue_put(queue_name, queue_message, queue_headers)
+        async_messages <<
+          {:queue_name => queue_name,
+          :message => queue_message,
+          :queue_headers => queue_headers}
+      end
+    end
+  end
+end

Copied: trunk/samples/HelloWorld/test/integration/just_inside_integration_test/hello_rails_integration_with_ap4r_test.rb (from rev 197, trunk/samples/HelloWorld/test/integration/hello_rails_integration_with_ap4r_test.rb)
===================================================================
--- trunk/samples/HelloWorld/test/integration/just_inside_integration_test/hello_rails_integration_with_ap4r_test.rb	                        (rev 0)
+++ trunk/samples/HelloWorld/test/integration/just_inside_integration_test/hello_rails_integration_with_ap4r_test.rb	2007-05-29 02:20:35 UTC (rev 199)
@@ -0,0 +1,29 @@
+# Author:: Shunichi Shinohara
+# Copyright:: Copyright (c) 2007 Future Architect Inc.
+# Licence:: MIT Licence
+
+require "#{File.dirname(__FILE__)}/../test_helper"
+# require "#{File.dirname(__FILE__)}/../ap4r_test_helper"
+require "#{File.dirname(__FILE__)}/../ap4r_queue_stub"
+
+# TODO: transactional fixtures vs. multiple http calls? 2007/05/29 by shino
+class HelloRailsIntegrationWithAp4rTest < ActionController::IntegrationTest
+
+  # Trivial test case to test the ap4r test helper.
+  def test_truth
+    assert true
+    assert_not_nil ap4r_helper
+  end
+
+  def test_hello_via_http_and_async
+    puts '===== test start ====='
+    get "/sync_hello/execute_via_http"
+    puts '===== test end ====='
+    assert_equal 200, status
+    puts '===== assert end ====='
+    assert_equal 1, @controller.ap4r.async_messages.size
+    sleep 1
+    puts '===== sleep 10 end ====='
+  end
+
+end




More information about the ap4r-devel mailing list