Manybubbles 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: I168968373e3fe997dbda4447d4f4661aadfca322
---
M tests/browser/features/full_text.feature
M tests/browser/features/step_definitions/general_steps.rb
M tests/browser/features/step_definitions/page_steps.rb
M tests/browser/features/step_definitions/search_steps.rb
M tests/browser/features/step_definitions/transformers.rb
M tests/browser/features/support/env.rb
M tests/browser/features/support/hooks.rb
M tests/browser/features/support/modules/url_module.rb
M tests/browser/features/support/pages/article_page.rb
M tests/browser/features/support/pages/delete_page.rb
M tests/browser/features/support/pages/edit_page.rb
M tests/browser/features/support/pages/login_page.rb
M tests/browser/features/support/pages/random_page.rb
M tests/browser/features/support/pages/search_page.rb
M tests/browser/features/support/pages/search_results_page.rb
M tests/browser/features/support/pages/upload_file_page.rb
16 files changed, 91 insertions(+), 91 deletions(-)

Approvals:
  Manybubbles: Verified; Looks good to me, approved
  Zfilipin: Looks good to me, but someone else must approve
  jenkins-bot: Checked



diff --git a/tests/browser/features/full_text.feature 
b/tests/browser/features/full_text.feature
index d8f8ae2..ce3b2a4 100644
--- a/tests/browser/features/full_text.feature
+++ b/tests/browser/features/full_text.feature
@@ -125,7 +125,7 @@
     Then there are no search results
 
   @setup_more_like_this
-  Scenario: Searching for morelike:<page> returns pages that are 'like' that 
page
+  Scenario: Searching for morelike:<page> returns pages that are "like" that 
page
     When I search for morelike:More Like Me 1
     Then More Like Me is in the first search result
     But More Like Me 1 is not in the search results
diff --git a/tests/browser/features/step_definitions/general_steps.rb 
b/tests/browser/features/step_definitions/general_steps.rb
index f177146..86910d5 100644
--- a/tests/browser/features/step_definitions/general_steps.rb
+++ b/tests/browser/features/step_definitions/general_steps.rb
@@ -1,5 +1,5 @@
 Given(/^I am logged in$/) do
