Tobias Gritschacher has submitted this change and it was merged.

Change subject: Prefer double-quoted strings in Ruby code
......................................................................


Prefer double-quoted strings in Ruby code

Bug: 57597
Change-Id: I852460eca49af853e53132b43017e7d18fac8336
---
M selenium_cuc/features/aliases.feature
M selenium_cuc/features/description.feature
M selenium_cuc/features/empty_label_and_description.feature
M selenium_cuc/features/label.feature
M selenium_cuc/features/step_definitions/description_steps.rb
M selenium_cuc/features/step_definitions/entity_steps.rb
M selenium_cuc/features/step_definitions/label_steps.rb
M selenium_cuc/features/support/env.rb
M selenium_cuc/features/support/modules/entity_module.rb
M selenium_cuc/features/support/modules/url_module.rb
M selenium_cuc/features/support/pages/item_page.rb
M selenium_cuc/features/support/utils/utils.rb
12 files changed, 96 insertions(+), 96 deletions(-)

Approvals:
  Tobias Gritschacher: Verified; Looks good to me, approved
  Zfilipin: Looks good to me, but someone else must approve



diff --git a/selenium_cuc/features/aliases.feature 
b/selenium_cuc/features/aliases.feature
index b4b0fef..487ab2f 100644
--- a/selenium_cuc/features/aliases.feature
+++ b/selenium_cuc/features/aliases.feature
@@ -33,7 +33,7 @@
   @ui_only
   Scenario: Type new alias
     When I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
     Then Aliases cancel button should be there
       And Aliases save button should be there
       And Modified alias input field should be there
@@ -42,7 +42,7 @@
   @ui_only
   Scenario Outline: Cancel aliases
     When I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
       And I <cancel>
     Then Aliases add button should be there
       And Aliases save button should not be there
@@ -59,7 +59,7 @@
   @save_aliases @modify_entity
   Scenario Outline: Save alias
     When I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
       And I <save>
     Then Aliases list should not be empty
       And Aliases add button should not be there
@@ -67,7 +67,7 @@
       And Aliases save button should not be there
       And Aliases edit button should be there
       And There should be 1 aliases in the list
-      And List of aliases should be 'alias123'
+      And List of aliases should be "alias123"
 
     Examples:
       | save |
@@ -77,12 +77,12 @@
   @save_aliases @modify_entity
   Scenario Outline: Save alias and reload
     When I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
       And I <save>
       And I reload the page
     Then Aliases edit button should be there
       And There should be 1 aliases in the list
-      And List of aliases should be 'alias123'
+      And List of aliases should be "alias123"
 
     Examples:
       | save |
@@ -92,27 +92,27 @@
   @save_aliases @modify_entity
   Scenario: Save multiple aliases
     When I click the aliases add button
-      And I enter 'alias1', 'alias2', 'alias3' as new aliases
+      And I enter "alias1", "alias2", "alias3" as new aliases
       And I click the aliases save button
     Then Aliases list should not be empty
       And There should be 3 aliases in the list
-      And List of aliases should be 'alias1', 'alias2', 'alias3'
+      And List of aliases should be "alias1", "alias2", "alias3"
 
   @save_aliases @modify_entity
   Scenario: Remove alias
     When I click the aliases add button
-      And I enter 'alias1', 'alias2' as new aliases
+      And I enter "alias1", "alias2" as new aliases
       And I click the aliases save button
       And I click the aliases edit button
       And I click the remove first alias button
       And I click the aliases save button
-    Then List of aliases should be 'alias2'
+    Then List of aliases should be "alias2"
       And There should be 1 aliases in the list
 
   @save_aliases @modify_entity
   Scenario: Remove all aliases
     When I click the aliases add button
-      And I enter 'alias1', 'alias2' as new aliases
+      And I enter "alias1", "alias2" as new aliases
       And I click the aliases save button
       And I click the aliases edit button
       And I click the remove first alias button
@@ -124,7 +124,7 @@
   @save_aliases @modify_entity
   Scenario: Remove all aliases and reload
     When I click the aliases add button
-      And I enter 'alias1', 'alias2' as new aliases
+      And I enter "alias1", "alias2" as new aliases
       And I click the aliases save button
       And I click the aliases edit button
       And I click the remove first alias button
