test/queue_subscription_test.rb in propono-0.5.4 vs test/queue_subscription_test.rb in propono-0.5.5
- old
+ new
@@ -38,19 +38,34 @@
subscription = QueueSubscription.new(topic_id)
assert_equal subscription.send(:queue_name), "My_App-Foobar"
end
- def test_create_calls_create
+ def test_create_calls_subscribe
arn = "arn123"
TopicCreator.stubs(find_or_create: Topic.new(arn))
QueueCreator.stubs(find_or_create: Queue.new(Fog::AWS::SQS::Mock::QueueUrl))
sns = mock()
sns.expects(:subscribe).with(arn, Fog::AWS::SQS::Mock::QueueArn, 'sqs')
subscription = QueueSubscription.new("Some topic")
subscription.stubs(sns: sns)
+ subscription.create
+ end
+
+ def test_create_calls_set_queue_attributes
+ arn = "arn123"
+ policy = "{foobar: 123}"
+
+ TopicCreator.stubs(find_or_create: Topic.new(arn))
+ QueueCreator.stubs(find_or_create: Queue.new(Fog::AWS::SQS::Mock::QueueUrl))
+
+ sqs = mock()
+ sqs.expects(:set_queue_attributes).with(Fog::AWS::SQS::Mock::QueueUrl, "Policy", policy)
+ subscription = QueueSubscription.new("Some topic")
+ subscription.stubs(sqs: sqs)
+ subscription.stubs(policy: policy)
subscription.create
end
def test_create_saves_queue
queue = Queue.new(Fog::AWS::SQS::Mock::QueueUrl)