Applied rubocop.

This commit is contained in:
Martin Edenhofer 2016-06-30 22:04:48 +02:00
parent c52ee90747
commit 30fe8aef36
158 changed files with 557 additions and 548 deletions

View file

@ -1,9 +0,0 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationHelper
def inline_svg(path)
File.open("public/assets/images/#{path}", 'rb') do |file|
raw file.read
end
end
end

View file

@ -1,4 +0,0 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module PostsHelper
end

View file

@ -444,7 +444,7 @@ execute all pending package migrations at once
next if tmp_path == '' next if tmp_path == ''
next if File.exist?(tmp_path) next if File.exist?(tmp_path)
Dir.mkdir(tmp_path, 0755) Dir.mkdir(tmp_path, 0o755)
} }
# install file # install file

View file

@ -18,7 +18,7 @@ returns
def self.generate def self.generate
# generate number # generate number
(1..50_000).each { 49_999.times {
number = adapter.generate number = adapter.generate
ticket = Ticket.find_by( number: number ) ticket = Ticket.find_by( number: number )
return number if !ticket return number if !ticket

View file

@ -31,7 +31,7 @@ module Ticket::Number::Increment
min_digs = min_digs.to_i - 1 min_digs = min_digs.to_i - 1
end end
fillup = Setting.get('system_id').to_s || '1' fillup = Setting.get('system_id').to_s || '1'
(1..100).each { 99.times {
next if (fillup.length.to_i + counter_increment.to_s.length.to_i) >= min_digs.to_i next if (fillup.length.to_i + counter_increment.to_s.length.to_i) >= min_digs.to_i

View file

@ -49,7 +49,28 @@ class Transaction::Trigger
next if condition['ticket.action']['operator'] != 'is' && condition['ticket.action']['value'] == @item[:type] next if condition['ticket.action']['operator'] != 'is' && condition['ticket.action']['value'] == @item[:type]
condition.delete('ticket.action') condition.delete('ticket.action')
end end
=begin
# check "has changed" options
has_changed = true
trigger.condition.each do |key, value|
next if !value
next if !value['operator']
next if !value['operator']['has changed']
# next if has changed? && !@item[:changes][attribute]
(object_name, attribute) = key.split('.', 2)
# remove condition item, because it has changed
if @item[:changes][attribute]
#condition.delete(key)
next
end
has_changed = false
break
#{"ticket.state_id"=>{"operator"=>"has changed"
end
next if !has_changed
=end
# check if selector is matching # check if selector is matching
condition['ticket.id'] = { condition['ticket.id'] = {
operator: 'is', operator: 'is',

View file

@ -77,7 +77,7 @@ or
end end
# looking for verify email # looking for verify email
(1..10).each { 9.times {
sleep 5 sleep 5
# fetch mailbox # fetch mailbox

View file

@ -117,7 +117,7 @@ class FirstStepsTest < TestCase
) )
click(css: '#navigation a[href="#dashboard"]') click(css: '#navigation a[href="#dashboard"]')
hit = false hit = false
(1..38).each { 37.times {
next if !@browser.find_elements(css: '.active.content a[href="#channels/form"].todo.is-done')[0] next if !@browser.find_elements(css: '.active.content a[href="#channels/form"].todo.is-done')[0]
hit = true hit = true
break break

View file

@ -258,7 +258,7 @@ class TestCase < Test::Unit::TestCase
mute_log: true, mute_log: true,
) )
(1..6).each { 5.times {
sleep 1 sleep 1
login = instance.find_elements(css: '#login')[0] login = instance.find_elements(css: '#login')[0]
@ -1309,7 +1309,7 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser instance = params[:browser] || @browser
(1..100).each do 99.times do
#sleep 0.5 #sleep 0.5
begin begin
if instance.find_elements(css: '.navigation .tasks .task:first-child')[0] if instance.find_elements(css: '.navigation .tasks .task:first-child')[0]
@ -1394,7 +1394,7 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser instance = params[:browser] || @browser
(1..100).each do 99.times do
sleep 0.5 sleep 0.5
begin begin
if instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0] if instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0]
@ -1562,7 +1562,7 @@ wait untill text in selector disabppears
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..12).each { 11.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -1663,7 +1663,7 @@ wait untill text in selector disabppears
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..12).each { 11.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -1742,7 +1742,7 @@ wait untill text in selector disabppears
) )
found = false found = false
(1..8).each { 7.times {
element = instance.find_elements(css: '.active .newTicket')[0] element = instance.find_elements(css: '.active .newTicket')[0]
if element if element
found = true found = true
@ -1889,7 +1889,7 @@ wait untill text in selector disabppears
) )
sleep 1 sleep 1
(1..10).each { 9.times {
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
assert(true, 'ticket created') assert(true, 'ticket created')
sleep 2.5 sleep 2.5
@ -2103,7 +2103,7 @@ wait untill text in selector disabppears
if data[:state] || data[:group] || data[:body] || !params[:custom_data_select].empty? || !params[:custom_data_input].empty? if data[:state] || data[:group] || data[:body] || !params[:custom_data_select].empty? || !params[:custom_data_input].empty?
found = nil found = nil
(1..10).each { 9.times {
break if found break if found
@ -2136,7 +2136,7 @@ wait untill text in selector disabppears
instance.find_elements(css: '.content.active .js-submit')[0].click instance.find_elements(css: '.content.active .js-submit')[0].click
(1..10).each { 9.times {
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 || text.empty? if !text || text.empty?
@ -2581,7 +2581,7 @@ wait untill text in selector disabppears
element.send_keys(data[:first_response_time_in_text]) element.send_keys(data[:first_response_time_in_text])
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..8).each { 7.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -2642,7 +2642,7 @@ wait untill text in selector disabppears
element.send_keys(data[:content]) element.send_keys(data[:content])
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..8).each { 7.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -2705,7 +2705,7 @@ wait untill text in selector disabppears
element.send_keys(data[:body]) element.send_keys(data[:body])
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..12).each { 11.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -2771,7 +2771,7 @@ wait untill text in selector disabppears
end end
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
(1..12).each { 11.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/
@ -2995,7 +2995,7 @@ wait untill text in selector disabppears
return return
end end
(1..12).each { 11.times {
element = instance.find_elements(css: 'body')[0] element = instance.find_elements(css: 'body')[0]
text = element.text text = element.text
if text =~ /#{Regexp.quote(data[:name])}/ if text =~ /#{Regexp.quote(data[:name])}/

View file

@ -161,7 +161,7 @@ class TwitterTest < ActiveSupport::TestCase
# fetch check system account # fetch check system account
sleep 10 sleep 10
article = nil article = nil
(1..2).each { 1.times {
Channel.fetch Channel.fetch
# check if follow up article has been created # check if follow up article has been created
@ -203,7 +203,7 @@ class TwitterTest < ActiveSupport::TestCase
# fetch check system account # fetch check system account
sleep 20 sleep 20
article = nil article = nil
(1..3).each { 2.times {
Channel.fetch Channel.fetch
# check if ticket and article has been created # check if ticket and article has been created
@ -285,7 +285,7 @@ class TwitterTest < ActiveSupport::TestCase
# fetch check system account # fetch check system account
sleep 15 sleep 15
article = nil article = nil
(1..2).each { 1.times {
Channel.fetch Channel.fetch
# check if ticket and article has been created # check if ticket and article has been created
@ -335,7 +335,7 @@ class TwitterTest < ActiveSupport::TestCase
# fetch check system account # fetch check system account
sleep 15 sleep 15
article = nil article = nil
(1..2).each { 1.times {
Channel.fetch Channel.fetch
# check if ticket and article has been created # check if ticket and article has been created
@ -368,7 +368,7 @@ class TwitterTest < ActiveSupport::TestCase
# fetch check system account # fetch check system account
sleep 15 sleep 15
article = nil article = nil
(1..2).each { 1.times {
Channel.fetch Channel.fetch
# check if ticket and article has been created # check if ticket and article has been created
@ -413,7 +413,7 @@ class TwitterTest < ActiveSupport::TestCase
) )
sleep 10 sleep 10
article = nil article = nil
(1..2).each { 1.times {
article = Ticket::Article.find_by(message_id: tweet.id) article = Ticket::Article.find_by(message_id: tweet.id)
break if article break if article
sleep 15 sleep 15
@ -437,7 +437,7 @@ class TwitterTest < ActiveSupport::TestCase
ActiveRecord::Base.connection.reconnect! ActiveRecord::Base.connection.reconnect!
sleep 10 sleep 10
article = nil article = nil
(1..2).each { 1.times {
article = Ticket::Article.find_by(message_id: tweet.id) article = Ticket::Article.find_by(message_id: tweet.id)
break if article break if article
sleep 15 sleep 15
@ -503,7 +503,7 @@ class TwitterTest < ActiveSupport::TestCase
#ActiveRecord::Base.connection.reconnect! #ActiveRecord::Base.connection.reconnect!
sleep 10 sleep 10
article = nil article = nil
(1..2).each { 1.times {
article = Ticket::Article.find_by(message_id: dm.id) article = Ticket::Article.find_by(message_id: dm.id)
break if article break if article
sleep 10 sleep 10

View file

@ -5,9 +5,10 @@ require 'cache'
require 'simplecov' require 'simplecov'
require 'simplecov-rcov' require 'simplecov-rcov'
ActiveSupport::TestCase.test_order = :sorted #ActiveSupport::TestCase.test_order = :sorted
class ActiveSupport::TestCase class ActiveSupport::TestCase
self.test_order = :sorted
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
# #

View file

@ -350,7 +350,7 @@ class PackageTest < ActiveSupport::TestCase
elsif test[:action] == 'auto_install' elsif test[:action] == 'auto_install'
if test[:zpm] if test[:zpm]
if !File.exist?( Rails.root.to_s + '/auto_install/' ) if !File.exist?( Rails.root.to_s + '/auto_install/' )
Dir.mkdir( Rails.root.to_s + '/auto_install/', 0755) Dir.mkdir( Rails.root.to_s + '/auto_install/', 0o755)
end end
location = Rails.root.to_s + '/auto_install/unittest.zpm' location = Rails.root.to_s + '/auto_install/unittest.zpm'
file = File.new( location, 'wb' ) file = File.new( location, 'wb' )