@@ -137,7 +137,7 @@
   @ui_only
   Scenario: Edit aliases UI
     When I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
       And I click the aliases save button
       And I click the aliases edit button
     Then New alias input field should be there
@@ -149,20 +149,20 @@
   @save_aliases @modify_entity
   Scenario: Edit multiple aliases
     When I click the aliases add button
-      And I enter 'alias1', 'alias2' as new aliases
+      And I enter "alias1", "alias2" as new aliases
       And I click the aliases save button
       And I click the aliases edit button
-      And I enter 'alias3', 'alias4' as new aliases
+      And I enter "alias3", "alias4" as new aliases
       And I click the remove first alias button
       And I change the first alias to alias5
       And I click the aliases save button
     Then There should be 3 aliases in the list
-      And List of aliases should be 'alias5', 'alias3', 'alias4'
+      And List of aliases should be "alias5", "alias3", "alias4"
 
   @ui_only
   Scenario: Duplicated aliases detection
     When I click the aliases add button
-      And I enter 'alias1', 'alias2', 'alias1' as new aliases
+      And I enter "alias1", "alias2", "alias1" as new aliases
     Then Duplicate alias input field should be there
       And Aliases save button should be there
       And Aliases cancel button should be there
@@ -170,25 +170,25 @@
   @ui_only
   Scenario: Duplicated aliases resolve
     When I click the aliases add button
-      And I enter 'alias1', 'alias2', 'alias1' as new aliases
+      And I enter "alias1", "alias2", "alias1" as new aliases
       And I click the remove first alias button
     Then Duplicate alias input field should not be there
 
   @save_aliases @modify_entity
   Scenario: Save duplicated aliases
     When I click the aliases add button
-      And I enter 'alias1', 'alias2', 'alias1' as new aliases
+      And I enter "alias1", "alias2", "alias1" as new aliases
       And I click the aliases save button
     Then There should be 2 aliases in the list
-      And List of aliases should be 'alias1', 'alias2'
+      And List of aliases should be "alias1", "alias2"
 
   @save_aliases @modify_entity
   Scenario Outline: Special inputs for aliases
     When I click the aliases add button
-      And I enter '<alias>' as new aliases
+      And I enter "<alias>" as new aliases
       And I click the aliases save button
     Then There should be 1 aliases in the list
-      And List of aliases should be '<alias_expected>'
+      And List of aliases should be "<alias_expected>"
 
     Examples:
       | alias | alias_expected |
@@ -199,24 +199,24 @@
   @save_aliases
   Scenario: Too long input for alias
     When I click the aliases add button
-      And I enter 
'loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
 as new aliases
+      And I enter 
"loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"
 as new aliases
       And I click the aliases save button
     Then An error message should be displayed
 
   @save_aliases @modify_entity @bugfix
   Scenario: Zombie alias bugfix
     When I click the aliases add button
-      And I enter 'zombie' as new aliases
+      And I enter "zombie" as new aliases
       And I click the aliases save button
       And I reload the page
       And I click the aliases edit button
       And I click the remove first alias button
       And I click the aliases save button
       And I click the aliases add button
-      And I enter 'alias123' as new aliases
+      And I enter "alias123" as new aliases
       And I click the aliases save button
     Then There should be 1 aliases in the list
-      And List of aliases should be 'alias123'
+      And List of aliases should be "alias123"
 
   @ui_only @bugfix
   Scenario: Bugfix for addbutton appearing when it should not
diff --git a/selenium_cuc/features/description.feature 
b/selenium_cuc/features/description.feature
index 8596d75..f420909 100644
--- a/selenium_cuc/features/description.feature
+++ b/selenium_cuc/features/description.feature
@@ -29,7 +29,7 @@
   @ui_only
   Scenario: Modify the description
     When I click the description edit button
-      And I enter 'MODIFIED DESCRIPTION' as description
+      And I enter "MODIFIED DESCRIPTION" as description
     Then Description save button should be there
       And Description cancel button should be there
       And Description edit button should not be there
@@ -37,7 +37,7 @@
   @ui_only
   Scenario Outline: Cancel description
     When I click the description edit button
-      And I enter 'MODIFIED DESCRIPTION' as description
+      And I enter "MODIFIED DESCRIPTION" as description
       And I <cancel>
     Then Original description should be displayed
       And Description edit button should be there
