lib/watirsplash/rspec_patches.rb in watirsplash-1.4.3 vs lib/watirsplash/rspec_patches.rb in watirsplash-2.0.0.rc1

- old
+ new

@@ -28,16 +28,12 @@ end RSpec.configure do |config| #:nodoc: config.include(WatirSplash::SpecHelper) - config.before(:all) do - open_browser_at "about:blank" - end - config.after(:all) do - close if @browser + WatirSplash::Util.formatter.browser.close if WatirSplash::Util.formatter.browser end end module RSpec #:nodoc:all module Core @@ -115,11 +111,13 @@ RSpec::Matchers.constants.each do |const| RSpec::Matchers.const_get(const).class_eval do inst_methods = instance_methods.map {|m| m.to_sym} - if inst_methods.include?(:matches?) || inst_methods.include?(:does_not_match?) + if !(inst_methods.include?(:__matches?) || inst_methods.include?(:__does_not_match?)) && + (inst_methods.include?(:matches?) || inst_methods.include?(:does_not_match?)) + def in(timeout) Kernel.warn "DEPRECATION NOTICE: #in(timeout) is DEPRECATED, please use #within(timeout) method instead!" within(timeout) end @@ -160,10 +158,10 @@ alias_method :__does_not_match?, :does_not_match? def does_not_match?(actual) @timeout ? (Watir::Wait.until(@timeout) {__does_not_match?(actual)} rescue false) : __does_not_match?(actual) end - else + elsif inst_methods.include? :matches? def does_not_match?(actual) @timeout ? !(Watir::Wait.while(@timeout) {__matches?(actual)} rescue true) : !__matches?(actual) end end end