-  visit(LoginPage).login_with(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'])
+  visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
 end
 
 Given(/^I am at a random page.*$/) do
diff --git a/tests/browser/features/step_definitions/page_steps.rb 
b/tests/browser/features/step_definitions/page_steps.rb
index b675763..77f3c2a 100644
--- a/tests/browser/features/step_definitions/page_steps.rb
+++ b/tests/browser/features/step_definitions/page_steps.rb
@@ -26,26 +26,26 @@
 end
 
 def edit_page(title, text, add)
-  if text.start_with?('@')
-    text = File.read('features/support/articles/' + text[1..-1])
+  if text.start_with?("@")
+    text = File.read("features/support/articles/" + text[1..-1])
   end
   visit(EditPage, using_params: {page_name: title}) do |page|
     if (!page.article_text? and page.login?) then
       # Looks like we're not being given the article text probably because 
we're
       # trying to edit an article that requires us to be logged in.  Lets try
       # logging in.
-      step 'I am logged in'
+      step "I am logged in"
       visit(EditPage, using_params: {page_name: title})
     end
     if (page.article_text.strip != text.strip) then
       if (!page.save? and page.login?) then
         # Looks like I'm at a page I don't have permission to change and I'm 
not
         # logged in.  Lets log in and try again.
-        step 'I am logged in'
+        step "I am logged in"
         visit(EditPage, using_params: {page_name: title})
       end
       if !add then
-        page.article_text = ''
+        page.article_text = ""
       end
       # Firefox chokes on huge batches of text so split it into chunks and use
       # send_keys rather than page-objects built in += because that clears and
@@ -59,7 +59,7 @@
 end
 
 def upload_file(title, contents, description)
-  contents = 'features/support/articles/' + contents
+  contents = "features/support/articles/" + contents
   md5 = Digest::MD5.hexdigest(File.read(contents))
   md5_string = "md5: #{md5}"
   visit(ArticlePage, using_params: {page_name: title}) do |page|
@@ -67,7 +67,7 @@
       return
     end
     if !(page.upload_new_version? || page.upload?)
-      step 'I am logged in'
+      step "I am logged in"
       visit(ArticlePage, using_params: {page_name: title})
     end
     if page.upload?
diff --git a/tests/browser/features/step_definitions/search_steps.rb 
b/tests/browser/features/step_definitions/search_steps.rb
index 335ee29..6d78795 100644
--- a/tests/browser/features/step_definitions/search_steps.rb
+++ b/tests/browser/features/step_definitions/search_steps.rb
@@ -21,12 +21,12 @@
   #If I'm on the search page then I actually want to search in that box not the
   #one in the upper right.
   page_type = RandomPage
-  if ['Search', 'Search results'].include?(on(ArticlePage).title) then
+  if ["Search", "Search results"].include?(on(ArticlePage).title) then
     page_type = SearchResultsPage
   end
   on(page_type) do |page|
-    if text == 'the empty string' then
-      page.search_input = ''
+    if text == "the empty string" then
+      page.search_input = ""
       if page.simple_search_button? then
         page.simple_search_button
       else
@@ -55,7 +55,7 @@
   @browser.link(:text => text).click
 end
 When(/^I click the (.*) label(?:s)?$/) do |text|
-  text.split(',').each do |link_text|
+  text.split(",").each do |link_text|
     link_text.strip!
     if link_text.include? " or " then
       found = false
@@ -86,7 +86,7 @@
   end
 end
 Then(/^(.+) is the first suggestion$/) do |title|
-  if title == 'none' then
+  if title == "none" then
     on(SearchPage).one_result_element.should_not be_visible
   else
     on(SearchPage).one_result.should == title
@@ -103,7 +103,7 @@
 end
 Then(/^(.*) is( in)? the first search result$/) do |title, in_ok|
   on(SearchResultsPage) do |page|
-    if title == 'none' then
+    if title == "none" then
       page.first_result_element.should_not exist
       page.first_image_result_element.should_not exist
     else
@@ -118,7 +118,7 @@
 end
 Then(/^(.*) is( in)? the first search imageresult$/) do |title, in_ok|
   on(SearchResultsPage) do |page|
-    if title == 'none' then
+    if title == "none" then
       page.first_result_element.should_not exist
       page.first_image_result_element.should_not exist
     else
@@ -134,7 +134,7 @@
 end
 Then(/^(.*) is( in)? the second search result$/) do |title, in_ok|
   on(SearchResultsPage) do |page|
-    if title == 'none' then
+    if title == "none" then
       page.second_result_wrapper_element.should_not exist
     else
       page.second_result_element.should exist
@@ -188,14 +188,14 @@
 end
 Then(/^within (\d+) seconds searching for (.*) yields (.*) as the first 
result$/) do |seconds, term, title|
   within(seconds) do
-    step('I search for ' + term)
+    step("I search for " + term)
     step("#{title} is the first search result")
   end
 end
 Then(/^within (\d+) seconds typing (.*) into the search box yields (.*) as the 
first suggestion$/) do |seconds, term, title|
   within(seconds) do
     step("I type #{term} into the search box")
-    step('suggestions should appear')
+    step("suggestions should appear")
     step("#{title} is the first suggestion")
   end
 end
diff --git a/tests/browser/features/step_definitions/transformers.rb 
b/tests/browser/features/step_definitions/transformers.rb
index 0320953..cd13100 100644
--- a/tests/browser/features/step_definitions/transformers.rb
+++ b/tests/browser/features/step_definitions/transformers.rb
@@ -1,7 +1,7 @@
 $start_time = Time.now
 
 Transform(/%{epoch}/) do |param|
-  param.gsub('%{epoch}', $start_time.to_i.to_s)
+  param.gsub("%{epoch}", $start_time.to_i.to_s)
 end
 
 # Allow sending strings with trailing spaces
diff --git a/tests/browser/features/support/env.rb 
b/tests/browser/features/support/env.rb
index 2281d94..24feda0 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -1 +1 @@
-require 'mediawiki/selenium'
+require "mediawiki/selenium"
diff --git a/tests/browser/features/support/hooks.rb 
b/tests/browser/features/support/hooks.rb
index b086561..b2b3684 100644
--- a/tests/browser/features/support/hooks.rb
+++ b/tests/browser/features/support/hooks.rb
@@ -1,6 +1,6 @@
 # encoding: utf-8
 
-Before('@setup_main') do
+Before("@setup_main") do
   if !$setup_main
     steps %Q{
       Given a page named Template:Template Test exists with contents pickles 
[[Category:TemplateTagged]]
@@ -21,7 +21,7 @@
   end
 end
 
-Before('@setup_weight') do
+Before("@setup_weight") do
   if !$setup_weight
     steps %Q{
       Given a page named TestWeight Smaller exists with contents TestWeight
@@ -37,7 +37,7 @@
   end
 end
 
-Before('@setup_headings') do
+Before("@setup_headings") do
   if !$setup_headings
     steps %Q{
       Given a page named HasHeadings exists with contents @has_headings.txt
@@ -47,7 +47,7 @@
   end
 end
 
-Before('@setup_javascript_injection') do
+Before("@setup_javascript_injection") do
   if !$setup_headings
     steps %Q{
       Given a page named Javascript Direct Inclusion exists with contents 
@javascript.txt
@@ -57,7 +57,7 @@
   end
 end
 
-Before('@setup_namespaces') do
+Before("@setup_namespaces") do
   if !$setup_namespaces
     steps %Q{
       Given a page named Talk:Two Words exists with contents why is this page 
about catapults?
@@ -68,7 +68,7 @@
   end
 end
 
-Before('@setup_suggestions') do
+Before("@setup_suggestions") do
   if !$setup_suggestions
     steps %Q{
       Given a page named Popular Culture exists with contents popular culture
@@ -92,7 +92,7 @@
   end
 end
 
-Before('@setup_highlighting') do
+Before("@setup_highlighting") do
   if !$setup_highlighting
     steps %Q{
       Given a page named Rashidun Caliphate exists with contents 
@rashidun_caliphate.txt
@@ -103,7 +103,7 @@
   $setup_highlighting = true
 end
 
-Before('@setup_more_like_this') do
+Before("@setup_more_like_this") do
   if !$setup_more_like_this
     # The MoreLikeMe term must appear in "a bunch" of pages for it to be used 
in morelike: searches
     steps %Q{
@@ -117,7 +117,7 @@
   $setup_more_like_this = true
 end
 
-Before('@setup_phrase_rescore') do
+Before("@setup_phrase_rescore") do
   if !$setup_phrase_rescore
     steps %Q{
       Given a page named Rescore Test Words exists
@@ -129,7 +129,7 @@
   $setup_phrase_rescore = true
 end
 
-Before('@exact_quotes') do
+Before("@exact_quotes") do
   if !$exact_quotes
     steps %Q{
       Given a page named Contains A Stop Word exists
@@ -140,7 +140,7 @@
   $exact_quotes = true
 end
 
-Before('@programmer_friendly') do
+Before("@programmer_friendly") do
   if !$programmer_friendly
     steps %Q{
       Given a page named $wgNamespaceAliases exists
@@ -151,7 +151,7 @@
   end
 end
 
-Before('@stemmer') do
+Before("@stemmer") do
   if !$stemmer
     steps %Q{
       Given a page named StemmerTest Aliases exists
@@ -161,7 +161,7 @@
   $stemmer = true
 end
 
-Before('@prefix_filter') do
+Before("@prefix_filter") do
   if !$prefix_filter
     steps %Q{
       Given a page named Prefix Test exists
@@ -174,7 +174,7 @@
   $prefix_filter = true
 end
 
-Before('@prefer_recent') do
+Before("@prefer_recent") do
   if !$prefix_filter
     # These are updated per process instead of per test because of the 20 
second wait
     # Note that the scores have to be close together because 20 seconds 
doesn't mean a whole lot
diff --git a/tests/browser/features/support/modules/url_module.rb 
b/tests/browser/features/support/modules/url_module.rb
index 6268546..1dd1856 100644
--- a/tests/browser/features/support/modules/url_module.rb
+++ b/tests/browser/features/support/modules/url_module.rb
@@ -1,9 +1,9 @@
 module URL
   def self.url(name)
-    if ENV['MEDIAWIKI_URL']
-      mediawiki_url = ENV['MEDIAWIKI_URL']
+    if ENV["MEDIAWIKI_URL"]
+      mediawiki_url = ENV["MEDIAWIKI_URL"]
     else
-      mediawiki_url = 'http://en.wikipedia.beta.wmflabs.org/wiki/'
+      mediawiki_url = "http://en.wikipedia.beta.wmflabs.org/wiki/";
     end
     "#{mediawiki_url}#{name}"
   end
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index fce3c86..ddee828 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -1,13 +1,13 @@
 class ArticlePage
   include PageObject
 
-  page_url URL.url('<%=params[:page_name]%>')
+  page_url URL.url("<%=params[:page_name]%>")
 
-  h1(:title, id: 'firstHeading')
-  table(:file_history, :class => 'filehistory')
-  cell(:file_last_comment){ table_element(:class => 'filehistory')[1][5] }
-  link(:upload, text: 'upload it')
-  link(:upload_new_version, text: 'Upload a new version of this file')
-  link(:create_link, text: 'Create')
-  link(:create_source_link, text: 'Create source')
+  h1(:title, id: "firstHeading")
+  table(:file_history, :class => "filehistory")
+  cell(:file_last_comment){ table_element(:class => "filehistory")[1][5] }
+  link(:upload, text: "upload it")
+  link(:upload_new_version, text: "Upload a new version of this file")
+  link(:create_link, text: "Create")
+  link(:create_source_link, text: "Create source")
 end
diff --git a/tests/browser/features/support/pages/delete_page.rb 
b/tests/browser/features/support/pages/delete_page.rb
index 658b8ad..28fe10b 100644
--- a/tests/browser/features/support/pages/delete_page.rb
+++ b/tests/browser/features/support/pages/delete_page.rb
@@ -1,9 +1,9 @@
-require 'cgi'
+require "cgi"
 
 class DeletePage
   include PageObject
 
-  page_url 
URL.url('../w/index.php?title=<%=CGI.escape(params[:page_name])%>&action=delete')
+  page_url 
URL.url("../w/index.php?title=<%=CGI.escape(params[:page_name])%>&action=delete")
 
-  button(:delete, :value => 'Delete page')
+  button(:delete, :value => "Delete page")
 end
diff --git a/tests/browser/features/support/pages/edit_page.rb 
b/tests/browser/features/support/pages/edit_page.rb
index 29fb60d..774a2ba 100644
--- a/tests/browser/features/support/pages/edit_page.rb
+++ b/tests/browser/features/support/pages/edit_page.rb
@@ -1,11 +1,11 @@
-require 'cgi'
+require "cgi"
 
 class EditPage
   include PageObject
 
-  page_url 
URL.url('../w/index.php?title=<%=CGI.escape(params[:page_name])%>&action=edit')
+  page_url 
URL.url("../w/index.php?title=<%=CGI.escape(params[:page_name])%>&action=edit")
 
-  text_area(:article_text, id: 'wpTextbox1')
-  button(:save, id: 'wpSave')
-  a(:login, text: 'Log in')
+  text_area(:article_text, id: "wpTextbox1")
+  button(:save, id: "wpSave")
+  a(:login, text: "Log in")
 end
diff --git a/tests/browser/features/support/pages/login_page.rb 
b/tests/browser/features/support/pages/login_page.rb
index 839670c..54fc13e 100644
--- a/tests/browser/features/support/pages/login_page.rb
+++ b/tests/browser/features/support/pages/login_page.rb
@@ -1,11 +1,11 @@
 class LoginPage
   include PageObject
 
-  page_url URL.url('Special:UserLogin')
+  page_url URL.url("Special:UserLogin")
 
-  button(:login, id: 'wpLoginAttempt')
-  text_field(:password, id: 'wpPassword1')
-  text_field(:username, id: 'wpName1')
+  button(:login, id: "wpLoginAttempt")
+  text_field(:password, id: "wpPassword1")
+  text_field(:username, id: "wpName1")
 
   def login_with(username, password)
     self.username = username
diff --git a/tests/browser/features/support/pages/random_page.rb 
b/tests/browser/features/support/pages/random_page.rb
index ca51ab2..de681ac 100644
--- a/tests/browser/features/support/pages/random_page.rb
+++ b/tests/browser/features/support/pages/random_page.rb
@@ -1,13 +1,13 @@
 class RandomPage
   include PageObject
 
-  page_url URL.url('Special:Random')
+  page_url URL.url("Special:Random")
 
   # Unfortunately some wikis don't have a button at searchButton and some put 
it
   # at mw-searchButton so we make both and use whichever one we can.  Yet 
worse,
   # the searchButton actually works like hitting enter in the search box, going
   # directly to the top prefix suggestion which we don't always want.
-  button(:search_button, id: 'searchButton')
-  button(:simple_search_button, id: 'mw-searchButton')
-  text_field(:search_input, id: 'searchInput')
+  button(:search_button, id: "searchButton")
+  button(:simple_search_button, id: "mw-searchButton")
+  text_field(:search_input, id: "searchInput")
 end
diff --git a/tests/browser/features/support/pages/search_page.rb 
b/tests/browser/features/support/pages/search_page.rb
index 42c1163..f09313e 100644
--- a/tests/browser/features/support/pages/search_page.rb
+++ b/tests/browser/features/support/pages/search_page.rb
@@ -1,9 +1,9 @@
 class SearchPage
   include PageObject
 
-  div(:one_result, class: 'suggestions-result')
-  button(:search_button, id: 'searchButton')
-  text_field(:search_input, id: 'searchInput')
-  div(:search_results, class: 'suggestions-results')
-  div(:search_special, class: 'suggestions-special')
+  div(:one_result, class: "suggestions-result")
+  button(:search_button, id: "searchButton")
+  text_field(:search_input, id: "searchInput")
+  div(:search_results, class: "suggestions-results")
+  div(:search_special, class: "suggestions-special")
 end
diff --git a/tests/browser/features/support/pages/search_results_page.rb 
b/tests/browser/features/support/pages/search_results_page.rb
index efdb512..58824ec 100644
--- a/tests/browser/features/support/pages/search_results_page.rb
+++ b/tests/browser/features/support/pages/search_results_page.rb
@@ -1,23 +1,23 @@
 class SearchResultsPage
   include PageObject
 
-  page_url 
URL.url('/w/index.php?search=<%=params[:search]%>&prefix=<%=params[:prefix]%>')
+  page_url 
URL.url("/w/index.php?search=<%=params[:search]%>&prefix=<%=params[:prefix]%>")
 
-  text_field(:search, id: 'searchText')
-  h1(:title, id: 'firstHeading')
-  unordered_list(:search_results, :class => 'mw-search-results')
+  text_field(:search, id: "searchText")
+  h1(:title, id: "firstHeading")
+  unordered_list(:search_results, :class => "mw-search-results")
   li(:first_result_wrapper){ |page| 
page.search_results_element.list_item_element(:index => 0) }
-  link(:first_result){ |page| 
page.first_result_wrapper_element.div_element(:class => 
'mw-search-result-heading').link_element }
-  div(:first_result_text){ |page| 
page.first_result_wrapper_element.div_element(:class => 'searchresult') }
-  span(:first_result_alttitle_wrapper){ |page| 
page.first_result_wrapper_element.span_element(:class => 'searchalttitle') }
+  link(:first_result){ |page| 
page.first_result_wrapper_element.div_element(:class => 
"mw-search-result-heading").link_element }
+  div(:first_result_text){ |page| 
page.first_result_wrapper_element.div_element(:class => "searchresult") }
+  span(:first_result_alttitle_wrapper){ |page| 
page.first_result_wrapper_element.span_element(:class => "searchalttitle") }
   link(:first_result_alttitle) { |page| 
page.first_result_alttitle_wrapper_element.link_element }
-  link(:first_image_result){ table_element(:class => 
'searchResultImage').cell_element(:index => 1).link_element(:index => 0) }
+  link(:first_image_result){ table_element(:class => 
"searchResultImage").cell_element(:index => 1).link_element(:index => 0) }
   li(:second_result_wrapper){ |page| 
page.search_results_element.list_item_element(:index => 1) }
-  link(:second_result){ |page| 
page.second_result_wrapper_element.div_element(:class => 
'mw-search-result-heading').link_element }
-  button(:simple_search_button, value: 'Search')
-  text_field(:search_input, name: 'search')
-  div(:suggestion_wrapper, class: 'searchdidyoumean')
-  div(:error_report, class: 'error')
+  link(:second_result){ |page| 
page.second_result_wrapper_element.div_element(:class => 
"mw-search-result-heading").link_element }
+  button(:simple_search_button, value: "Search")
+  text_field(:search_input, name: "search")
+  div(:suggestion_wrapper, class: "searchdidyoumean")
+  div(:error_report, class: "error")
   def suggestion_element
     suggestion_wrapper_element.link_element
   end
@@ -25,10 +25,10 @@
     get_highlighted_text(suggestion_element)
   end
   def results
-    @browser.divs(:class => 'mw-search-result-heading')
+    @browser.divs(:class => "mw-search-result-heading")
   end
   def result_data
-    @browser.divs(:class => 'mw-search-result-data')
+    @browser.divs(:class => "mw-search-result-data")
   end
   def first_result_highlighted_title
     get_highlighted_text(first_result_element)
@@ -42,10 +42,10 @@
   private
 
   def get_highlighted_text(element)
-    result = element.element.attribute_value('innerHTML').strip
-    result.gsub('<span class="searchmatch">', '*').
-           gsub('</span>', '*').
-           gsub('<em>', '*').
-           gsub('</em>', '*')
+    result = element.element.attribute_value("innerHTML").strip
+    result.gsub("<span class=\"searchmatch\">", "*").
+           gsub("</span>", "*").
+           gsub("<em>", "*").
+           gsub("</em>", "*")
   end
 end
diff --git a/tests/browser/features/support/pages/upload_file_page.rb 
b/tests/browser/features/support/pages/upload_file_page.rb
index 60e4864..11bcb85 100644
--- a/tests/browser/features/support/pages/upload_file_page.rb
+++ b/tests/browser/features/support/pages/upload_file_page.rb
@@ -1,8 +1,8 @@
 class UploadFilePage
   include PageObject
 
-  text_area(:description, id: 'wpUploadDescription')
-  file_field(:file, id: 'wpUploadFile')
-  button(:submit, value: 'Upload file')
-  div(:error, class: 'error')
+  text_area(:description, id: "wpUploadDescription")
+  file_field(:file, id: "wpUploadFile")
+  button(:submit, value: "Upload file")
+  div(:error, class: "error")
 end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I168968373e3fe997dbda4447d4f4661aadfca322
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Mayankmadan <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Jhall <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to