@@ -51,7 +51,7 @@
   @save_description @modify_entity
   Scenario Outline: Save description
     When I click the description edit button
-      And I enter 'MODIFIED DESCRIPTION' as description
+      And I enter "MODIFIED DESCRIPTION" as description
       And I <save>
     Then MODIFIED DESCRIPTION should be displayed as description
 
@@ -63,7 +63,7 @@
   @save_description @modify_entity
   Scenario Outline: Save description
     When I click the description edit button
-      And I enter 'MODIFIED DESCRIPTION' as description
+      And I enter "MODIFIED DESCRIPTION" as description
       And I <save>
       And I reload the page
     Then MODIFIED DESCRIPTION should be displayed as description
@@ -76,7 +76,7 @@
   @save_description @modify_entity
   Scenario Outline: Description with special input
     When I click the description edit button
-      And I enter '<description>' as description
+      And I enter "<description>" as description
       And I click the description save button
     Then <expected_description> should be displayed as description
 
diff --git a/selenium_cuc/features/empty_label_and_description.feature 
b/selenium_cuc/features/empty_label_and_description.feature
index 54ddada..b16cdd2 100644
--- a/selenium_cuc/features/empty_label_and_description.feature
+++ b/selenium_cuc/features/empty_label_and_description.feature
@@ -23,13 +23,13 @@
 
   @ui_only
   Scenario: Description UI behaves correctly when description is empty
-    When I enter 'NEW DESCRIPTION' as description
+    When I enter "NEW DESCRIPTION" as description
     Then Description cancel button should be there
       And Description save button should be there
 
   @ui_only
   Scenario: Description UI behaves correctly when description is empty
-    When I enter 'NEW DESCRIPTION' as description
+    When I enter "NEW DESCRIPTION" as description
       And I click the description cancel button
     Then Description cancel button should not be there
       And Description edit button should not be there
@@ -48,13 +48,13 @@
 
   @ui_only
   Scenario: Label UI behaves correctly when label is empty
-    When I enter 'NEW LABEL' as label
+    When I enter "NEW LABEL" as label
     Then Label cancel button should be there
       And Label save button should be there
 
   @ui_only
   Scenario: Label UI behaves correctly when label is empty
-    When I enter 'NEW LABEL' as label
+    When I enter "NEW LABEL" as label
       And I click the label cancel button
     Then Label cancel button should not be there
       And Label edit button should not be there
diff --git a/selenium_cuc/features/label.feature 
b/selenium_cuc/features/label.feature
index a7bd2ef..23d8df1 100644
--- a/selenium_cuc/features/label.feature
+++ b/selenium_cuc/features/label.feature
@@ -31,7 +31,7 @@
   @ui_only
   Scenario: Modify the label
     When I click the label edit button
-      And I enter 'MODIFIED LABEL' as label
+      And I enter "MODIFIED LABEL" as label
     Then Label save button should be there
       And Label cancel button should be there
       And Label edit button should not be there
@@ -39,7 +39,7 @@
   @ui_only
   Scenario Outline: Cancel label
     When I click the label edit button
-      And I enter 'MODIFIED LABEL' as label
+      And I enter "MODIFIED LABEL" as label
       And I <cancel>
     Then Original label should be displayed
       And Label edit button should be there
@@ -54,7 +54,7 @@
   @save_label @modify_entity
   Scenario Outline: Save label
     When I click the label edit button
-      And I enter 'MODIFIED LABEL' as label
+      And I enter "MODIFIED LABEL" as label
       And I <save>
     Then MODIFIED LABEL should be displayed as label
 
@@ -66,7 +66,7 @@
   @save_label @modify_entity
   Scenario Outline: Save label and reload
     When I click the label edit button
-      And I enter 'MODIFIED LABEL' as label
+      And I enter "MODIFIED LABEL" as label
       And I <save>
       And I reload the page
     Then MODIFIED LABEL should be displayed as label
@@ -79,7 +79,7 @@
   @save_label @modify_entity
   Scenario Outline: Label with special input
     When I click the label edit button
-      And I enter '<label>' as label
+      And I enter "<label>" as label
       And I click the label save button
     Then <expected_label> should be displayed as label
 
