jenkins-bot has submitted this change and it was merged. Change subject: Use single quotes for strings in Ruby code ......................................................................
Use single quotes for strings in Ruby code Change-Id: Idef5a9325f7c2fcf3f197cef942e1f4eeff370ca --- M .rubocop_todo.yml M Gemfile M tests/browser/features/step_definitions/red_link_steps.rb M tests/browser/features/step_definitions/special_content_translation_steps.rb M tests/browser/features/support/env.rb M tests/browser/features/support/pages/anon_error_page.rb M tests/browser/features/support/pages/content_translation_page.rb M tests/browser/features/support/pages/page_creation_page.rb M tests/browser/features/support/pages/red_link_page.rb M tests/browser/features/support/pages/translated_page.rb M tests/browser/features/support/pages/translated_page_history.rb 11 files changed, 72 insertions(+), 78 deletions(-) Approvals: Zfilipin: Looks good to me, approved jenkins-bot: Verified diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0900be6..b04915d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -24,12 +24,6 @@ Style/NilComparison: Enabled: false -# Offense count: 81 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -Style/StringLiterals: - Enabled: false - # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. diff --git a/Gemfile b/Gemfile index d8397b5..619c545 100755 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ #ruby=ruby-2.1.1 #ruby-gemset=ContentTranslation -source "https://rubygems.org" +source 'https://rubygems.org' -gem "mediawiki_api" -gem "mediawiki_selenium" -gem "rubocop", require: false +gem 'mediawiki_api' +gem 'mediawiki_selenium' +gem 'rubocop', require: false diff --git a/tests/browser/features/step_definitions/red_link_steps.rb b/tests/browser/features/step_definitions/red_link_steps.rb index bf2e430..85175ec 100644 --- a/tests/browser/features/step_definitions/red_link_steps.rb +++ b/tests/browser/features/step_definitions/red_link_steps.rb @@ -4,7 +4,7 @@ end When(/^I am on a page without interlanguage links$/) do - on(RedLinkPage).create_page("This is a red interlanguage link test page without links.") + on(RedLinkPage).create_page('This is a red interlanguage link test page without links.') visit(RedLinkPage) end @@ -75,7 +75,7 @@ end Then(/^the page creation page should open$/) do - on(PageCreationPage).editing_area.should == "" + on(PageCreationPage).editing_area.should == '' end Then(/^the name of the page should appear in the main title$/) do @@ -87,15 +87,15 @@ end Then(/^the name of the page should appear in the (.+) column$/) do |column_type| - on(ContentTranslationPage).title(column_type).text.should == "Red interlanguage link test" + on(ContentTranslationPage).title(column_type).text.should == 'Red interlanguage link test' end Then(/^the title in the translation column should be "(.*?)"$/) do |target_title| - on(ContentTranslationPage).title("translation").text.should == target_title + on(ContentTranslationPage).title('translation').text.should == target_title end Then(/^the language of the editing area should be "(.*?)"$/) do |code| - on(PageCreationPage).editing_area_element.attribute_value("lang").should == code + on(PageCreationPage).editing_area_element.attribute_value('lang').should == code end Then(/^the heading of the dialog for creating a page should include "(.+?)"$/) do |text| diff --git a/tests/browser/features/step_definitions/special_content_translation_steps.rb b/tests/browser/features/step_definitions/special_content_translation_steps.rb index f354880..fd77134 100644 --- a/tests/browser/features/step_definitions/special_content_translation_steps.rb +++ b/tests/browser/features/step_definitions/special_content_translation_steps.rb @@ -1,8 +1,8 @@ Given(/^I am on the content translation page in a wiki in (.+?), translating the page "(.+?)" to (.+?)$/) do |_source_language, page_name, target_language| language_code = { - "Danish" => "da", - "English" => "en", - "Hebrew" => "he", + 'Danish' => 'da', + 'English' => 'en', + 'Hebrew' => 'he', } visit( ContentTranslationPage, @@ -37,8 +37,8 @@ end Then(/^I see a "(.*?)" link that points to the page "(.*?)" on the same wiki$/) do |_link_name, page_title| - page_title_in_url = page_title.gsub(" ", "_") - on(ContentTranslationPage).view_page.attribute_value("href").should end_with(page_title_in_url) + page_title_in_url = page_title.gsub(' ', '_') + on(ContentTranslationPage).view_page.attribute_value('href').should end_with(page_title_in_url) end Then(/^I see a "Publish Translation" button$/) do @@ -54,7 +54,7 @@ end Then(/^I should see an input box pre\-filled with the text "(.*?)" above the editing area in the second column$/) do |text| - on(ContentTranslationPage).title("translation").text.should == text + on(ContentTranslationPage).title('translation').text.should == text end Then(/^I see a notification bubble that begins with the words "(.*?)"$/) do |text| @@ -62,7 +62,7 @@ end Then(/^I see a source column with the text "(.*?)"$/) do |text| - on(ContentTranslationPage).content("source").text.should == text + on(ContentTranslationPage).content('source').text.should == text end Then(/^I see a search box in the translation tools column$/) do @@ -70,11 +70,11 @@ end Then(/^I see a translation column with an empty editing area$/) do - on(ContentTranslationPage).translation_editor_element.text.should == "" + on(ContentTranslationPage).translation_editor_element.text.should == '' end Then(/^I see a translation tools column$/) do - on(ContentTranslationPage).column("tools").should be_visible + on(ContentTranslationPage).column('tools').should be_visible end Then(/^I see a translation progress bar$/) do @@ -82,15 +82,15 @@ end Then(/^I see the message "You must be logged in to translate in this page\."$/) do - on(AnonErrorPage).content_text.should == "You must be logged in to translate in this page." + on(AnonErrorPage).content_text.should == 'You must be logged in to translate in this page.' end Then(/^I see the title "(.*?)" at the top of the source column$/) do |source_page_title| - on(ContentTranslationPage).title("source").text.should == source_page_title + on(ContentTranslationPage).title('source').text.should == source_page_title end Then(/^I see the username at the top of the page$/) do - on(ContentTranslationPage).user_name_element.text.should == ENV["MEDIAWIKI_USER"] + on(ContentTranslationPage).user_name_element.text.should == ENV['MEDIAWIKI_USER'] end Then(/^the content of the page is "(.*?)"$/) do |page_content| @@ -98,7 +98,7 @@ end Then(/^the direction of the (.+) column is "(.+)"$/) do |column_type, direction| - on(ContentTranslationPage).column(column_type).attribute_value("dir").should == direction + on(ContentTranslationPage).column(column_type).attribute_value('dir').should == direction end Then(/^the first version in the history of the page "(.+?)" should have the tag "(.+?)"$/) do |_page_title, _tag_name| @@ -106,7 +106,7 @@ end Then(/^the language code of the (.+) column should be "(.+)"$/) do |column_type, language_code| - on(ContentTranslationPage).column(column_type).attribute_value("lang").should == language_code + on(ContentTranslationPage).column(column_type).attribute_value('lang').should == language_code end Then(/^the page "(.+?)" is displayed$/) do |page_title| @@ -122,7 +122,7 @@ end Then(/^the source column text is not editable$/) do - on(ContentTranslationPage).content("source").attribute_value("contenteditable").should == nil + on(ContentTranslationPage).content('source').attribute_value('contenteditable').should == nil end Then(/^the text near the translation progress bar says "(.*?)"$/) do |text| @@ -132,5 +132,5 @@ Then(/^the translation progress bar is in (\d+%) state$/) do |width| # The .style method returns the computed value in px, # but we need the specified CSS value, so we chech it manually - on(ContentTranslationPage).progress_bar_element.attribute("style").should match(/width: #{width};/) + on(ContentTranslationPage).progress_bar_element.attribute('style').should match(/width: #{width};/) end diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb index 4ffef5e..55e2607 100644 --- a/tests/browser/features/support/env.rb +++ b/tests/browser/features/support/env.rb @@ -1,2 +1,2 @@ -require "mediawiki_selenium" -require "mediawiki_api" +require 'mediawiki_selenium' +require 'mediawiki_api' diff --git a/tests/browser/features/support/pages/anon_error_page.rb b/tests/browser/features/support/pages/anon_error_page.rb index 12c2f33..26b88ed 100644 --- a/tests/browser/features/support/pages/anon_error_page.rb +++ b/tests/browser/features/support/pages/anon_error_page.rb @@ -2,5 +2,5 @@ include PageObject include URL - div(:content_text, id: "mw-content-text") + div(:content_text, id: 'mw-content-text') end diff --git a/tests/browser/features/support/pages/content_translation_page.rb b/tests/browser/features/support/pages/content_translation_page.rb index ebc7dc4..0980ca7 100644 --- a/tests/browser/features/support/pages/content_translation_page.rb +++ b/tests/browser/features/support/pages/content_translation_page.rb @@ -1,20 +1,20 @@ class ContentTranslationPage include PageObject include URL - page_url URL.url("Special:ContentTranslation?<%=params[:extra]%>") + page_url URL.url('Special:ContentTranslation?<%=params[:extra]%>') - a(:user_name, class: "cx-header__user-details__user-name") + a(:user_name, class: 'cx-header__user-details__user-name') - button(:publish_translation, class: "cx-header__publish") + button(:publish_translation, class: 'cx-header__publish') - div(:content, class: "content") - div(:cx_widget, class: "cx-widget") - div(:notification_bubble, class: "mw-notification-content") - div(:progress_bar_container, class: "cx-progressbar") - div(:search_box, class: "card search") + div(:content, class: 'content') + div(:cx_widget, class: 'cx-widget') + div(:notification_bubble, class: 'mw-notification-content') + div(:progress_bar_container, class: 'cx-progressbar') + div(:search_box, class: 'card search') - span(:progress_bar, class: "cx-progressbar__bar") - span(:progress_bar_text, class: "cx-progressbar__text") + span(:progress_bar, class: 'cx-progressbar__bar') + span(:progress_bar_text, class: 'cx-progressbar__text') # Sets the text of an element. # Selenium doesn't give us an easy generic way to do this, @@ -25,7 +25,7 @@ end def empty_translation_editor - set_element_text(".cx-column--translation .cx-column__content", "") + set_element_text('.cx-column--translation .cx-column__content', '') # Fake an input event translation_editor_element.send_keys('a', :backspace) end @@ -35,11 +35,11 @@ end def language_label(column_type) - column(column_type).span(class: "cx-column__language-label") + column(column_type).span(class: 'cx-column__language-label') end def content(column_type) - column(column_type).div(class: "cx-column__content") + column(column_type).div(class: 'cx-column__content') end def notification_link_element @@ -47,14 +47,14 @@ end def title(column_type) - column(column_type).h2(class: "cx-column__title") + column(column_type).h2(class: 'cx-column__title') end def translation_editor_element - content("translation") + content('translation') end def view_page - column("source").span(class: "cx-column__sub-heading__view-page").a + column('source').span(class: 'cx-column__sub-heading__view-page').a end end diff --git a/tests/browser/features/support/pages/page_creation_page.rb b/tests/browser/features/support/pages/page_creation_page.rb index 0744d69..1062fac 100644 --- a/tests/browser/features/support/pages/page_creation_page.rb +++ b/tests/browser/features/support/pages/page_creation_page.rb @@ -1,7 +1,7 @@ class PageCreationPage include PageObject - h1(:first_heading, id: "firstHeading") + h1(:first_heading, id: 'firstHeading') - text_field(:editing_area, id: "wpTextbox1") + text_field(:editing_area, id: 'wpTextbox1') end diff --git a/tests/browser/features/support/pages/red_link_page.rb b/tests/browser/features/support/pages/red_link_page.rb index b21a2b4..ac179bc 100644 --- a/tests/browser/features/support/pages/red_link_page.rb +++ b/tests/browser/features/support/pages/red_link_page.rb @@ -2,51 +2,51 @@ include PageObject include URL - page_url URL.url("Red interlanguage link test") + page_url URL.url('Red interlanguage link test') - button(:translate_from, class: "cx-entrypoint-dialog-button-translate-from") - button(:create_from_scratch, class: "cx-entrypoint-dialog-button-create-from-scratch") - button(:uls_settings_apply, class: "uls-settings-apply") - button(:uls_more_languages, class: "uls-more-languages") + button(:translate_from, class: 'cx-entrypoint-dialog-button-translate-from') + button(:create_from_scratch, class: 'cx-entrypoint-dialog-button-create-from-scratch') + button(:uls_settings_apply, class: 'uls-settings-apply') + button(:uls_more_languages, class: 'uls-more-languages') - div(:article_content, id: "mw-content-text") - div(:dialog_heading, class: "cx-entrypoint-dialog__heading") - div(:input_label, class: "cx-entrypoint-dialog__title-label") + div(:article_content, id: 'mw-content-text') + div(:dialog_heading, class: 'cx-entrypoint-dialog__heading') + div(:input_label, class: 'cx-entrypoint-dialog__title-label') - text_field(:translated_title, css: ".cx-entrypoint-dialog__title-box-block input") + text_field(:translated_title, css: '.cx-entrypoint-dialog__title-box-block input') - li(:red_interlanguage_link_item, class: "cx-new-interlanguage-link") + li(:red_interlanguage_link_item, class: 'cx-new-interlanguage-link') - span(:trigger_cog, class: "uls-settings-trigger") + span(:trigger_cog, class: 'uls-settings-trigger') - text_field(:language_filter, id: "languagefilter") + text_field(:language_filter, id: 'languagefilter') def create_page(text) - if (ENV["MEDIAWIKI_API_URL"] == nil) - abort "Environment variable MEDIAWIKI_API_URL must be set in order to create a target page for this test" + if (ENV['MEDIAWIKI_API_URL'] == nil) + abort 'Environment variable MEDIAWIKI_API_URL must be set in order to create a target page for this test' end - client = MediawikiApi::Client.new(ENV["MEDIAWIKI_API_URL"]) - client.log_in(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"]) - client.create_page("Red interlanguage link test", text) + client = MediawikiApi::Client.new(ENV['MEDIAWIKI_API_URL']) + client.log_in(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD']) + client.create_page('Red interlanguage link test', text) end def blue_interlanguage_item_with_autonym(autonym) - @browser.li(class: "interlanguage-link", text: autonym) + @browser.li(class: 'interlanguage-link', text: autonym) end def dialog_close_button - @browser.span(css: ".cx-entrypoint-dialog:not(.hidden) .icon-close") + @browser.span(css: '.cx-entrypoint-dialog:not(.hidden) .icon-close') end def page_creation_dialog(autonym) codes = { - "Nederlands" => "nl", + 'Nederlands' => 'nl', } @browser.div(id: "cx-entrypoint-dialog-#{codes[autonym]}") end def red_interlanguage_item_with_autonym(autonym) - @browser.li(class: "cx-new-interlanguage-link", text: autonym) + @browser.li(class: 'cx-new-interlanguage-link', text: autonym) end end diff --git a/tests/browser/features/support/pages/translated_page.rb b/tests/browser/features/support/pages/translated_page.rb index 2627f2b..5769046 100644 --- a/tests/browser/features/support/pages/translated_page.rb +++ b/tests/browser/features/support/pages/translated_page.rb @@ -1,8 +1,8 @@ class TranslatedPage include PageObject include URL - page_url URL.url("User:TranslatorToDa/Bratislava") + page_url URL.url('User:TranslatorToDa/Bratislava') - div(:content_text, id: "mw-content-text") - h1(:first_heading, id: "firstHeading") + div(:content_text, id: 'mw-content-text') + h1(:first_heading, id: 'firstHeading') end diff --git a/tests/browser/features/support/pages/translated_page_history.rb b/tests/browser/features/support/pages/translated_page_history.rb index 653e822..ba8757c 100644 --- a/tests/browser/features/support/pages/translated_page_history.rb +++ b/tests/browser/features/support/pages/translated_page_history.rb @@ -1,7 +1,7 @@ class TranslatedPageHistory include PageObject include URL - page_url URL.url("User:TranslatorToDa/Bratislava?action=history") + page_url URL.url('User:TranslatorToDa/Bratislava?action=history') - span(:contenttranslation_tag, class: "mw-tag-marker-contenttranslation") + span(:contenttranslation_tag, class: 'mw-tag-marker-contenttranslation') end -- To view, visit https://gerrit.wikimedia.org/r/194479 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idef5a9325f7c2fcf3f197cef942e1f4eeff370ca Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 <[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
