Moved to rubocop Style/NumericLiterals.

This commit is contained in:
Martin Edenhofer 2015-04-27 15:43:34 +02:00
parent 4f41d596c5
commit a299f79598
32 changed files with 65 additions and 65 deletions

View file

@ -609,7 +609,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# send verify email to inbox
if !params[:subject]
subject = '#' + rand(99999999999).to_s
subject = '#' + rand(99_999_999_999).to_s
else
subject = params[:subject]
end

View file

@ -149,7 +149,7 @@ class LongPollingController < ApplicationController
private
def client_id_gen
rand(9999999999).to_s
rand(9_999_999_999).to_s
end
def client_id_verify

View file

@ -45,7 +45,7 @@ class SessionsController < ApplicationController
# check logon session
logon_session_key = nil
if params['logon_session']
logon_session_key = Digest::MD5.hexdigest( rand(999999).to_s + Time.new.to_s )
logon_session_key = Digest::MD5.hexdigest( rand(999_999).to_s + Time.new.to_s )
# session = ActiveRecord::SessionStore::Session.create(
# :session_id => logon_session_key,
# :data => {

View file

@ -28,7 +28,7 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
# generate message id
fqdn = Setting.get('fqdn')
record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999999).to_s() + '@' + fqdn + '>'
record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999_999).to_s() + '@' + fqdn + '>'
# set sender
email_address = ticket.group.email_address

View file

