Applied rubocop cop 'Style/Next' and 'Lint/UnneededDisable'.

This commit is contained in:
Thorsten Eckel 2015-07-03 19:36:13 +02:00
parent 08de22d863
commit b92e5c7532

View file

@ -1,5 +1,5 @@
ENV['RAILS_ENV'] = 'test'
# rubocop:disable Next, CyclomaticComplexity, PerceivedComplexity, HandleExceptions, ClassVars, NonLocalExitFromIterator
# rubocop:disable HandleExceptions, ClassVars, NonLocalExitFromIterator
require File.expand_path('../../config/environment', __FILE__)
require 'selenium-webdriver'
@ -152,11 +152,11 @@ class TestCase < Test::Unit::TestCase
(1..6).each {
sleep 1
login = instance.find_elements( { css: '#login' } )[0]
if login
next if !login
screenshot( browser: instance, comment: 'logout_ok' )
assert( true, 'logout ok' )
return
end
}
screenshot( browser: instance, comment: 'logout_failed' )
fail 'no login box found, seems logout was not successfully!'
@ -578,7 +578,8 @@ class TestCase < Test::Unit::TestCase
cookies.each {|cookie|
#puts "CCC #{cookie.inspect}"
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
if cookie[:name] =~ /#{params[:name]}/i
next if cookie[:name] !~ /#{params[:name]}/i
if params.key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie}'" )
else
@ -590,11 +591,9 @@ class TestCase < Test::Unit::TestCase
fail "not matching expires '#{params[:expires]}' in cookie '#{cookie}'"
end
if params[:should_not_exist]
return if !params[:should_not_exist]
fail "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'"
end
return
end
}
if params[:should_not_exist]
assert( true, "cookie with name '#{params[:name]}' is not existing" )
@ -1226,7 +1225,9 @@ wait untill text in selector disabppears
if data[:state] || data[:group] || data[:body]
found = nil
(1..10).each {
if !found
next if found
begin
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
if text =~ /(Discard your unsaved changes.|Verwerfen der)/
@ -1236,7 +1237,6 @@ wait untill text in selector disabppears
# try again
end
sleep 1
end
}
if !found
screenshot( browser: instance, comment: 'ticket_update_discard_message_failed' )