test/unit/storage_management/serialization_test.rb in azurex-0.6.6 vs test/unit/storage_management/serialization_test.rb in azurex-0.6.7

- old
+ new

@@ -32,11 +32,11 @@ results.count.must_equal 2 end end describe "#storage_services_to_xml" do - let(:storage_service_name) {'storage-service'} + let(:storage_service_name) { 'storage-service' } let(:storage_options) { { :extended_properties=> { :prop_1_name=>"prop_1_value" }, :label=>"Test Label", @@ -55,18 +55,22 @@ doc.css('Location').text.must_equal "West US" results.must_be_kind_of String end it "serializes the options hash to xml" do - results = subject.storage_services_to_xml(storage_service_name, {:location => 'East US'}) + results = subject.storage_services_to_xml(storage_service_name, :location => 'East US') doc = Nokogiri::XML results doc.css('Location').text.must_equal 'East US' results.must_be_kind_of String end it "uses affinity_group from the hash instead of location" do - results = subject.storage_services_to_xml(storage_service_name, {:affinity_group_name => 'my-affinity-group', :location => 'East US'}) + params = { + :affinity_group_name => 'my-affinity-group', + :location => 'East US' + } + results = subject.storage_services_to_xml(storage_service_name, params) doc = Nokogiri::XML results doc.css('AffinityGroup').text.must_equal 'my-affinity-group' results.must_be_kind_of String end @@ -140,20 +144,15 @@ label: 'Test Label', geo_replication_enabled: true } } - let(:no_options_message) {'No options specified'} - let(:label_or_desc_required) { 'Either one of Label or Description has to be provided. Both cannot be empty' } + let(:no_options_message) { 'No options specified' } + let(:label_or_desc_required) { + 'Either one of Label or Description has to be provided.' + } - it "checks if the parameter is nil" do - exception = assert_raises RuntimeError do - subject.storage_update_to_xml nil - end - assert_match no_options_message, exception.message - end - it "checks if the parameter is empty" do exception = assert_raises RuntimeError do subject.storage_update_to_xml Hash.new end assert_match no_options_message, exception.message @@ -230,10 +229,10 @@ end end describe "#regenerate_storage_account_keys_from_xml" do let(:storage_services_access_keys) { Fixtures["storage_service_keys"] } - + it "returns an Array of StorageService instances" do storage_keys_xml = Nokogiri::XML(storage_services_access_keys) result = subject.storage_account_keys_from_xml storage_keys_xml result.must_be_kind_of Azure::StorageManagement::StorageAccountKeys result.primary_key.wont_be_nil