test/test_helper.rb in propono-0.5.4 vs test/test_helper.rb in propono-0.5.5
- old
+ new
@@ -23,12 +23,32 @@
end
def config
Propono::Configuration.instance
end
+
+ # capture_io reasigns stderr. Assign the config.logger
+ # to where capture_io has redirected it to for this test.
+ def capture_io(&block)
+ require 'stringio'
+
+ orig_stdout, orig_stderr = $stdout, $stderr
+ captured_stdout, captured_stderr = StringIO.new, StringIO.new
+ $stdout, $stderr = captured_stdout, captured_stderr
+
+ config.logger = $stderr
+ yield
+
+ return captured_stdout.string, captured_stderr.string
+ ensure
+ $stdout = orig_stdout
+ $stderr = orig_stderr
+ config.logger = $stderr
+ end
end
+require 'fog'
class Fog::AWS::SNS::Mock
def create_topic(*args)
foo = Object.new
class << foo
def body
@@ -40,12 +60,13 @@
def subscribe(topic_arn, arn_or_url, type)
end
end
-require 'fog'
class Fog::AWS::SQS::Mock
def create_queue(*args)
+ end
+ def set_queue_attributes(*args)
end
end
Fog::AWS::SQS::Mock::QueueUrl = 'https://meducation.net/foobar'
Fog::AWS::SQS::Mock::QueueArn = 'FoobarArn'