test/integration/service_bus/subscriptions_test.rb in azure-0.7.0.pre vs test/integration/service_bus/subscriptions_test.rb in azure-0.7.0.pre2
- old
+ new
@@ -10,18 +10,18 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#--------------------------------------------------------------------------
-require "integration/test_helper"
+require 'integration/test_helper'
-describe "ServiceBus Subscriptions" do
+describe 'ServiceBus Subscriptions' do
subject { Azure::ServiceBus::ServiceBusService.new }
after { ServiceBusTopicNameHelper.clean }
let(:topic){ ServiceBusTopicNameHelper.name }
- let(:subscription) { "mySubscription" }
- let(:subscription_alternative) { "mySubscription" }
+ let(:subscription) { 'mySubscription' }
+ let(:subscription_alternative) { 'mySubscription' }
let(:description_alternative) {{
:lock_duration => 'PT30S',
:requires_session => true,
:default_message_time_to_live => 'PT30M',
:dead_lettering_on_message_expiration => true,
@@ -30,25 +30,25 @@
:enable_batched_operations => true
}}
before { subject.create_topic topic }
- it "should be able to set description values to false" do
+ it 'should be able to set description values to false' do
s = Azure::ServiceBus::Subscription.new(subscription, {
:requires_session => false
})
s.requires_session.must_equal false
end
- it "should be able to create a new subscription" do
+ it 'should be able to create a new subscription' do
result = subject.create_subscription topic, subscription
result.must_be :kind_of?, Azure::ServiceBus::Subscription
result.name.must_equal subscription
end
- it "should be able to create a new subscription from a string and description Hash" do
+ it 'should be able to create a new subscription from a string and description Hash' do
result = subject.create_subscription topic, subscription_alternative, description_alternative
result.must_be :kind_of?, Azure::ServiceBus::Subscription
result.name.must_equal subscription_alternative
result.lock_duration.must_equal 30.0
@@ -58,12 +58,12 @@
result.dead_lettering_on_filter_evaluation_exceptions.must_equal description_alternative[:dead_lettering_on_filter_evaluation_exceptions]
result.max_delivery_count.must_equal description_alternative[:max_delivery_count]
result.enable_batched_operations.must_equal description_alternative[:enable_batched_operations]
end
- it "should be able to create a new subscription with objects" do
- subscriptionObject = Azure::ServiceBus::Subscription.new "my_other_sub"
+ it 'should be able to create a new subscription with objects' do
+ subscriptionObject = Azure::ServiceBus::Subscription.new 'my_other_sub'
subscriptionObject.topic = topic
subscriptionObject.max_delivery_count = 3
result = subject.create_subscription subscriptionObject
result.must_be :kind_of?, Azure::ServiceBus::Subscription
@@ -71,54 +71,54 @@
result.max_delivery_count.must_equal subscriptionObject.max_delivery_count
subject.delete_subscription result
end
- describe "when a subscription exists" do
+ describe 'when a subscription exists' do
before { subject.create_subscription topic, subscription }
- it "should be able to delete the subscription" do
+ it 'should be able to delete the subscription' do
subject.delete_subscription topic, subscription
end
- it "should be able to get the subscription" do
+ it 'should be able to get the subscription' do
result = subject.get_subscription topic, subscription
result.must_be :kind_of?, Azure::ServiceBus::Subscription
result.name.must_equal subscription
end
- it "should be able to list subscriptions" do
+ it 'should be able to list subscriptions' do
result = subject.list_subscriptions topic
subscription_found = false
result.each { |s|
subscription_found = true if s.name == subscription
}
assert subscription_found, "list_subscriptions didn't include the expected subscription"
end
- describe "when there are messages" do
+ describe 'when there are messages' do
let(:msg) {
- m = Azure::ServiceBus::BrokeredMessage.new("some message body", {:prop1 => "val1"})
- m.to = "me"
- m.label = "my_label"
+ m = Azure::ServiceBus::BrokeredMessage.new('some message body', {:prop1 => 'val1'})
+ m.to = 'me'
+ m.label = 'my_label'
m
}
before {
subject.send_topic_message topic, msg
}
- it "should be able to peek lock a message" do
+ it 'should be able to peek lock a message' do
retrieved = subject.peek_lock_subscription_message topic, subscription
retrieved.to.must_equal msg.to
retrieved.body.must_equal msg.body
retrieved.label.must_equal msg.label
retrieved = subject.read_delete_subscription_message topic, subscription, { :timeout => 1 }
retrieved.must_be_nil
end
- it "should be able to read delete a message" do
+ it 'should be able to read delete a message' do
retrieved = subject.read_delete_subscription_message topic, subscription
retrieved.must_be :kind_of?, Azure::ServiceBus::BrokeredMessage
retrieved.body.must_equal msg.body
retrieved.to.must_equal msg.to
@@ -126,11 +126,11 @@
# it should be deleted
retrieved = subject.read_delete_subscription_message topic, subscription, { :timeout => 1 }
retrieved.must_be_nil
end
- it "should be able to unlock a message" do
+ it 'should be able to unlock a message' do
retrieved = subject.peek_lock_subscription_message topic, subscription, { :timeout => 1 }
retrieved.body.must_equal msg.body
# There shouldn't be an available message in the queue
retrieved2 = subject.peek_lock_subscription_message topic, subscription, { :timeout => 1 }
@@ -143,11 +143,11 @@
# The message should be available once again
retrieved = subject.peek_lock_subscription_message topic, subscription, { :timeout => 1 }
retrieved.body.must_equal msg.body
end
- it "should be able to read a message from a subscription" do
+ it 'should be able to read a message from a subscription' do
subject.send_topic_message topic, msg
retrieved = subject.receive_subscription_message topic, subscription
retrieved.to.must_equal msg.to
retrieved.body.must_equal msg.body
@@ -162,11 +162,11 @@
before {
subject.create_subscription topic, subscription1
subject.create_subscription topic, subscription2
}
- it "should be able to list subscriptions" do
+ it 'should be able to list subscriptions' do
result = subject.list_subscriptions topic
subscription_found = false
subscription1_found = false
subscription2_found = false
@@ -178,19 +178,19 @@
}
assert (subscription_found and subscription1_found and subscription2_found), "list_subscriptions didn't include the expected subscriptions"
end
- it "should be able to use $skip token" do
+ it 'should be able to use $skip token' do
result = subject.list_subscriptions topic
result2 = subject.list_subscriptions topic, { :skip => 1 }
result2.length.must_equal result.length - 1
result2.continuation_token.must_be_nil
result2[0].id.must_equal result[1].id
end
- it "should be able to use $top token" do
+ it 'should be able to use $top token' do
result = subject.list_subscriptions topic
result.length.wont_equal 1
result.continuation_token.must_be_nil
result2 = subject.list_subscriptions topic, { :top => 1 }
@@ -198,10 +198,10 @@
result2.continuation_token[:skip].wont_be_nil
result2.continuation_token[:top].wont_be_nil
result2.length.must_equal 1
end
- it "should be able to use $skip and $top token together" do
+ it 'should be able to use $skip and $top token together' do
result = subject.list_subscriptions topic
result2 = subject.list_subscriptions topic, { :skip => 1, :top => 1 }
result2.length.must_equal 1
result2[0].id.must_equal result[1].id
end