diff --git a/selenium_cuc/features/step_definitions/description_steps.rb 
b/selenium_cuc/features/step_definitions/description_steps.rb
index cc40f96..167251f 100644
--- a/selenium_cuc/features/step_definitions/description_steps.rb
+++ b/selenium_cuc/features/step_definitions/description_steps.rb
@@ -32,7 +32,7 @@
   end
 end
 
-When /^I enter '(.+)' as description$/ do |value|
+When /^I enter "(.+)" as description$/ do |value|
   on(ItemPage) do |page|
     page.descriptionInputField_element.clear
     page.descriptionInputField = value
@@ -40,7 +40,7 @@
 end
 
 When /^I enter a long string as description$/ do
-  step "I enter 
'looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
 as description"
+  step "I enter 
\"looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong\"
 as description"
 end
 
 Then /^Description edit button should be there$/ do
diff --git a/selenium_cuc/features/step_definitions/entity_steps.rb 
b/selenium_cuc/features/step_definitions/entity_steps.rb
index 42a8607..48d1e91 100644
--- a/selenium_cuc/features/step_definitions/entity_steps.rb
+++ b/selenium_cuc/features/step_definitions/entity_steps.rb
@@ -8,7 +8,7 @@
 
 Given /^I am on an item page$/ do
   item_data = '{"labels":{"en":{"language":"en","value":"' + 
generate_random_string(8) + 
'"}},"descriptions":{"en":{"language":"en","value":"' + 
generate_random_string(20) + '"}}}'
-  item = create_new_entity(item_data, 'item')
+  item = create_new_entity(item_data, "item")
   @item_under_test = item
   on(ItemPage).navigate_to_entity item["url"]
 end
@@ -31,7 +31,7 @@
 
 Given /^I am on an item page with empty label and description$/ do
   item_data = '{"labels":{"en":{"language":"en","value":"' + '' + 
'"}},"descriptions":{"en":{"language":"en","value":"' + '' + '"}}}'
-  item = create_new_entity(item_data, 'item')
+  item = create_new_entity(item_data, "item")
   @item_under_test = item
   on(ItemPage).navigate_to_entity item["url"]
 end
diff --git a/selenium_cuc/features/step_definitions/label_steps.rb 
b/selenium_cuc/features/step_definitions/label_steps.rb
index fe12a28..84008ac 100644
--- a/selenium_cuc/features/step_definitions/label_steps.rb
+++ b/selenium_cuc/features/step_definitions/label_steps.rb
@@ -32,7 +32,7 @@
   end
 end
 
-When /^I enter '(.+)' as label$/ do |value|
+When /^I enter "(.+)" as label$/ do |value|
   on(ItemPage) do |page|
     page.labelInputField_element.clear
     page.labelInputField = value
@@ -40,7 +40,7 @@
 end
 
 When /^I enter a long string as label$/ do
-  step "I enter 
'looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
 as label"
+  step 'I enter 
"looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"
 as label'
 end
 
 Then /^Label edit button should be there$/ do
@@ -104,7 +104,7 @@
 Then /^Entity id should be displayed next to the label$/ do
   on(ItemPage) do |page|
       page.entityIdSpan_element.visible?.should be_true
-      page.entityIdSpan.sub(/[()]/, '') == @item_under_test["label"]
+      page.entityIdSpan.sub(/[()]/, "") == @item_under_test["label"]
     end
 end
 
diff --git a/selenium_cuc/features/support/env.rb 
b/selenium_cuc/features/support/env.rb
index 93cc399..14d2bb6 100644
--- a/selenium_cuc/features/support/env.rb
+++ b/selenium_cuc/features/support/env.rb
@@ -9,39 +9,39 @@
 # setup & bootstrapping
 
 # before all
-require 'mediawiki/selenium'
+require "mediawiki/selenium"
 
-require 'net/http'
-require 'active_support/all'
-require 'require_all'
+require "net/http"
+require "active_support/all"
+require "require_all"
 
-config = YAML.load_file('config/config.yml')
+config = YAML.load_file("config/config.yml")
 config.each do |k, v|
   eval("#{k} = '#{v}'")
 end
 
-require_all 'features/support/modules'
-require_all 'features/support/pages'
-require_all 'features/support/utils'
+require_all "features/support/modules"
+require_all "features/support/pages"
+require_all "features/support/utils"
 
 def sauce_browser(test_name, language)
