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