[MediaWiki-commits] [Gerrit] Stricter pending behavior for falsely passing steps - change (mediawiki/selenium)

2014-09-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Stricter pending behavior for falsely passing steps
..


Stricter pending behavior for falsely passing steps

Providing a world pending method that fails step definitions containing
falsely passing implementation, much like RSpec's version of the method.

Bug: 56243
Change-Id: Ibcc614ab6e859a13c3c6d35aa44d18521fa8561f
---
M lib/mediawiki_selenium/support/env.rb
A lib/mediawiki_selenium/support/modules/strict_pending.rb
2 files changed, 25 insertions(+), 0 deletions(-)

Approvals:
  Zfilipin: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/mediawiki_selenium/support/env.rb 
b/lib/mediawiki_selenium/support/env.rb
index 92bc97d..cd57d1f 100644
--- a/lib/mediawiki_selenium/support/env.rb
+++ b/lib/mediawiki_selenium/support/env.rb
@@ -18,10 +18,12 @@
 
 require mediawiki_selenium/support/modules/api_helper
 require mediawiki_selenium/support/modules/sauce_helper
+require mediawiki_selenium/support/modules/strict_pending
 
 World(PageObject::PageFactory)
 World(MediawikiSelenium::ApiHelper)
 World(MediawikiSelenium::SauceHelper)
+World(MediawikiSelenium::StrictPending)
 
 def browser(test_name, configuration = nil)
   if environment == :saucelabs
diff --git a/lib/mediawiki_selenium/support/modules/strict_pending.rb 
b/lib/mediawiki_selenium/support/modules/strict_pending.rb
new file mode 100644
index 000..6cc6953
--- /dev/null
+++ b/lib/mediawiki_selenium/support/modules/strict_pending.rb
@@ -0,0 +1,23 @@
+module MediawikiSelenium
+  # Implements a stricter version of `pending` that fails when a given block
+  # of expectations passes, alerting the user that the step definition should
+  # no longer be pending.
+  #
+  module StrictPending
+class Pending  StandardError
+end
+
+# Delegates to Cucumber's pending but re-raises any `Cucumber::Pending`
+# exception as a strict failure.
+#
+def pending(*args)
+  super
+rescue Cucumber::Pending = e
+  if block_given?
+raise Pending, e.message
+  else
+raise e
+  end
+end
+  end
+end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcc614ab6e859a13c3c6d35aa44d18521fa8561f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/selenium
Gerrit-Branch: master
Gerrit-Owner: Dduvall dduv...@wikimedia.org
Gerrit-Reviewer: Cmcmahon cmcma...@wikimedia.org
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


[MediaWiki-commits] [Gerrit] Stricter pending behavior for falsely passing steps - change (mediawiki/selenium)

2014-09-12 Thread Dduvall (Code Review)
Dduvall has uploaded a new change for review.

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

Change subject: Stricter pending behavior for falsely passing steps
..

Stricter pending behavior for falsely passing steps

Providing a world pending method that fails step definitions containing
falsely passing implementation, much like RSpec's version of the method.

Bug: 56243
Change-Id: Ibcc614ab6e859a13c3c6d35aa44d18521fa8561f
---
M lib/mediawiki_selenium/support/env.rb
A lib/mediawiki_selenium/support/modules/strict_pending.rb
2 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/selenium 
refs/changes/24/160024/1

diff --git a/lib/mediawiki_selenium/support/env.rb 
b/lib/mediawiki_selenium/support/env.rb
index bb7f751..a9c83c0 100644
--- a/lib/mediawiki_selenium/support/env.rb
+++ b/lib/mediawiki_selenium/support/env.rb
@@ -17,9 +17,11 @@
 require watir-webdriver
 
 require mediawiki_selenium/support/modules/api_helper
+require mediawiki_selenium/support/modules/strict_pending
 
 World(PageObject::PageFactory)
 World(MediawikiSelenium::ApiHelper)
+World(MediawikiSelenium::StrictPending)
 
 def browser(test_name, configuration = nil)
   if environment == :saucelabs
diff --git a/lib/mediawiki_selenium/support/modules/strict_pending.rb 
b/lib/mediawiki_selenium/support/modules/strict_pending.rb
new file mode 100644
index 000..6cc6953
--- /dev/null
+++ b/lib/mediawiki_selenium/support/modules/strict_pending.rb
@@ -0,0 +1,23 @@
+module MediawikiSelenium
+  # Implements a stricter version of `pending` that fails when a given block
+  # of expectations passes, alerting the user that the step definition should
+  # no longer be pending.
+  #
+  module StrictPending
+class Pending  StandardError
+end
+
+# Delegates to Cucumber's pending but re-raises any `Cucumber::Pending`
+# exception as a strict failure.
+#
+def pending(*args)
+  super
+rescue Cucumber::Pending = e
+  if block_given?
+raise Pending, e.message
+  else
+raise e
+  end
+end
+  end
+end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcc614ab6e859a13c3c6d35aa44d18521fa8561f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/selenium
Gerrit-Branch: master
Gerrit-Owner: Dduvall dduv...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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