-  browsers = YAML.load_file('config/browsers.yml')
-  if ENV['BROWSER_LABEL']
-    browser_label = browsers[ENV['BROWSER_LABEL']]
+  browsers = YAML.load_file("config/browsers.yml")
+  if ENV["BROWSER_LABEL"]
+    browser_label = browsers[ENV["BROWSER_LABEL"]]
   else
-    browser_label = browsers['firefox_linux']
+    browser_label = browsers["firefox_linux"]
   end
 
-  caps = Selenium::WebDriver::Remote::Capabilities.send(browser_label['name'])
-  caps.platform = browser_label['platform']
-  caps.version = browser_label['version']
-  caps[:name] = "#{test_name} #{ENV['JOB_NAME']}"
+  caps = Selenium::WebDriver::Remote::Capabilities.send(browser_label["name"])
+  caps.platform = browser_label["platform"]
+  caps.version = browser_label["version"]
+  caps[:name] = "#{test_name} #{ENV["JOB_NAME"]}"
 
-  require 'selenium/webdriver/remote/http/persistent' # http_client
+  require "selenium/webdriver/remote/http/persistent" # http_client
   browser = Watir::Browser.new(
       :remote,
       http_client: Selenium::WebDriver::Remote::Http::Persistent.new,
-      url: 
"http://#{ENV['SAUCE_ONDEMAND_USERNAME']}:#{ENV['SAUCE_ONDEMAND_ACCESS_KEY']}@ondemand.saucelabs.com:80/wd/hub",
+      url: 
"http://#{ENV["SAUCE_ONDEMAND_USERNAME"]}:#{ENV["SAUCE_ONDEMAND_ACCESS_KEY"]}@ondemand.saucelabs.com:80/wd/hub";,
       desired_capabilities: caps)
 
   browser
diff --git a/selenium_cuc/features/support/modules/entity_module.rb 
b/selenium_cuc/features/support/modules/entity_module.rb
index f7ecd94..856d960 100644
--- a/selenium_cuc/features/support/modules/entity_module.rb
+++ b/selenium_cuc/features/support/modules/entity_module.rb
@@ -6,7 +6,7 @@
 #
 # page object for entity page
 
-#require 'ruby_selenium'
+#require "ruby_selenium"
 
 module EntityPage
   include PageObject
@@ -121,8 +121,8 @@
 
   # creates a random string
   def generate_random_string(length=8)
-    chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
-    string = ''
+    chars = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
+    string = ""
     length.times { string << chars[rand(chars.size)] }
     return string
   end
diff --git a/selenium_cuc/features/support/modules/url_module.rb 
b/selenium_cuc/features/support/modules/url_module.rb
index 9fcaecf..c47a1d2 100644
--- a/selenium_cuc/features/support/modules/url_module.rb
+++ b/selenium_cuc/features/support/modules/url_module.rb
@@ -10,8 +10,8 @@
 
 module URL
   def self.client_url(name)
-    if ENV['WIKIDATA_CLIENT_URL']
-      url = ENV['WIKIDATA_CLIENT_URL']
+    if ENV["WIKIDATA_CLIENT_URL"]
+      url = ENV["WIKIDATA_CLIENT_URL"]
     else
       url = WIKIDATA_CLIENT_URL
     end
@@ -19,8 +19,8 @@
   end
 
   def self.repo_url(name)
-    if ENV['WIKIDATA_REPO_URL']
-      url = ENV['WIKIDATA_REPO_URL']
+    if ENV["WIKIDATA_REPO_URL"]
+      url = ENV["WIKIDATA_REPO_URL"]
     else
       url = WIKIDATA_REPO_URL
     end
@@ -28,8 +28,8 @@
   end
 
   def self.repo_api()
-    if ENV['WIKIDATA_REPO_URL']
-      url = ENV['WIKIDATA_REPO_API']
+    if ENV["WIKIDATA_REPO_URL"]
+      url = ENV["WIKIDATA_REPO_API"]
     else
       url = WIKIDATA_REPO_API
     end
diff --git a/selenium_cuc/features/support/pages/item_page.rb 
b/selenium_cuc/features/support/pages/item_page.rb
index 38ec57b..f5a4b66 100644
--- a/selenium_cuc/features/support/pages/item_page.rb
+++ b/selenium_cuc/features/support/pages/item_page.rb
@@ -6,7 +6,7 @@
 #
 # page object for item page
 
