Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/194483

Change subject: Shorten lines in Ruby code
......................................................................

Shorten lines in Ruby code

To make them pass Rubocop checks at 100 chars per line.

Change-Id: Ie8f9aaf8464e2abf9027a6ab332472535b3ec168
---
M .rubocop.yml
M .rubocop_todo.yml
M tests/browser/features/special_content_translation.feature
M tests/browser/features/step_definitions/special_content_translation_steps.rb
M tests/browser/features/support/pages/red_link_page.rb
5 files changed, 23 insertions(+), 24 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/83/194483/1

diff --git a/.rubocop.yml b/.rubocop.yml
index cc32da4..502025c 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1 +1,4 @@
 inherit_from: .rubocop_todo.yml
+
+Metrics/LineLength:
+  Max: 100
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index daabe6a..64386e4 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -5,11 +5,6 @@
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 36
-# Configuration parameters: AllowURI, URISchemes.
-Metrics/LineLength:
-  Max: 155
-
 # Offense count: 6
 Style/Documentation:
   Enabled: false
diff --git a/tests/browser/features/special_content_translation.feature 
b/tests/browser/features/special_content_translation.feature
index 64691b8..19a9d07 100644
--- a/tests/browser/features/special_content_translation.feature
+++ b/tests/browser/features/special_content_translation.feature
@@ -12,7 +12,7 @@
   These scenarios test the basic functionality of the 
Special:ContentTranslation page.
 
   Scenario: Anonymous user cannot use Content translation.
-    When I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+    When I am translating the page "Bratislava" from English to Danish
     Then I see the message "You must be logged in to translate in this page."
       And I don't see the source column
       And I don't see the translation column
@@ -21,7 +21,7 @@
   @login
   Scenario: Logged in user viewing the special page for translation.
     Given I am logged in
-    When I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+    When I am translating the page "Bratislava" from English to Danish
     # This fails because we don't have proper loading from a local server yet
     # Then I see a source column with the text "Bratislava is the capital of 
Slovakia and the country's largest city."
       And the source column text is not editable
@@ -33,7 +33,7 @@
       And I see a translation column with an empty editing area
       And the language code of the translation column should be "da"
       And the direction of the translation column is "ltr"
-      And I should see an input box pre-filled with the text "Bratislava" 
above the editing area in the second column
+      And I should see a box pre-filled with the text "Bratislava" above the 
second column
       And I see a language label saying "dansk" below the translation column's 
title
       And I see a translation tools column
       And I see a search box in the translation tools column
@@ -47,14 +47,14 @@
   @login
   Scenario: Writing some translation text enables the "Publish Translation" 
button
     Given I am logged in
-      And I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+      And I am translating the page "Bratislava" from English to Danish
     When I write "Bratislava er hovedstad og største by i Slovakiet." in the 
editing area in the translation column
     Then the "Publish Translation" button is enabled
 
   @login
   Scenario: Deleting the translation text disables the "Publish Translation" 
button
     Given I am logged in
-      And I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+      And I am translating the page "Bratislava" from English to Danish
     When I write "Bratislava er hovedstad og største by i Slovakiet." in the 
editing area in the translation column
       And I empty the editing area in the translation column
     Then the "Publish Translation" button is disabled
@@ -62,7 +62,7 @@
   @login
   Scenario: Writing some translation text and saving it
     Given I am logged in
-      And I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+      And I am translating the page "Bratislava" from English to Danish
     When I write "Bratislava er hovedstad og største by i Slovakiet." in the 
editing area in the translation column
       And I press the "Publish Translation" button
     Then I see a notification bubble that begins with the words "Page 
published at"
@@ -70,7 +70,7 @@
   @login
   Scenario: Writing some translation text and saving it
     Given I am logged in
-      And I am on the content translation page in a wiki in English, 
translating the page "Bratislava" to Danish
+      And I am translating the page "Bratislava" from English to Danish
     When I write "Bratislava er hovedstad og største by i Slovakiet." in the 
editing area in the translation column
       And I press the "Publish Translation" button
       And I click the link in the notification bubble
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 ea28616..5ddee1a 100644
--- 
a/tests/browser/features/step_definitions/special_content_translation_steps.rb
+++ 
b/tests/browser/features/step_definitions/special_content_translation_steps.rb
@@ -1,4 +1,4 @@
-Given(/^I am on the content translation page in a wiki in (.+?), translating 
the page "(.+?)" to (.+?)$/) do |_source_language, page_name, target_language|
+Given(/^I am translating the page "(.+?)" from (.+?) to (.+?)$/) do |page, 
from, to|
   language_code = {
     'Danish' => 'da',
     'English' => 'en',
@@ -7,7 +7,7 @@
   visit(
     ContentTranslationPage,
     using_params: {
-      extra: "page=#{page_name}&lang=#{language_code[target_language]}"
+      extra: "page=#{page}&from=#{language_code[from]}&to=#{language_code[to]}"
     }
   )
 end
@@ -36,9 +36,9 @@
   on(ContentTranslationPage).column(column_type).should_not exist
 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)
+Then(/^I see a ".*?" link that points to the page "(.*?)" on the same wiki$/) 
do |page|
+  page_in_url = page.gsub(' ', '_')
+  on(ContentTranslationPage).view_page.attribute_value('href').should 
end_with(page_in_url)
 end
 
 Then(/^I see a "Publish Translation" button$/) do
@@ -49,11 +49,11 @@
   on(ContentTranslationPage).view_page.should be_visible
 end
 
-Then(/^I see a language label saying "(.*?)" below the (.+?) column's title$/) 
do |language_name, column_type|
-  on(ContentTranslationPage).language_label(column_type).text.should == 
language_name
+Then(/^I see a language label saying "(.*?)" below the (.+?) column's title$/) 
do |language, column|
+  on(ContentTranslationPage).language_label(column).text.should == language
 end
 
-Then(/^I should see an input box pre\-filled with the text "(.*?)" above the 
editing area in the second column$/) do |text|
+Then(/^I should see a box pre\-filled with the text "(.*?)" above the second 
column$/) do |text|
   on(ContentTranslationPage).title('translation').text.should == text
 end
 
@@ -101,7 +101,7 @@
   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|
+Then(/^the first version in the history of the page ".+?" should have the tag 
".+?"$/) do
   visit(TranslatedPageHistory).contenttranslation_tag_element.should be_visible
 end
 
@@ -131,6 +131,7 @@
 
 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};/)
+  # but we need the specified CSS value, so we check it manually
+  width_re = /width: #{width};/
+  on(ContentTranslationPage).progress_bar_element.attribute('style').should 
match(width_re)
 end
diff --git a/tests/browser/features/support/pages/red_link_page.rb 
b/tests/browser/features/support/pages/red_link_page.rb
index 2b3f23b..7e37993 100644
--- a/tests/browser/features/support/pages/red_link_page.rb
+++ b/tests/browser/features/support/pages/red_link_page.rb
@@ -23,7 +23,7 @@
 
   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'
+      abort 'Environment variable MEDIAWIKI_API_URL must be set'
     end
 
     client = MediawikiApi::Client.new(ENV['MEDIAWIKI_API_URL'])

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8f9aaf8464e2abf9027a6ab332472535b3ec168
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>

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

Reply via email to