@ -57,8 +57,8 @@ returns
get attachment of object
list = Store.list(
:object => 'Ticket::Article',
:o_id => 4711,
:object => 'Ticket::Article',
:o_id => 4711,
)
returns
@ -66,9 +66,9 @@ returns
result = [store1, store2]
store1 = {
:size => 94123,
:filename => 'image.png',
:preferences => {
:size => 94123,
:filename => 'image.png',
:preferences => {
:content_type => 'image/png',
:content_id => 234,
}
@ -90,8 +90,8 @@ returns
remove attachments of object from storage
result = Store.remove(
:object => 'Ticket::Article',
:o_id => 4711,
:object => 'Ticket::Article',
:o_id => 4711,
)
returns

View file

@ -34,7 +34,7 @@ Zammad::Application.configure do
config.middleware.use(Rack::LiveReload,
:min_delay => 500, # default 1000
:max_delay => 10_000, # default 60_000
:live_reload_port => 35738,
:live_reload_port => 35_738,
:source => :vendored
)

View file

@ -51,7 +51,7 @@ class CreateNetwork < ActiveRecord::Migration
create_table :network_items do |t|
t.references :network_category, :null => false
t.column :title, :string, :limit => 200, :null => false
t.column :body, :string, :limit => 20000, :null => false
t.column :body, :string, :limit => 20_000, :null => false
t.column :updated_by_id, :integer, :null => false
t.column :created_by_id, :integer, :null => false
t.timestamps
@ -60,7 +60,7 @@ class CreateNetwork < ActiveRecord::Migration
create_table :network_item_comments do |t|
t.references :network_item, :null => false
t.column :body, :string, :limit => 20000, :null => false
t.column :body, :string, :limit => 20_000, :null => false
t.column :updated_by_id, :integer, :null => false
t.column :created_by_id, :integer, :null => false
t.timestamps

View file

@ -454,7 +454,7 @@ class CreateObjectManager < ActiveRecord::Migration
:data_type => 'richtext',
:data_option => {
:type => 'richtext',
:maxlength => 20000,
:maxlength => 20_000,
:upload => true,
:rows => 8,
:null => true,

View file

@ -14,7 +14,7 @@ module FillDB
organization_pool = []
if organizations && !organizations.zero?
(1..organizations).each {|count|
organization = Organization.create( :name => 'FillOrganization::' + rand(999999).to_s, :active => true )
organization = Organization.create( :name => 'FillOrganization::' + rand(999_999).to_s, :active => true )
organization_pool.push organization
}
else
@ -27,7 +27,7 @@ module FillDB
roles = Role.where( :name => [ 'Agent'] )
groups_all = Group.all
(1..agents).each {|count|
suffix = rand(99999).to_s
suffix = rand(99_999).to_s
user = User.create_or_update(
:login => "filldb-agent-#{suffix}",
:firstname => "agent #{suffix}",
@ -51,7 +51,7 @@ module FillDB
roles = Role.where( :name => [ 'Customer'] )
groups_all = Group.all
(1..customers).each {|count|
suffix = rand(99999).to_s
suffix = rand(99_999).to_s
organization = nil
if !organization_pool.empty? && rand(2) == 1
organization = organization_pool[ organization_pool.length-1 ]
@ -77,7 +77,7 @@ module FillDB
if groups && !groups.zero?
puts "1..#{groups}"
(1..groups).each {|count|
group = Group.create( :name => 'FillGroup::' + rand(999999).to_s, :active => true )
group = Group.create( :name => 'FillGroup::' + rand(999_999).to_s, :active => true )
group_pool.push group
Role.where(:name => 'Agent').first.users.where(:active => true).each {|user|
user_groups = user.groups
@ -98,7 +98,7 @@ module FillDB
customer = customer_pool[ rand(customer_pool.length-1) ]
agent = agent_pool[ rand(agent_pool.length-1) ]
ticket = Ticket.create(
:title => 'some title äöüß' + rand(999999).to_s,
:title => 'some title äöüß' + rand(999_999).to_s,
:group => group_pool[ rand(group_pool.length-1) ],
:customer => customer,
:owner => agent,
@ -112,8 +112,8 @@ module FillDB
:ticket_id => ticket.id,
:from => customer.email,
:to => 'some_recipient@example.com',
:subject => 'some subject' + rand(999999).to_s,
:message_id => 'some@id-' + rand(999999).to_s,
:subject => 'some subject' + rand(999_999).to_s,
:message_id => 'some@id-' + rand(999_999).to_s,
:body => 'some message ...',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,

View file

@ -39,7 +39,7 @@ module SessionHelper
ActiveRecord::SessionStore::Session.where( :id => id ).first
end
def self.list(limit = 10000)
def self.list(limit = 10_000)
ActiveRecord::SessionStore::Session.order('updated_at DESC').limit(limit)
end

View file

@ -394,7 +394,7 @@ returns
def self.spool_create( msg )
path = @path + '/spool/'
FileUtils.mkpath path
file = Time.new.to_f.to_s + '-' + rand(99999).to_s
file = Time.new.to_f.to_s + '-' + rand(99_999).to_s
File.open( path + '/' + file , 'wb' ) { |file|
data = {
:msg => msg,
@ -428,7 +428,7 @@ returns
end
# ignore message older then 48h
if spool['timestamp'] + (2 * 86400) < Time.now.to_i
if spool['timestamp'] + (2 * 86_400) < Time.now.to_i
to_delete.push path + '/' + entry
next
end

View file

@ -152,7 +152,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
if config['holidays'].include?("#{year}-#{month}-#{day}")
# jump to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
next
end
end
@ -162,7 +162,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
if working_hours[ week_day_map[week_day] ].empty?
# jump to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
next
end
@ -211,7 +211,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
}
# loop to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
end
diff = count / 60
@ -273,7 +273,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
if config['holidays'].include?("#{year}-#{month}-#{day}")
# jump to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
next
end
end
@ -283,7 +283,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
if working_hours[ week_day_map[week_day] ].empty?
# jump to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
next
end
@ -349,7 +349,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
end
# loop to next day
start_time = start_time.beginning_of_day + 86400
start_time = start_time.beginning_of_day + 86_400
end
return start_time

View file

@ -4,8 +4,8 @@ require 'browser_test_helper'
class AgentOrganizationProfileTest < TestCase
def test_org_profile
# work in one browser window
message = '1 ' + rand(99999999).to_s
note = 'some note ' + rand(99999999).to_s
message = '1 ' + rand(99_999_999).to_s
note = 'some note ' + rand(99_999_999).to_s
@browser = browser_instance
login(
@ -84,7 +84,7 @@ class AgentOrganizationProfileTest < TestCase
# work with two browser windows
message = 'comment 1 ' + rand(99999999999999999).to_s
message = 'comment 1 ' + rand(99_999_999_999_999_999).to_s
# use current session
browser1 = @browser

View file

@ -3,8 +3,8 @@ require 'browser_test_helper'
class AgentTicketActionLevel0Test < TestCase
def test_text_modules
random = 'text_module_test_' + rand(99999999).to_s
random2 = 'text_module_test_' + rand(99999999).to_s
random = 'text_module_test_' + rand(99_999_999).to_s
random2 = 'text_module_test_' + rand(99_999_999).to_s
@browser = browser_instance
login(
@ -57,9 +57,9 @@ class AgentTicketActionLevel0Test < TestCase
# test with two browser windows
random = 'text_II_module_test_' + rand(99999999).to_s
random = 'text_II_module_test_' + rand(99_999_999).to_s
user_rand = rand(99999999).to_s
user_rand = rand(99_999_999).to_s
login = 'agent-text-module-' + user_rand
firstname = 'Text' + user_rand
lastname = 'Module' + user_rand

View file

@ -5,7 +5,7 @@ class AgentTicketActionsLevel2Test < TestCase
def test_work_with_two_browser_on_same_ticket
# work on one ticket with two browsers
message = 'message 1äöüß ' + rand(99999999999999999).to_s
message = 'message 1äöüß ' + rand(99_999_999_999_999_999).to_s
browser1 = browser_instance
login(

View file

@ -4,7 +4,7 @@ require 'browser_test_helper'
class AgentTicketActionLevel5Test < TestCase
def test_agent_signature_check
suffix = rand(99999999999999999).to_s
suffix = rand(99_999_999_999_999_999).to_s
signature_name1 = 'sig name 1 äöüß ' + suffix
signature_body1 = "--\nsig body 1 äöüß " + suffix
signature_name2 = 'sig name 2 äöüß ' + suffix

View file

@ -125,7 +125,7 @@ class AgentTicketActionLevel6Test < TestCase
tasks_close_all(
:browser => browser2,
)
random = 'ticket-actions-6-test-' + rand(999999).to_s
random = 'ticket-actions-6-test-' + rand(999_999).to_s
user_email = random + '@example.com'
user_create(
:browser => browser2,

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class AgentTicketOverviewLevel1Test < TestCase
def test_I
name = 'name-' + rand(999999).to_s
name = 'name-' + rand(999_999).to_s
browser1 = browser_instance
login(

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class AgentUserManageTest < TestCase
def test_agent_user
customer_user_email = 'customer-test-' + rand(999999).to_s + '@example.com'
customer_user_email = 'customer-test-' + rand(999_999).to_s + '@example.com'
firstname = 'Customer Firstname'
lastname = 'Customer Lastname'
fullname = "#{ firstname } #{ lastname } <#{ customer_user_email }>"

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class AgentUserProfileTest < TestCase
def test_user_profile
message = '1 ' + rand(99999999).to_s
message = '1 ' + rand(99_999_999).to_s
@browser = browser_instance
login(
@ -80,7 +80,7 @@ class AgentUserProfileTest < TestCase
# work with two browser windows
message = 'comment 1 ' + rand(99999999999999999).to_s
message = 'comment 1 ' + rand(99_999_999_999_999_999).to_s
# use current session
browser1 = @browser

View file

@ -4,7 +4,7 @@ require 'browser_test_helper'
class ChatTest < TestCase
def test_websocket
return # TODO: temp disable
message = 'message 1äöüß ' + rand(99999999999999999).to_s
message = 'message 1äöüß ' + rand(99_999_999_999_999_999).to_s
tests = [
{
:name => 'start',

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class MaintenanceMessageTest < TestCase
def test_websocket
string = rand(99999999999999999).to_s
string = rand(99_999_999_999_999_999).to_s
title_html = "test <b>#{string}</b>"
title_text = "test <b>#{string}<\/b>"
message_html = "message <b>1äöüß</b> #{string}\n\n\nhttp://zammad.org"

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class ManageTest < TestCase
def test_user
random = 'manage-test-' + rand(999999).to_s
random = 'manage-test-' + rand(999_999).to_s
user_email = random + '@example.com'
# user management

View file

@ -3,7 +3,7 @@ require 'browser_test_helper'
class SignupPasswordChangeAndResetTest < TestCase
def test_signup
signup_user_email = 'signup-test-' + rand(999999).to_s + '@example.com'
signup_user_email = 'signup-test-' + rand(999_999).to_s + '@example.com'
@browser = browser_instance
location( :url => browser_url )
click( :css => 'a[href="#signup"]' )

View file

@ -114,8 +114,8 @@ class CacheTest < ActiveSupport::TestCase
# verify if second cache write overwrite first one
test 'cache reset' do
Cache.write( 'some_reset_key', 123 )
Cache.write( 'some_reset_key', 12356 )
Cache.write( 'some_reset_key', 12_356 )
cache = Cache.get( 'some_reset_key' )
assert_equal( cache, 12356, 'verify' )
assert_equal( cache, 12_356, 'verify' )
end
end

View file

@ -4,7 +4,7 @@ require 'test_helper'
class ObjectCacheTest < ActiveSupport::TestCase
test 'object cache' do
name = 'object cache test ' + rand(9999999).to_s
name = 'object cache test ' + rand(9_999_999).to_s
group = Group.create(
:name => name,
:updated_by_id => 1,

View file

@ -71,7 +71,7 @@ class RecentViewTest < ActiveSupport::TestCase
# log entry of not existing record
RecentView.user_log_destroy(user)
RecentView.log( 'User', 99999999, user )
RecentView.log( 'User', 99_999_999, user )
# check if list is empty
list = RecentView.list( user )
@ -80,7 +80,7 @@ class RecentViewTest < ActiveSupport::TestCase
# log entry of not existing model with permission check
RecentView.user_log_destroy(user)
RecentView.log( 'Overview', 99999999, user )
RecentView.log( 'Overview', 99_999_999, user )
# check if list is empty
list = RecentView.list( user )

View file

@ -88,7 +88,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal( result1, result2, 'check collections' )
# change collection
group = Group.create( :name => 'SomeGroup::' + rand(999999).to_s, :active => true )
group = Group.create( :name => 'SomeGroup::' + rand(999_999).to_s, :active => true )
sleep 4
# get whole collections
@ -135,7 +135,7 @@ class SessionBasicTest < ActiveSupport::TestCase
require 'sessions/backend/collections/organization.rb'
UserInfo.current_user_id = 2
user = User.lookup(:id => 1)
org = Organization.create( :name => 'SomeOrg1::' + rand(999999).to_s, :active => true )
org = Organization.create( :name => 'SomeOrg1::' + rand(999_999).to_s, :active => true )
collection_client1 = Sessions::Backend::Collections::Organization.new(user, false, '123-1', 3)
collection_client2 = Sessions::Backend::Collections::Organization.new(user, false, '234-2', 3)
@ -155,7 +155,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert( !result2, 'check collections - recall' )
# change collection
org = Organization.create( :name => 'SomeOrg2::' + rand(999999).to_s, :active => true )
org = Organization.create( :name => 'SomeOrg2::' + rand(999_999).to_s, :active => true )
sleep 4
# get whole collections
@ -211,7 +211,7 @@ class SessionBasicTest < ActiveSupport::TestCase
agent1 = User.create_or_update(
:login => 'activity-stream-agent-1',
:firstname => 'Session',
:lastname => 'activity stream ' + rand(99999).to_s,
:lastname => 'activity stream ' + rand(99_999).to_s,
:email => 'activity-stream-agent1@example.com',
:password => 'agentpw',
:active => true,
@ -267,7 +267,7 @@ class SessionBasicTest < ActiveSupport::TestCase
result1 = ticket_create_client1.push
assert( !result1, 'check ticket_create - recall 2' )
Group.create( :name => 'SomeTicketCreateGroup::' + rand(999999).to_s, :active => true )
Group.create( :name => 'SomeTicketCreateGroup::' + rand(999_999).to_s, :active => true )
sleep 4

View file

@ -13,7 +13,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
agent1 = User.create_or_update(
:login => 'activity-stream-agent-1',
:firstname => 'Session',
:lastname => 'activity stream ' + rand(99999).to_s,
:lastname => 'activity stream ' + rand(99_999).to_s,
:email => 'activity-stream-agent1@example.com',
:password => 'agentpw',
:active => true,
@ -59,7 +59,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
agent1 = User.create_or_update(
:login => 'activity-stream-agent-1',
:firstname => 'Session',
:lastname => 'activity stream ' + rand(99999).to_s,
:lastname => 'activity stream ' + rand(99_999).to_s,
:email => 'activity-stream-agent1@example.com',
:password => 'agentpw',
:active => true,

View file

@ -108,7 +108,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
assert( check_if_collection_exists(result3, :Group), 'check collections - after touch' )
# change collection
org = Organization.create( :name => 'SomeOrg::' + rand(999999).to_s, :active => true, :member_ids => [customer1.id] )
org = Organization.create( :name => 'SomeOrg::' + rand(999_999).to_s, :active => true, :member_ids => [customer1.id] )
sleep 4
# get whole collections

View file

@ -205,7 +205,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
)
agent2.roles = roles
agent2.save
org = Organization.create( :name => 'SomeOrg::' + rand(999999).to_s, :active => true )
org = Organization.create( :name => 'SomeOrg::' + rand(999_999).to_s, :active => true )
# create sessions
client_id1_0 = '1234-1'

View file

@ -110,7 +110,7 @@ class WorkingTimeTest < ActiveSupport::TestCase
{
:start => '2012-02-28 17:00:00',
:end => '2013-03-08 23:59:59',
:diff => 160860,
:diff => 160_860,
:config => {
'Mon' => true,
'Tue' => true,
@ -550,7 +550,7 @@ class WorkingTimeTest < ActiveSupport::TestCase
]
tests.each { |test|
dest_time = TimeCalculation.dest_time( test[:start] + ' UTC', test[:diff], test[:config], test[:timezone] )
assert_equal( dest_time.gmtime, Time.parse( test[:dest_time] + ' UTC' ), "dest time - #{test[:dest_time].to_s}" )
assert_equal( dest_time.gmtime, Time.parse( test[:dest_time] + ' UTC' ), "dest time - #{test[:dest_time]}" )
}
end