-#require 'ruby_selenium'
+#require "ruby_selenium"
 
 class ItemPage
   include PageObject
diff --git a/selenium_cuc/features/support/utils/utils.rb 
b/selenium_cuc/features/support/utils/utils.rb
index 6a5344f..433d295 100644
--- a/selenium_cuc/features/support/utils/utils.rb
+++ b/selenium_cuc/features/support/utils/utils.rb
@@ -10,8 +10,8 @@
 
 # creates a random string
 def generate_random_string(length=8)
-  chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
-  string = ''
+  chars = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
+  string = ""
   length.times { string << chars[rand(chars.size)] }
   return string
 end
@@ -25,7 +25,7 @@
     data = '{"labels":{"en":{"language":"en","value":"' + 
generate_random_string(8) +
            '"}},"descriptions":{"en":{"language":"en","value":"' + 
generate_random_string(20) +
            '"}},"datatype":"' + type + '"}'
-    property = create_new_entity(data, 'property')
+    property = create_new_entity(data, "property")
     properties[handle] = property
   end
 
@@ -38,7 +38,7 @@
   handles.each do |handle|
     data = '{"labels":{"en":{"language":"en","value":"' + 
generate_random_string(8) +
            '"}},"descriptions":{"en":{"language":"en","value":"' + 
generate_random_string(20) + '"}}}'
-    item = create_new_entity(data, 'item')
+    item = create_new_entity(data, "item")
     items[handle] = item
   end
 
@@ -46,17 +46,17 @@
 end
 
 # creates a new entity via the API
-def create_new_entity(data, type = 'item')
+def create_new_entity(data, type = "item")
   uri = URI(URL.repo_api)
 
   request = Net::HTTP::Post.new(uri.to_s)
   request.set_form_data(
-    'action' => 'wbeditentity',
-    'token' => '+\\',
-    'new' => type,
-    'data' => data,
-    'format' => 'json',
-    'summary' => 'entity created by selenium test'
+    "action" => "wbeditentity",
+    "token" => "+\\",
+    "new" => type,
+    "data" => data,
+    "format" => "json",
+    "summary" => "entity created by selenium test"
   )
 
   response = Net::HTTP.start(uri.hostname, uri.port) do |http|
@@ -69,7 +69,7 @@
   end
 
   id = resp["entity"]["id"]
-  url = URL.repo_url(ITEM_NAMESPACE + id + '?setlang=' + LANGUAGE_CODE)
+  url = URL.repo_url(ITEM_NAMESPACE + id + "?setlang=" + LANGUAGE_CODE)
   entity_data = ActiveSupport::JSON.decode(data)
   entity = {"id" => id, "url" => url, "label" => 
entity_data["labels"]["en"]["value"], "description" => 
entity_data["descriptions"]["en"]["value"]}
   return entity
@@ -81,13 +81,13 @@
 
   request = Net::HTTP::Post.new(uri.to_s)
   request.set_form_data(
-      'action' => 'wbsetsitelink',
-      'token' => '+\\',
-      'site' => siteid,
-      'title' => pagename,
-      'linksite' => siteid,
-      'format' => 'json',
-      'summary' => 'sitelink removed by selenium test'
+      "action" => "wbsetsitelink",
+      "token" => "+\\",
+      "site" => siteid,
+      "title" => pagename,
+      "linksite" => siteid,
+      "format" => "json",
+      "summary" => "sitelink removed by selenium test"
   )
 
   response = Net::HTTP.start(uri.hostname, uri.port) do |http|
@@ -95,8 +95,8 @@
   end
   resp = ActiveSupport::JSON.decode(response.body)
 
-  if resp["success"] != 1 && resp["error"]["code"] != 'no-such-entity-link'
-    abort('Failed to remove sitelink ' + siteid + ': API error')
+  if resp["success"] != 1 && resp["error"]["code"] != "no-such-entity-link"
+    abort("Failed to remove sitelink " + siteid + ": API error")
   end
 
   return true

-- 
To view, visit https://gerrit.wikimedia.org/r/97842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I852460eca49af853e53132b43017e7d18fac8336
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Mayankmadan <maddiema...@gmail.com>
Gerrit-Reviewer: Cmcmahon <cmcma...@wikimedia.org>
Gerrit-Reviewer: Jhall <jh...@wikimedia.org>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Zfilipin <zfili...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to