diff --git a/.rubocop.yml b/.rubocop.yml index 1eab56c43..7867f0f89 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -167,13 +167,6 @@ Style/SymbolProc: Description: 'Use symbols as procs instead of blocks when possible.' Enabled: false -Style/HashSyntax: - Description: >- - Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax - { :a => 1, :b => 2 }. - StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals' - Enabled: false - Style/RedundantBegin: Description: "Don't use begin blocks when they are not needed." StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit' diff --git a/Gemfile b/Gemfile index 45a7301b8..04d1a75fe 100644 --- a/Gemfile +++ b/Gemfile @@ -74,10 +74,10 @@ group :development, :test do gem 'selenium-webdriver' # livereload on template changes (html, js, css) - gem 'guard', '>= 2.2.2', :require => false - gem 'guard-livereload', :require => false + gem 'guard', '>= 2.2.2', require: false + gem 'guard-livereload', require: false gem 'rack-livereload' - gem 'rb-fsevent', :require => false + gem 'rb-fsevent', require: false # code QA gem 'rubocop' diff --git a/Guardfile b/Guardfile index 90d07db40..481dbefa8 100644 --- a/Guardfile +++ b/Guardfile @@ -1,7 +1,7 @@ # A sample Guardfile # More info at https://github.com/guard/guard#readme -guard 'livereload', :port => '35738' do +guard 'livereload', port: '35738' do watch(%r{app/views/.+\.(erb|haml|slim)$}) watch(%r{app/helpers/.+\.rb}) watch(%r{public/.+\.(css|js|html)}) diff --git a/app/controllers/activity_stream_controller.rb b/app/controllers/activity_stream_controller.rb index 4a7c95fdb..c5ef67daa 100644 --- a/app/controllers/activity_stream_controller.rb +++ b/app/controllers/activity_stream_controller.rb @@ -8,7 +8,7 @@ class ActivityStreamController < ApplicationController activity_stream = current_user.activity_stream( params[:limit], true ) # return result - render :json => activity_stream + render json: activity_stream end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1825e0c54..535cc0503 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -41,7 +41,7 @@ class ApplicationController < ActionController::Base headers['Access-Control-Allow-Headers'] = 'Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Accept-Language' headers['Access-Control-Max-Age'] = '1728000' headers['Access-Control-Allow-Credentials'] = 'true' - render :text => '', :content_type => 'text/plain' + render text: '', content_type: 'text/plain' return false end end @@ -123,20 +123,20 @@ class ApplicationController < ActionController::Base # set basic auth user to current user current_user_set(userdata) return { - :auth => true + auth: true } end # return auth not ok return { - :auth => false, - :message => message, + auth: false, + message: message, } end # check logon session if params['logon_session'] - logon_session = ActiveRecord::SessionStore::Session.where( :session_id => params['logon_session'] ).first + logon_session = ActiveRecord::SessionStore::Session.where( session_id: params['logon_session'] ).first if logon_session userdata = User.find( logon_session.data[:user_id] ) end @@ -146,7 +146,7 @@ class ApplicationController < ActionController::Base # set logon session user to current user current_user_set(userdata) return { - :auth => true + auth: true } end @@ -166,13 +166,13 @@ class ApplicationController < ActionController::Base puts 'no valid session, user_id' message = 'no valid session, user_id' return { - :auth => false, - :message => message, + auth: false, + message: message, } end return { - :auth => true + auth: true } end @@ -182,10 +182,10 @@ class ApplicationController < ActionController::Base # return auth not ok if result[:auth] == false render( - :json => { - :error => result[:message], + json: { + error: result[:message], }, - :status => :unauthorized + status: :unauthorized ) return false end @@ -197,8 +197,8 @@ class ApplicationController < ActionController::Base def authentication_check_action_token(action) user = Token.check( - :action => action, - :name => params[:action_token], + action: action, + name: params[:action_token], ) if !user @@ -219,7 +219,7 @@ class ApplicationController < ActionController::Base end def ticket_permission(ticket) - return true if ticket.permission( :current_user => current_user ) + return true if ticket.permission( current_user: current_user ) response_access_deny false end @@ -236,14 +236,14 @@ class ApplicationController < ActionController::Base def valid_session_with_user return true if current_user - render :json => { :message => 'No session user!' }, :status => :unprocessable_entity + render json: { message: 'No session user!' }, status: :unprocessable_entity false end def response_access_deny render( - :json => {}, - :status => :unauthorized + json: {}, + status: :unauthorized ) false end @@ -252,7 +252,7 @@ class ApplicationController < ActionController::Base # config config = {} - Setting.select('name').where( :frontend => true ).each { |setting| + Setting.select('name').where( frontend: true ).each { |setting| config[setting.name] = Setting.get(setting.name) } @@ -296,11 +296,11 @@ class ApplicationController < ActionController::Base puts e.message.inspect logger.error e.message logger.error e.backtrace.inspect - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end def model_create_render_item (generic_object) - render :json => generic_object.attributes_with_associations, :status => :created + render json: generic_object.attributes_with_associations, status: :created end def model_update_render (object, params) @@ -319,11 +319,11 @@ class ApplicationController < ActionController::Base rescue Exception => e logger.error e.message logger.error e.backtrace.inspect - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end def model_update_render_item (generic_object) - render :json => generic_object.attributes_with_associations, :status => :ok + render json: generic_object.attributes_with_associations, status: :ok end def model_destory_render (object, params) @@ -334,11 +334,11 @@ class ApplicationController < ActionController::Base rescue Exception => e logger.error e.message logger.error e.backtrace.inspect - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end def model_destory_render_item () - render :json => {}, :status => :ok + render json: {}, status: :ok end def model_show_render (object, params) @@ -346,7 +346,7 @@ class ApplicationController < ActionController::Base if params[:full] generic_object_full = object.full( params[:id] ) - render :json => generic_object_full, :status => :ok + render json: generic_object_full, status: :ok return end @@ -355,11 +355,11 @@ class ApplicationController < ActionController::Base rescue Exception => e logger.error e.message logger.error e.backtrace.inspect - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end def model_show_render_item (generic_object) - render :json => generic_object.attributes_with_associations, :status => :ok + render json: generic_object.attributes_with_associations, status: :ok end def model_index_render (object, params) @@ -369,11 +369,11 @@ class ApplicationController < ActionController::Base rescue Exception => e logger.error e.message logger.error e.backtrace.inspect - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end def model_index_render_result (generic_objects) - render :json => generic_objects, :status => :ok + render json: generic_objects, status: :ok end end diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index ab63470b6..eb6030d97 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -44,12 +44,12 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # set system init to done Setting.set( 'system_init_done', true ) - render :json => { - :auto_wizard => true, - :setup_done => setup_done, - :import_mode => Setting.get('import_mode'), - :import_backend => Setting.get('import_backend'), - :system_online_service => Setting.get('system_online_service'), + render json: { + auto_wizard: true, + setup_done: setup_done, + import_mode: Setting.get('import_mode'), + import_backend: Setting.get('import_backend'), + system_online_service: Setting.get('system_online_service'), } return end @@ -60,11 +60,11 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end # return result - render :json => { - :setup_done => setup_done, - :import_mode => Setting.get('import_mode'), - :import_backend => Setting.get('import_backend'), - :system_online_service => Setting.get('system_online_service'), + render json: { + setup_done: setup_done, + import_mode: Setting.get('import_mode'), + import_backend: Setting.get('import_backend'), + system_online_service: Setting.get('system_online_service'), } end @@ -97,9 +97,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end if !messages.empty? - render :json => { - :result => 'invalid', - :messages => messages, + render json: { + result: 'invalid', + messages: messages, } return end @@ -143,9 +143,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} Setting.set(key, value) } - render :json => { - :result => 'ok', - :settings => settings, + render json: { + result: 'ok', + settings: settings, } end @@ -163,10 +163,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end if !user || !domain - render :json => { - :result => 'invalid', - :messages => { - :email => 'Invalid email.' + render json: { + result: 'invalid', + messages: { + email: 'Invalid email.' }, } return @@ -174,49 +174,49 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # check domain based attributes providerMap = { - :google => { - :domain => 'gmail.com|googlemail.com|gmail.de', - :inbound => { - :adapter => 'imap', - :options => { - :host => 'imap.gmail.com', - :port => '993', - :ssl => true, - :user => params[:email], - :password => params[:password], + google: { + domain: 'gmail.com|googlemail.com|gmail.de', + inbound: { + adapter: 'imap', + options: { + host: 'imap.gmail.com', + port: '993', + ssl: true, + user: params[:email], + password: params[:password], }, }, - :outbound => { - :adapter => 'smtp', - :options => { - :host => 'smtp.gmail.com', - :port => '25', - :start_tls => true, - :user => params[:email], - :password => params[:password], + outbound: { + adapter: 'smtp', + options: { + host: 'smtp.gmail.com', + port: '25', + start_tls: true, + user: params[:email], + password: params[:password], } }, }, - :microsoft => { - :domain => 'outlook.com|hotmail.com', - :inbound => { - :adapter => 'imap', - :options => { - :host => 'imap-mail.outlook.com', - :port => '993', - :ssl => true, - :user => params[:email], - :password => params[:password], + microsoft: { + domain: 'outlook.com|hotmail.com', + inbound: { + adapter: 'imap', + options: { + host: 'imap-mail.outlook.com', + port: '993', + ssl: true, + user: params[:email], + password: params[:password], }, }, - :outbound => { - :adapter => 'smtp', - :options => { - :host => 'smtp-mail.outlook.com', - :port => 25, - :start_tls => true, - :user => params[:email], - :password => params[:password], + outbound: { + adapter: 'smtp', + options: { + host: 'smtp-mail.outlook.com', + port: 25, + start_tls: true, + user: params[:email], + password: params[:password], } }, }, @@ -238,20 +238,20 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # probe inbound result = email_probe_inbound( settings[:inbound] ) if result[:result] != 'ok' - render :json => result + render json: result return end # probe outbound result = email_probe_outbound( settings[:outbound], params[:email] ) if result[:result] != 'ok' - render :json => result + render json: result return end - render :json => { - :result => 'ok', - :setting => settings, + render json: { + result: 'ok', + setting: settings, } return end @@ -263,23 +263,23 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if mail_exchangers && mail_exchangers[0] && mail_exchangers[0][0] inboundMx = [ { - :adapter => 'imap', - :options => { - :host => mail_exchangers[0][0], - :port => 993, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'imap', + options: { + host: mail_exchangers[0][0], + port: 993, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'imap', - :options => { - :host => mail_exchangers[0][0], - :port => 993, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'imap', + options: { + host: mail_exchangers[0][0], + port: 993, + ssl: true, + user: params[:email], + password: params[:password], }, }, ] @@ -287,103 +287,103 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end inboundAuto = [ { - :adapter => 'imap', - :options => { - :host => "mail.#{domain}", - :port => 993, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'imap', + options: { + host: "mail.#{domain}", + port: 993, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'imap', - :options => { - :host => "mail.#{domain}", - :port => 993, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'imap', + options: { + host: "mail.#{domain}", + port: 993, + ssl: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'imap', - :options => { - :host => "imap.#{domain}", - :port => 993, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'imap', + options: { + host: "imap.#{domain}", + port: 993, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'imap', - :options => { - :host => "imap.#{domain}", - :port => 993, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'imap', + options: { + host: "imap.#{domain}", + port: 993, + ssl: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "mail.#{domain}", - :port => 995, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'pop3', + options: { + host: "mail.#{domain}", + port: 995, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "mail.#{domain}", - :port => 995, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'pop3', + options: { + host: "mail.#{domain}", + port: 995, + ssl: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "pop.#{domain}", - :port => 995, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'pop3', + options: { + host: "pop.#{domain}", + port: 995, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "pop.#{domain}", - :port => 995, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'pop3', + options: { + host: "pop.#{domain}", + port: 995, + ssl: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "pop3.#{domain}", - :port => 995, - :ssl => true, - :user => user, - :password => params[:password], + adapter: 'pop3', + options: { + host: "pop3.#{domain}", + port: 995, + ssl: true, + user: user, + password: params[:password], }, }, { - :adapter => 'pop3', - :options => { - :host => "pop3.#{domain}", - :port => 995, - :ssl => true, - :user => params[:email], - :password => params[:password], + adapter: 'pop3', + options: { + host: "pop3.#{domain}", + port: 995, + ssl: true, + user: params[:email], + password: params[:password], }, }, ] @@ -402,8 +402,8 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } if !success - render :json => { - :result => 'failed', + render json: { + result: 'failed', } return end @@ -413,43 +413,43 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if mail_exchangers && mail_exchangers[0] && mail_exchangers[0][0] outboundMx = [ { - :adapter => 'smtp', - :options => { - :host => mail_exchangers[0][0], - :port => 25, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: mail_exchangers[0][0], + port: 25, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => mail_exchangers[0][0], - :port => 25, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: mail_exchangers[0][0], + port: 25, + start_tls: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => mail_exchangers[0][0], - :port => 465, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: mail_exchangers[0][0], + port: 465, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => mail_exchangers[0][0], - :port => 465, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: mail_exchangers[0][0], + port: 465, + start_tls: true, + user: params[:email], + password: params[:password], }, }, ] @@ -457,83 +457,83 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end outboundAuto = [ { - :adapter => 'smtp', - :options => { - :host => "mail.#{domain}", - :port => 25, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: "mail.#{domain}", + port: 25, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "mail.#{domain}", - :port => 25, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: "mail.#{domain}", + port: 25, + start_tls: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "mail.#{domain}", - :port => 465, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: "mail.#{domain}", + port: 465, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "mail.#{domain}", - :port => 465, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: "mail.#{domain}", + port: 465, + start_tls: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "smtp.#{domain}", - :port => 25, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: "smtp.#{domain}", + port: 25, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "smtp.#{domain}", - :port => 25, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: "smtp.#{domain}", + port: 25, + start_tls: true, + user: params[:email], + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "smtp.#{domain}", - :port => 465, - :start_tls => true, - :user => user, - :password => params[:password], + adapter: 'smtp', + options: { + host: "smtp.#{domain}", + port: 465, + start_tls: true, + user: user, + password: params[:password], }, }, { - :adapter => 'smtp', - :options => { - :host => "smtp.#{domain}", - :port => 465, - :start_tls => true, - :user => params[:email], - :password => params[:password], + adapter: 'smtp', + options: { + host: "smtp.#{domain}", + port: 465, + start_tls: true, + user: params[:email], + password: params[:password], }, }, ] @@ -551,15 +551,15 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } if !success - render :json => { - :result => 'failed', + render json: { + result: 'failed', } return end - render :json => { - :result => 'ok', - :setting => settings, + render json: { + result: 'ok', + setting: settings, } end @@ -570,8 +570,8 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # validate params if !params[:adapter] - render :json => { - :result => 'invalid', + render json: { + result: 'invalid', } return end @@ -579,7 +579,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # connection test result = email_probe_outbound( params, params[:email] ) - render :json => result + render json: result end def email_inbound @@ -589,8 +589,8 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # validate params if !params[:adapter] - render :json => { - :result => 'invalid', + render json: { + result: 'invalid', } return end @@ -598,7 +598,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # connection test result = email_probe_inbound( params ) - render :json => result + render json: result return end @@ -623,15 +623,15 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} begin if params[:inbound][:adapter] =~ /^imap$/i - found = Channel::IMAP.new.fetch( { :options => params[:inbound][:options] }, 'verify', subject ) + found = Channel::IMAP.new.fetch( { options: params[:inbound][:options] }, 'verify', subject ) else - found = Channel::POP3.new.fetch( { :options => params[:inbound][:options] }, 'verify', subject ) + found = Channel::POP3.new.fetch( { options: params[:inbound][:options] }, 'verify', subject ) end rescue Exception => e - render :json => { - :result => 'invalid', - :message => e.to_s, - :subject => subject, + render json: { + result: 'invalid', + message: e.to_s, + subject: subject, } return end @@ -639,70 +639,70 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if found && found == 'verify ok' # remember address - address = EmailAddress.where( :email => params[:meta][:email] ).first + address = EmailAddress.where( email: params[:meta][:email] ).first if !address address = EmailAddress.first end if address address.update_attributes( - :realname => params[:meta][:realname], - :email => params[:meta][:email], - :active => 1, - :updated_by_id => 1, - :created_by_id => 1, + realname: params[:meta][:realname], + email: params[:meta][:email], + active: 1, + updated_by_id: 1, + created_by_id: 1, ) else EmailAddress.create( - :realname => params[:meta][:realname], - :email => params[:meta][:email], - :active => 1, - :updated_by_id => 1, - :created_by_id => 1, + realname: params[:meta][:realname], + email: params[:meta][:email], + active: 1, + updated_by_id: 1, + created_by_id: 1, ) end # store mailbox Channel.create( - :area => 'Email::Inbound', - :adapter => params[:inbound][:adapter], - :options => params[:inbound][:options], - :group_id => 1, - :active => 1, - :updated_by_id => 1, - :created_by_id => 1, + area: 'Email::Inbound', + adapter: params[:inbound][:adapter], + options: params[:inbound][:options], + group_id: 1, + active: 1, + updated_by_id: 1, + created_by_id: 1, ) # save settings if params[:outbound][:adapter] =~ /^smtp$/i - smtp = Channel.where( :adapter => 'SMTP', :area => 'Email::Outbound' ).first + smtp = Channel.where( adapter: 'SMTP', area: 'Email::Outbound' ).first smtp.options = params[:outbound][:options] smtp.active = true smtp.save! - sendmail = Channel.where( :adapter => 'Sendmail' ).first + sendmail = Channel.where( adapter: 'Sendmail' ).first sendmail.active = false sendmail.save! else - sendmail = Channel.where( :adapter => 'Sendmail', :area => 'Email::Outbound' ).first + sendmail = Channel.where( adapter: 'Sendmail', area: 'Email::Outbound' ).first sendmail.options = {} sendmail.active = true sendmail.save! - smtp = Channel.where( :adapter => 'SMTP' ).first + smtp = Channel.where( adapter: 'SMTP' ).first smtp.active = false smtp.save end - render :json => { - :result => 'ok', + render json: { + result: 'ok', } return end } # check delivery for 30 sek. - render :json => { - :result => 'invalid', - :message => 'Verification Email not found in mailbox.', - :subject => subject, + render json: { + result: 'invalid', + message: 'Verification Email not found in mailbox.', + subject: subject, } end @@ -713,8 +713,8 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # validate params if !params[:adapter] result = { - :result => 'invalid', - :message => 'Invalid, need adapter!', + result: 'invalid', + message: 'Invalid, need adapter!', } return result end @@ -729,10 +729,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } else mail = { - :from => email, - :to => 'emailtrytest@znuny.com', - :subject => 'test', - :body => 'test', + from: email, + to: 'emailtrytest@znuny.com', + subject: 'test', + body: 'test', } end @@ -758,7 +758,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} Channel::SMTP.new.send( mail, { - :options => params[:options] + options: params[:options] } ) rescue Exception => e @@ -771,9 +771,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} whiteMap.each {|key, message| if e.message =~ /#{Regexp.escape(key)}/i result = { - :result => 'ok', - :settings => params, - :notice => e.message, + result: 'ok', + settings: params, + notice: e.message, } return result end @@ -786,15 +786,15 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end } result = { - :result => 'invalid', - :settings => params, - :message => e.message, - :message_human => message_human, + result: 'invalid', + settings: params, + message: e.message, + message_human: message_human, } return result end result = { - :result => 'ok', + result: 'ok', } return result end @@ -812,15 +812,15 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end } result = { - :result => 'invalid', - :settings => params, - :message => e.message, - :message_human => message_human, + result: 'invalid', + settings: params, + message: e.message, + message_human: message_human, } return result end result = { - :result => 'ok', + result: 'ok', } return result end @@ -843,7 +843,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if params[:adapter] =~ /^imap$/i begin - Channel::IMAP.new.fetch( { :options => params[:options] }, 'check' ) + Channel::IMAP.new.fetch( { options: params[:options] }, 'check' ) rescue Exception => e message_human = '' translationMap.each {|key, message| @@ -852,21 +852,21 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end } result = { - :result => 'invalid', - :settings => params, - :message => e.message, - :message_human => message_human, + result: 'invalid', + settings: params, + message: e.message, + message_human: message_human, } return result end result = { - :result => 'ok', + result: 'ok', } return result end begin - Channel::POP3.new.fetch( { :options => params[:options] }, 'check' ) + Channel::POP3.new.fetch( { options: params[:options] }, 'check' ) rescue Exception => e message_human = '' translationMap.each {|key, message| @@ -875,15 +875,15 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end } result = { - :result => 'invalid', - :settings => params, - :message => e.message, - :message_human => message_human, + result: 'invalid', + settings: params, + message: e.message, + message_human: message_human, } return result end result = { - :result => 'ok', + result: 'ok', } return result end @@ -917,18 +917,18 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end # get all groups - groups = Group.where( :active => true ) + groups = Group.where( active: true ) # get email addresses - addresses = EmailAddress.where( :active => true ) + addresses = EmailAddress.where( active: true ) - render :json => { - :setup_done => true, - :import_mode => Setting.get('import_mode'), - :import_backend => Setting.get('import_backend'), - :system_online_service => Setting.get('system_online_service'), - :addresses => addresses, - :groups => groups, + render json: { + setup_done: true, + import_mode: Setting.get('import_mode'), + import_backend: Setting.get('import_backend'), + system_online_service: Setting.get('system_online_service'), + addresses: addresses, + groups: groups, } true end diff --git a/app/controllers/ical_tickets_controller.rb b/app/controllers/ical_tickets_controller.rb index db300a489..d556aefd7 100644 --- a/app/controllers/ical_tickets_controller.rb +++ b/app/controllers/ical_tickets_controller.rb @@ -74,8 +74,8 @@ class IcalTicketsController < ApplicationController condition = { 'tickets.owner_id' => current_user.id, 'tickets.state_id' => Ticket::State.where( - :state_type_id => Ticket::StateType.where( - :name => [ + state_type_id: Ticket::StateType.where( + name: [ 'new', 'open', ], @@ -84,8 +84,8 @@ class IcalTicketsController < ApplicationController } tickets = Ticket.search( - :current_user => current_user, - :condition => condition, + current_user: current_user, + condition: condition, ) events_data = [] @@ -109,8 +109,8 @@ class IcalTicketsController < ApplicationController condition = { 'tickets.owner_id' => current_user.id, 'tickets.state_id' => Ticket::State.where( - :state_type_id => Ticket::StateType.where( - :name => [ + state_type_id: Ticket::StateType.where( + name: [ 'pending reminder', 'pending action', ], @@ -119,8 +119,8 @@ class IcalTicketsController < ApplicationController } tickets = Ticket.search( - :current_user => current_user, - :condition => condition, + current_user: current_user, + condition: condition, ) events_data = [] @@ -148,8 +148,8 @@ class IcalTicketsController < ApplicationController ] tickets = Ticket.search( - :current_user => current_user, - :condition => condition, + current_user: current_user, + condition: condition, ) events_data = [] @@ -186,9 +186,9 @@ class IcalTicketsController < ApplicationController send_data( cal.to_ical, - :filename => 'zammad.ical', - :type => 'text/plain', - :disposition => 'inline' + filename: 'zammad.ical', + type: 'text/plain', + disposition: 'inline' ) end diff --git a/app/controllers/import_otrs_controller.rb b/app/controllers/import_otrs_controller.rb index 96256957d..b667bd3e0 100644 --- a/app/controllers/import_otrs_controller.rb +++ b/app/controllers/import_otrs_controller.rb @@ -8,9 +8,9 @@ class ImportOtrsController < ApplicationController # validate if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/ - render :json => { - :result => 'invalid', - :message => 'Invalid!', + render json: { + result: 'invalid', + message: 'Invalid!', } return end @@ -32,10 +32,10 @@ class ImportOtrsController < ApplicationController message_human = message end } - render :json => { - :result => 'invalid', - :message_human => message_human, - :message => response.error.to_s, + render json: { + result: 'invalid', + message_human: message_human, + message: response.error.to_s, } return end @@ -53,9 +53,9 @@ class ImportOtrsController < ApplicationController Setting.set('import_otrs_endpoint', url) Setting.set('import_otrs_endpoint_key', '01234567899876543210') if response.body =~ /zammad migrator/ - render :json => { - :url => url, - :result => 'ok', + render json: { + url: url, + result: 'ok', } return elsif response.body =~ /(otrs\sag|otrs.com|otrs.org)/i @@ -65,9 +65,9 @@ class ImportOtrsController < ApplicationController # return result - render :json => { - :result => 'invalid', - :message_human => message_human, + render json: { + result: 'invalid', + message_human: message_human, } end @@ -77,9 +77,9 @@ class ImportOtrsController < ApplicationController Setting.set('import_mode', true) welcome = Import::OTRS2.connection_test if !welcome - render :json => { - :message => 'Migrator can\'t read OTRS output!', - :result => 'invalid', + render json: { + message: 'Migrator can\'t read OTRS output!', + result: 'invalid', } return end @@ -87,8 +87,8 @@ class ImportOtrsController < ApplicationController # start migration Import::OTRS2.delay.start - render :json => { - :result => 'ok', + render json: { + result: 'ok', } end @@ -97,9 +97,9 @@ class ImportOtrsController < ApplicationController state = Import::OTRS2.get_current_state - render :json => { - :data => state, - :result => 'in_progress', + render json: { + data: state, + result: 'in_progress', } end @@ -119,8 +119,8 @@ class ImportOtrsController < ApplicationController if !setup_done return false end - render :json => { - :setup_done => true, + render json: { + setup_done: true, } true end diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index a8921c1f8..06d3c64ab 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -6,8 +6,8 @@ class LinksController < ApplicationController # GET /api/v1/links def index links = Link.list( - :link_object => params[:link_object], - :link_object_value => params[:link_object_value], + link_object: params[:link_object], + link_object_value: params[:link_object_value], ) assets = {} @@ -15,15 +15,15 @@ class LinksController < ApplicationController links.each { |item| link_list.push item if item['link_object'] == 'Ticket' - ticket = Ticket.lookup( :id => item['link_object_value'] ) + ticket = Ticket.lookup( id: item['link_object_value'] ) assets = ticket.assets(assets) end } # return result - render :json => { - :links => link_list, - :assets => assets, + render json: { + links: link_list, + assets: assets, } end @@ -31,19 +31,19 @@ class LinksController < ApplicationController def add # lookup object id - object_id = Ticket.where( :number => params[:link_object_source_number] ).first.id + object_id = Ticket.where( number: params[:link_object_source_number] ).first.id link = Link.add( - :link_type => params[:link_type], - :link_object_target => params[:link_object_target], - :link_object_target_value => params[:link_object_target_value], - :link_object_source => params[:link_object_source], - :link_object_source_value => object_id + link_type: params[:link_type], + link_object_target: params[:link_object_target], + link_object_target_value: params[:link_object_target_value], + link_object_source: params[:link_object_source], + link_object_source_value: object_id ) if link - render :json => link, :status => :created + render json: link, status: :created else - render :json => link.errors, :status => :unprocessable_entity + render json: link.errors, status: :unprocessable_entity end end @@ -52,9 +52,9 @@ class LinksController < ApplicationController link = Link.remove(params) if link - render :json => link, :status => :created + render json: link, status: :created else - render :json => link.errors, :status => :unprocessable_entity + render json: link.errors, status: :unprocessable_entity end end diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index bb8947c14..81f96efc0 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -50,7 +50,7 @@ class LongPollingController < ApplicationController # send spool:sent event to client sleep 0.2 log 'notice', 'send spool:sent event', client_id - Sessions.send( client_id, { :event => 'spool:sent', :data => { :timestamp => Time.now.utc.to_i } } ) + Sessions.send( client_id, { event: 'spool:sent', data: { timestamp: Time.now.utc.to_i } } ) end @@ -62,7 +62,7 @@ class LongPollingController < ApplicationController user = User.find( user_id ).attributes end log 'notice', "send auth login (user_id #{user_id})", client_id - Sessions.create( client_id, user, { :type => 'ajax' } ) + Sessions.create( client_id, user, { type: 'ajax' } ) # broadcast elsif params['data']['action'] == 'broadcast' @@ -92,10 +92,10 @@ class LongPollingController < ApplicationController end if new_connection - result = { :client_id => client_id } - render :json => result + result = { client_id: client_id } + render json: result else - render :json => {} + render json: {} end end @@ -105,7 +105,7 @@ class LongPollingController < ApplicationController # check client id client_id = client_id_verify if !client_id - render :json => { :error => 'Invalid client_id receive!' }, :status => :unprocessable_entity + render json: { error: 'Invalid client_id receive!' }, status: :unprocessable_entity return end @@ -126,7 +126,7 @@ class LongPollingController < ApplicationController queue = Sessions.queue( client_id ) if queue && queue[0] # puts "send " + queue.inspect + client_id.to_s - render :json => queue + render json: queue return end 8.times {|loop| @@ -134,14 +134,14 @@ class LongPollingController < ApplicationController } #sleep 2 if count == 0 - render :json => { :action => 'pong' } + render json: { action: 'pong' } return end end rescue Exception => e puts e.inspect puts e.backtrace - render :json => { :error => 'Invalid client_id in receive loop!' }, :status => :unprocessable_entity + render json: { error: 'Invalid client_id in receive loop!' }, status: :unprocessable_entity return end end diff --git a/app/controllers/network_controller.rb b/app/controllers/network_controller.rb index eb2e05efc..310145cc3 100644 --- a/app/controllers/network_controller.rb +++ b/app/controllers/network_controller.rb @@ -10,7 +10,7 @@ class NetworksController < ApplicationController respond_to do |format| format.html # index.html.erb - format.json { render :json => @networks } + format.json { render json: @networks } end end @@ -21,7 +21,7 @@ class NetworksController < ApplicationController respond_to do |format| format.html # show.html.erb - format.json { render :json => @network } + format.json { render json: @network } end end @@ -32,7 +32,7 @@ class NetworksController < ApplicationController respond_to do |format| format.html # new.html.erb - format.json { render :json => @network } + format.json { render json: @network } end end @@ -48,11 +48,11 @@ class NetworksController < ApplicationController respond_to do |format| if @network.save - format.html { redirect_to @network, :notice => 'Network was successfully created.' } - format.json { render :json => @network, :status => :created } + format.html { redirect_to @network, notice: 'Network was successfully created.' } + format.json { render json: @network, status: :created } else - format.html { render :action => 'new' } - format.json { render :json => @network.errors, :status => :unprocessable_entity } + format.html { render action: 'new' } + format.json { render json: @network.errors, status: :unprocessable_entity } end end end @@ -64,11 +64,11 @@ class NetworksController < ApplicationController respond_to do |format| if @network.update_attributes(params[:network]) - format.html { redirect_to @network, :notice => 'Network was successfully updated.' } - format.json { render :json => @network, :status => :ok } + format.html { redirect_to @network, notice: 'Network was successfully updated.' } + format.json { render json: @network, status: :ok } else - format.html { render :action => 'edit' } - format.json { render :json => @network.errors, :status => :unprocessable_entity } + format.html { render action: 'edit' } + format.json { render json: @network.errors, status: :unprocessable_entity } end end end diff --git a/app/controllers/object_manager_attributes_controller.rb b/app/controllers/object_manager_attributes_controller.rb index 41112f4f5..5024303d0 100644 --- a/app/controllers/object_manager_attributes_controller.rb +++ b/app/controllers/object_manager_attributes_controller.rb @@ -7,8 +7,8 @@ class ObjectManagerAttributesController < ApplicationController # GET /object_manager_attributes_list def list return if deny_if_not_role(Z_ROLENAME_ADMIN) - render :json => { - :objects => ObjectManager.listFrontendObjects, + render json: { + objects: ObjectManager.listFrontendObjects, } #model_index_render(ObjectManager::Attribute, params) end @@ -16,7 +16,7 @@ class ObjectManagerAttributesController < ApplicationController # GET /object_manager_attributes def index return if deny_if_not_role(Z_ROLENAME_ADMIN) - render :json => ObjectManager::Attribute.list_full + render json: ObjectManager::Attribute.list_full #model_index_render(ObjectManager::Attribute, params) end diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index f822f693a..d95047577 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -48,7 +48,7 @@ curl http://localhost/api/v1/online_notifications.json -v -u #{login}:#{password def index if params[:full] - render :json => OnlineNotification.list_full(current_user, 50) + render json: OnlineNotification.list_full(current_user, 50) return end @@ -108,10 +108,10 @@ curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login notifications = OnlineNotification.list(current_user,100) notifications.each do |notification| if !notification['seen'] - OnlineNotification.seen( :id => notification['id'] ) + OnlineNotification.seen( id: notification['id'] ) end end - render :json => {}, :status => :ok + render json: {}, status: :ok end end \ No newline at end of file diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index f233fbfd7..3cbcc9042 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -52,12 +52,12 @@ curl http://localhost/api/v1/organizations.json -v -u #{login}:#{password} organizations = [] if is_role(Z_ROLENAME_CUSTOMER) && !is_role(Z_ROLENAME_ADMIN) && !is_role(Z_ROLENAME_AGENT) if current_user.organization_id - organizations = Organization.where( :id => current_user.organization_id ) + organizations = Organization.where( id: current_user.organization_id ) end else organizations = Organization.all end - render :json => organizations + render json: organizations end =begin @@ -82,7 +82,7 @@ curl http://localhost/api/v1/organizations/#{id}.json -v -u #{login}:#{password} # only allow customer to fetch his own organization if is_role(Z_ROLENAME_CUSTOMER) && !is_role(Z_ROLENAME_ADMIN) && !is_role(Z_ROLENAME_AGENT) if !current_user.organization_id - render :json => {} + render json: {} return end if params[:id].to_i != current_user.organization_id @@ -92,7 +92,7 @@ curl http://localhost/api/v1/organizations/#{id}.json -v -u #{login}:#{password} end if params[:full] full = Organization.full( params[:id] ) - render :json => full + render json: full return end model_show_render(Organization, params) @@ -190,7 +190,7 @@ Test: history = organization.history_get(true) # return result - render :json => history + render json: history end end \ No newline at end of file diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index 2553e58d2..49e291bb7 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -7,8 +7,8 @@ class PackagesController < ApplicationController def index return if deny_if_not_role(Z_ROLENAME_ADMIN) packages = Package.all().order('name') - render :json => { - :packages => packages + render json: { + packages: packages } end @@ -16,7 +16,7 @@ class PackagesController < ApplicationController def install return if deny_if_not_role(Z_ROLENAME_ADMIN) - Package.install( :string => params[:file_upload].read ) + Package.install( string: params[:file_upload].read ) redirect_to '/#system/package' end @@ -27,10 +27,10 @@ class PackagesController < ApplicationController package = Package.find( params[:id] ) - Package.uninstall( :name => package.name, :version => package.version ) + Package.uninstall( name: package.name, version: package.version ) - render :json => { - :success => true + render json: { + success: true } end diff --git a/app/controllers/recent_view_controller.rb b/app/controllers/recent_view_controller.rb index 01a75ffa8..4b6ca2184 100644 --- a/app/controllers/recent_view_controller.rb +++ b/app/controllers/recent_view_controller.rb @@ -22,7 +22,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content- recent_viewed = RecentView.list_full( current_user, 10 ) # return result - render :json => recent_viewed + render json: recent_viewed end =begin @@ -49,7 +49,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content- RecentView.log( params[:object], params[:o_id], current_user ) # return result - render :json => { :message => 'ok' } + render json: { message: 'ok' } end end \ No newline at end of file diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb index bf7768b81..256505bdb 100644 --- a/app/controllers/rss_controller.rb +++ b/app/controllers/rss_controller.rb @@ -21,10 +21,10 @@ curl http://localhost/api/v1/rss_fetch.json -v -u #{login}:#{password} -H "Conte def fetch items = Rss.fetch(params[:url], params[:limit]) if items == nil - render :json => { :message => "failed to fetch #{ params[:url] }", :status => :unprocessable_entity } + render json: { message: "failed to fetch #{ params[:url] }", status: :unprocessable_entity } return end - render :json => { :items => items } + render json: { items: items } end end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 80701b1c3..f98623c37 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -30,40 +30,40 @@ class SearchController < ApplicationController else # do query users = User.search( - :query => query, - :limit => limit, - :current_user => current_user, + query: query, + limit: limit, + current_user: current_user, ) user_result = [] users.each do |user| item = { - :id => user.id, - :type => user.class.to_s + id: user.id, + type: user.class.to_s } result.push item assets = user.assets(assets) end organizations = Organization.search( - :query => query, - :limit => limit, - :current_user => current_user, + query: query, + limit: limit, + current_user: current_user, ) organization_result = [] organizations.each do |organization| item = { - :id => organization.id, - :type => organization.class.to_s + id: organization.id, + type: organization.class.to_s } result.push item assets = organization.assets(assets) end end - render :json => { - :assets => assets, - :result => result, + render json: { + assets: assets, + result: result, } end @@ -72,9 +72,9 @@ class SearchController < ApplicationController # build result list tickets = Ticket.search( - :limit => params[:limit], - :query => params[:term], - :current_user => current_user, + limit: params[:limit], + query: params[:term], + current_user: current_user, ) assets = {} ticket_result = [] @@ -85,9 +85,9 @@ class SearchController < ApplicationController # do query users = User.search( - :query => params[:term], - :limit => params[:limit], - :current_user => current_user, + query: params[:term], + limit: params[:limit], + current_user: current_user, ) user_result = [] users.each do |user| @@ -96,9 +96,9 @@ class SearchController < ApplicationController end organizations = Organization.search( - :query => params[:term], - :limit => params[:limit], - :current_user => current_user, + query: params[:term], + limit: params[:limit], + current_user: current_user, ) organization_result = [] @@ -110,30 +110,30 @@ class SearchController < ApplicationController result = [] if ticket_result[0] data = { - :name => 'Ticket', - :ids => ticket_result, + name: 'Ticket', + ids: ticket_result, } result.push data end if user_result[0] data = { - :name => 'User', - :ids => user_result, + name: 'User', + ids: user_result, } result.push data end if organization_result[0] data = { - :name => 'Organization', - :ids => organization_result, + name: 'Organization', + ids: organization_result, } result.push data end # return result - render :json => { - :assets => assets, - :result => result, + render json: { + assets: assets, + result: result, } end diff --git a/app/controllers/sessions/collection_base.rb b/app/controllers/sessions/collection_base.rb index 08dfc835f..a834d499c 100644 --- a/app/controllers/sessions/collection_base.rb +++ b/app/controllers/sessions/collection_base.rb @@ -4,9 +4,9 @@ module ExtraCollection def session( collections, assets, user ) # all base stuff - collections[ Locale.to_app_model ] = Locale.where( :active => true ) + collections[ Locale.to_app_model ] = Locale.where( active: true ) - collections[ Taskbar.to_app_model ] = Taskbar.where( :user_id => user.id ) + collections[ Taskbar.to_app_model ] = Taskbar.where( user_id: user.id ) collections[ Taskbar.to_app_model ].each {|item| assets = item.assets(assets) } @@ -34,7 +34,7 @@ module ExtraCollection else if user.organization_id collections[ Organization.to_app_model ] = [] - Organization.where( :id => user.organization_id ).each {|item| + Organization.where( id: user.organization_id ).each {|item| assets = item.assets(assets) } end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 5ccb54120..0e1471704 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -13,7 +13,7 @@ class SessionsController < ApplicationController # auth failed if !user - render :json => { :error => 'login failed' }, :status => :unauthorized + render json: { error: 'login failed' }, status: :unauthorized return end @@ -55,14 +55,14 @@ class SessionsController < ApplicationController end # return new session data - render :json => { - :session => user, - :models => models, - :collections => collections, - :assets => assets, - :logon_session => logon_session_key, + render json: { + session: user, + models: models, + collections: collections, + assets: assets, + logon_session: logon_session_key, }, - :status => :created + status: :created end def show @@ -86,10 +86,10 @@ class SessionsController < ApplicationController # get models models = SessionHelper::models() - render :json => { - :error => 'no valid session', - :config => config_frontend, - :models => models, + render json: { + error: 'no valid session', + config: config_frontend, + models: models, } return end @@ -108,12 +108,12 @@ class SessionsController < ApplicationController models = SessionHelper::models(user) # return current session - render :json => { - :session => user, - :models => models, - :collections => collections, - :assets => assets, - :config => config_frontend, + render json: { + session: user, + models: models, + collections: collections, + assets: assets, + config: config_frontend, } end @@ -127,7 +127,7 @@ class SessionsController < ApplicationController request.env['rack.session.options'][:expire_after] = -1.year request.env['rack.session.options'][:renew] = true - render :json => { } + render json: { } end def create_omniauth @@ -195,17 +195,17 @@ class SessionsController < ApplicationController # check user if !params[:id] render( - :json => { :message => 'no user given' }, - :status => :not_found + json: { message: 'no user given' }, + status: :not_found ) return false end - user = User.lookup( :id => params[:id] ) + user = User.lookup( id: params[:id] ) if !user render( - :json => {}, - :status => :not_found + json: {}, + status: :not_found ) return false end @@ -231,11 +231,11 @@ class SessionsController < ApplicationController return false end - user = User.lookup( :id => session[:switched_from_user_id] ) + user = User.lookup( id: session[:switched_from_user_id] ) if !user render( - :json => {}, - :status => :not_found + json: {}, + status: :not_found ) return false end @@ -263,20 +263,20 @@ class SessionsController < ApplicationController next if !session.data['user_id'] sessions_clean.push session if session.data['user_id'] - user = User.lookup( :id => session.data['user_id'] ) + user = User.lookup( id: session.data['user_id'] ) assets = user.assets( assets ) end } - render :json => { - :sessions => sessions_clean, - :assets => assets, + render json: { + sessions: sessions_clean, + assets: assets, } end def delete return if deny_if_not_role(Z_ROLENAME_ADMIN) SessionHelper::destroy( params[:id] ) - render :json => {} + render json: {} end end \ No newline at end of file diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 0629fd2cc..16ba7dd72 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -8,49 +8,49 @@ class TagsController < ApplicationController list = Tag.list() # return result - render :json => { - :tags => list, + render json: { + tags: list, } end # GET /api/v1/tags def list list = Tag.tag_list( - :object => params[:object], - :o_id => params[:o_id], + object: params[:object], + o_id: params[:o_id], ) # return result - render :json => { - :tags => list, + render json: { + tags: list, } end # POST /api/v1/tag/add def add success = Tag.tag_add( - :object => params[:object], - :o_id => params[:o_id], - :item => params[:item], + object: params[:object], + o_id: params[:o_id], + item: params[:item], ); if success - render :json => success, :status => :created + render json: success, status: :created else - render :json => success.errors, :status => :unprocessable_entity + render json: success.errors, status: :unprocessable_entity end end # DELETE /api/v1/tag/remove def remove success = Tag.tag_remove( - :object => params[:object], - :o_id => params[:o_id], - :item => params[:item], + object: params[:object], + o_id: params[:o_id], + item: params[:item], ); if success - render :json => success, :status => :created + render json: success, status: :created else - render :json => success.errors, :status => :unprocessable_entity + render json: success.errors, status: :unprocessable_entity end end diff --git a/app/controllers/taskbar_controller.rb b/app/controllers/taskbar_controller.rb index 9d0e44667..378907aaf 100644 --- a/app/controllers/taskbar_controller.rb +++ b/app/controllers/taskbar_controller.rb @@ -5,7 +5,7 @@ class TaskbarController < ApplicationController def index - current_user_tasks = Taskbar.where( :user_id => current_user.id ) + current_user_tasks = Taskbar.where( user_id: current_user.id ) model_index_render_result(current_user_tasks) end @@ -40,7 +40,7 @@ class TaskbarController < ApplicationController private def access(taskbar) if taskbar.user_id != current_user.id - render :json => { :error => 'Not allowed to access this task.' }, :status => :unprocessable_entity + render json: { error: 'Not allowed to access this task.' }, status: :unprocessable_entity return false end return true diff --git a/app/controllers/tests_controller.rb b/app/controllers/tests_controller.rb index 81bf09477..51941261c 100644 --- a/app/controllers/tests_controller.rb +++ b/app/controllers/tests_controller.rb @@ -5,8 +5,8 @@ class TestsController < ApplicationController # GET /test/wait def wait sleep params[:sec].to_i - result = { :success => true } - render :json => result + result = { success: true } + render json: result end end \ No newline at end of file diff --git a/app/controllers/ticket_articles_controller.rb b/app/controllers/ticket_articles_controller.rb index 9a8623004..88b2daf4f 100644 --- a/app/controllers/ticket_articles_controller.rb +++ b/app/controllers/ticket_articles_controller.rb @@ -7,14 +7,14 @@ class TicketArticlesController < ApplicationController def index @articles = Ticket::Article.all - render :json => @articles + render json: @articles end # GET /articles/1 def show @article = Ticket::Article.find( params[:id] ) - render :json => @article + render json: @article end # POST /articles @@ -26,8 +26,8 @@ class TicketArticlesController < ApplicationController # find attachments in upload cache if form_id @article.attachments = Store.list( - :object => 'UploadCache', - :o_id => form_id, + object: 'UploadCache', + o_id: form_id, ) end @@ -35,13 +35,13 @@ class TicketArticlesController < ApplicationController # remove attachments from upload cache Store.remove( - :object => 'UploadCache', - :o_id => form_id, + object: 'UploadCache', + o_id: form_id, ) - render :json => @article, :status => :created + render json: @article, status: :created else - render :json => @article.errors, :status => :unprocessable_entity + render json: @article.errors, status: :unprocessable_entity end end @@ -50,9 +50,9 @@ class TicketArticlesController < ApplicationController @article = Ticket::Article.find( params[:id] ) if @article.update_attributes( Ticket::Article.param_validation( params[:ticket_article] ) ) - render :json => @article, :status => :ok + render json: @article, status: :ok else - render :json => @article.errors, :status => :unprocessable_entity + render json: @article.errors, status: :unprocessable_entity end end @@ -69,8 +69,8 @@ class TicketArticlesController < ApplicationController Store.remove_item( params[:store_id] ) # return result - render :json => { - :success => true, + render json: { + success: true, } end @@ -91,20 +91,20 @@ class TicketArticlesController < ApplicationController 'Content-Type' => content_type } store = Store.add( - :object => 'UploadCache', - :o_id => params[:form_id], - :data => file.read, - :filename => file.original_filename, - :preferences => headers_store + object: 'UploadCache', + o_id: params[:form_id], + data: file.read, + filename: file.original_filename, + preferences: headers_store ) # return result - render :json => { - :success => true, - :data => { - :store_id => store.id, - :filename => file.original_filename, - :size => store.size, + render json: { + success: true, + data: { + store_id: store.id, + filename: file.original_filename, + size: store.size, } } end @@ -115,12 +115,12 @@ class TicketArticlesController < ApplicationController # permissin check ticket = Ticket.find( params[:ticket_id] ) if !ticket_permission(ticket) - render( :json => 'No such ticket.', :status => :unauthorized ) + render( json: 'No such ticket.', status: :unauthorized ) return end article = Ticket::Article.find( params[:article_id] ) if ticket.id != article.ticket_id - render( :json => 'No access, article_id/ticket_id is not matching.', :status => :unauthorized ) + render( json: 'No access, article_id/ticket_id is not matching.', status: :unauthorized ) return end @@ -132,7 +132,7 @@ class TicketArticlesController < ApplicationController end } if !access - render( :json => 'Requested file id is not linked with article_id.', :status => :unauthorized ) + render( json: 'Requested file id is not linked with article_id.', status: :unauthorized ) return end @@ -140,9 +140,9 @@ class TicketArticlesController < ApplicationController file = Store.find(params[:id]) send_data( file.content, - :filename => file.filename, - :type => file.preferences['Content-Type'] || file.preferences['Mime-Type'], - :disposition => 'inline' + filename: file.filename, + type: file.preferences['Content-Type'] || file.preferences['Mime-Type'], + disposition: 'inline' ) end @@ -154,8 +154,8 @@ class TicketArticlesController < ApplicationController return if !ticket_permission( article.ticket ) list = Store.list( - :object => 'Ticket::Article::Mail', - :o_id => params[:id], + object: 'Ticket::Article::Mail', + o_id: params[:id], ) # find file @@ -163,9 +163,9 @@ class TicketArticlesController < ApplicationController file = Store.find(list.first) send_data( file.content, - :filename => file.filename, - :type => 'message/rfc822', - :disposition => 'inline' + filename: file.filename, + type: 'message/rfc822', + disposition: 'inline' ) end end diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index 4a9cbaaea..c83754b26 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -11,53 +11,53 @@ class TicketOverviewsController < ApplicationController # get navbar overview data if !params[:view] result = Ticket::Overviews.list( - :current_user => current_user, + current_user: current_user, ) - render :json => result + render json: result return end # get real overview data if params[:array] overview = Ticket::Overviews.list( - :view => params[:view], - :current_user => current_user, - :array => true, + view: params[:view], + current_user: current_user, + array: true, ) tickets = [] overview[:tickets].each {|ticket_id| - data = { :id => ticket_id } + data = { id: ticket_id } tickets.push data } # return result - render :json => { - :overview => overview[:overview], - :tickets => tickets, - :tickets_count => overview[:tickets_count], + render json: { + overview: overview[:overview], + tickets: tickets, + tickets_count: overview[:tickets_count], } return end overview = Ticket::Overviews.list( - :view => params[:view], - :current_user => current_user, - :array => true, + view: params[:view], + current_user: current_user, + array: true, ) if !overview - render :json => { :error => "No such view #{ params[:view] }!" }, :status => :unprocessable_entity + render json: { error: "No such view #{ params[:view] }!" }, status: :unprocessable_entity return end # get related users assets = {} overview[:ticket_ids].each {|ticket_id| - ticket = Ticket.lookup( :id => ticket_id ) + ticket = Ticket.lookup( id: ticket_id ) assets = ticket.assets(assets) } # get groups group_ids = [] - Group.where( :active => true ).each { |group| + Group.where( active: true ).each { |group| group_ids.push group.id } agents = {} @@ -75,15 +75,15 @@ class TicketOverviewsController < ApplicationController } # return result - render :json => { - :view => params[:view], - :overview => overview[:overview], - :ticket_ids => overview[:ticket_ids], - :tickets_count => overview[:tickets_count], - :bulk => { - :group_id__owner_id => groups_users, + render json: { + view: params[:view], + overview: overview[:overview], + ticket_ids: overview[:ticket_ids], + tickets_count: overview[:tickets_count], + bulk: { + group_id__owner_id: groups_users, }, - :assets => assets, + assets: assets, } end diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index e9e5b0de8..981c32408 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -7,7 +7,7 @@ class TicketsController < ApplicationController def index @tickets = Ticket.all - render :json => @tickets + render json: @tickets end # GET /api/v1/tickets/1 @@ -17,7 +17,7 @@ class TicketsController < ApplicationController # permissin check return if !ticket_permission(@ticket) - render :json => @ticket + render json: @ticket end # POST /api/v1/tickets @@ -26,13 +26,13 @@ class TicketsController < ApplicationController # check if article is given if !params[:article] - render :json => 'article hash is missing', :status => :unprocessable_entity + render json: 'article hash is missing', status: :unprocessable_entity return end # create ticket if !ticket.save - render :json => ticket.errors, :status => :unprocessable_entity + render json: ticket.errors, status: :unprocessable_entity return end @@ -41,10 +41,10 @@ class TicketsController < ApplicationController tags = params[:tags].split /,/ tags.each {|tag| Tag.tag_add( - :object => 'Ticket', - :o_id => ticket.id, - :item => tag, - :created_by_id => current_user.id, + object: 'Ticket', + o_id: ticket.id, + item: tag, + created_by_id: current_user.id, ) } end @@ -54,7 +54,7 @@ class TicketsController < ApplicationController article_create( ticket, params[:article] ) end - render :json => ticket, :status => :created + render json: ticket, status: :created end # PUT /api/v1/tickets/1 @@ -70,9 +70,9 @@ class TicketsController < ApplicationController article_create( ticket, params[:article] ) end - render :json => ticket, :status => :ok + render json: ticket, status: :ok else - render :json => ticket.errors, :status => :unprocessable_entity + render json: ticket.errors, status: :unprocessable_entity end end @@ -94,10 +94,10 @@ class TicketsController < ApplicationController # return result result = Ticket::ScreenOptions.list_by_customer( - :customer_id => params[:customer_id], - :limit => 15, + customer_id: params[:customer_id], + limit: 15, ) - render :json => result + render json: result end # GET /api/v1/ticket_history/1 @@ -114,7 +114,7 @@ class TicketsController < ApplicationController # return result - render :json => history + render json: history end # GET /api/v1/ticket_related/1 @@ -130,8 +130,8 @@ class TicketsController < ApplicationController map( &:id ) access_condition = [ 'group_id IN (?)', group_ids ] ticket_list = Ticket.where( - :customer_id => ticket.customer_id, - :state_id => Ticket::State.by_category( 'open' ) + customer_id: ticket.customer_id, + state_id: Ticket::State.by_category( 'open' ) ) .where(access_condition) @@ -158,10 +158,10 @@ class TicketsController < ApplicationController } # return result - render :json => { - :assets => assets, - :ticket_ids_by_customer => ticket_ids_by_customer, - :ticket_ids_recent_viewed => ticket_ids_recent_viewed, + render json: { + assets: assets, + ticket_ids_by_customer: ticket_ids_by_customer, + ticket_ids_recent_viewed: ticket_ids_recent_viewed, } end @@ -169,11 +169,11 @@ class TicketsController < ApplicationController def ticket_merge # check master ticket - ticket_master = Ticket.where( :number => params[:master_ticket_number] ).first + ticket_master = Ticket.where( number: params[:master_ticket_number] ).first if !ticket_master - render :json => { - :result => 'faild', - :message => 'No such master ticket number!', + render json: { + result: 'faild', + message: 'No such master ticket number!', } return end @@ -182,11 +182,11 @@ class TicketsController < ApplicationController return if !ticket_permission(ticket_master) # check slave ticket - ticket_slave = Ticket.where( :id => params[:slave_ticket_id] ).first + ticket_slave = Ticket.where( id: params[:slave_ticket_id] ).first if !ticket_slave - render :json => { - :result => 'faild', - :message => 'No such slave ticket!', + render json: { + result: 'faild', + message: 'No such slave ticket!', } return end @@ -196,9 +196,9 @@ class TicketsController < ApplicationController # check diffetent ticket ids if ticket_slave.id == ticket_master.id - render :json => { - :result => 'faild', - :message => 'Can\'t merge ticket with it self!', + render json: { + result: 'faild', + message: 'Can\'t merge ticket with it self!', } return end @@ -206,16 +206,16 @@ class TicketsController < ApplicationController # merge ticket success = ticket_slave.merge_to( { - :ticket_id => ticket_master.id, - :created_by_id => current_user.id, + ticket_id: ticket_master.id, + created_by_id: current_user.id, } ) # return result - render :json => { - :result => 'success', - :master_ticket => ticket_master.attributes, - :slave_ticket => ticket_slave.attributes, + render json: { + result: 'success', + master_ticket: ticket_master.attributes, + slave_ticket: ticket_slave.attributes, } end @@ -227,14 +227,14 @@ class TicketsController < ApplicationController return if !ticket_permission( ticket ) # get attributes to update - attributes_to_change = Ticket::ScreenOptions.attributes_to_change( :user => current_user, :ticket => ticket ) + attributes_to_change = Ticket::ScreenOptions.attributes_to_change( user: current_user, ticket: ticket ) # get related users assets = attributes_to_change[:assets] assets = ticket.assets(assets) # get related articles - articles = Ticket::Article.where( :ticket_id => params[:id] ) + articles = Ticket::Article.where( ticket_id: params[:id] ) # get related users article_ids = [] @@ -252,34 +252,34 @@ class TicketsController < ApplicationController # get links links = Link.list( - :link_object => 'Ticket', - :link_object_value => ticket.id, + link_object: 'Ticket', + link_object_value: ticket.id, ) link_list = [] links.each { |item| link_list.push item if item['link_object'] == 'Ticket' - linked_ticket = Ticket.lookup( :id => item['link_object_value'] ) + linked_ticket = Ticket.lookup( id: item['link_object_value'] ) assets = linked_ticket.assets(assets) end } # get tags tags = Tag.tag_list( - :object => 'Ticket', - :o_id => ticket.id, + object: 'Ticket', + o_id: ticket.id, ) # return result - render :json => { - :ticket_id => ticket.id, - :ticket_article_ids => article_ids, - :assets => assets, - :links => link_list, - :tags => tags, - :form_meta => { - :filter => attributes_to_change[:filter], - :dependencies => attributes_to_change[:dependencies], + render json: { + ticket_id: ticket.id, + ticket_article_ids: article_ids, + assets: assets, + links: link_list, + tags: tags, + form_meta: { + filter: attributes_to_change[:filter], + dependencies: attributes_to_change[:dependencies], } } end @@ -289,9 +289,9 @@ class TicketsController < ApplicationController # get attributes to update attributes_to_change = Ticket::ScreenOptions.attributes_to_change( - :user => current_user, - :ticket_id => params[:ticket_id], - :article_id => params[:article_id] + user: current_user, + ticket_id: params[:ticket_id], + article_id: params[:article_id] ) assets = attributes_to_change[:assets] @@ -309,12 +309,12 @@ class TicketsController < ApplicationController end # return result - render :json => { - :split => split, - :assets => assets, - :form_meta => { - :filter => attributes_to_change[:filter], - :dependencies => attributes_to_change[:dependencies], + render json: { + split: split, + assets: assets, + form_meta: { + filter: attributes_to_change[:filter], + dependencies: attributes_to_change[:dependencies], } } end @@ -327,11 +327,11 @@ class TicketsController < ApplicationController # build result list tickets = Ticket.search( - :limit => params[:limit], - :query => params[:term], - :condition => params[:condition], - :current_user => current_user, - :detail => params[:detail] + limit: params[:limit], + query: params[:term], + condition: params[:condition], + current_user: current_user, + detail: params[:detail] ) assets = {} ticket_result = [] @@ -341,10 +341,10 @@ class TicketsController < ApplicationController end # return result - render :json => { - :tickets => ticket_result, - :tickets_count => tickets.count, - :assets => assets, + render json: { + tickets: ticket_result, + tickets_count: tickets.count, + assets: assets, } end @@ -373,11 +373,11 @@ class TicketsController < ApplicationController 'tickets.customer_id' => user.id, } user_tickets_open = Ticket.search( - :limit => limit, + limit: limit, #:query => params[:term], - :condition => condition, - :current_user => current_user, - :detail => true, + condition: condition, + current_user: current_user, + detail: true, ) user_tickets_open_ids = assets_of_tickets(user_tickets_open, assets) @@ -387,11 +387,11 @@ class TicketsController < ApplicationController 'tickets.customer_id' => user.id, } user_tickets_closed = Ticket.search( - :limit => limit, + limit: limit, #:query => params[:term], - :condition => condition, - :current_user => current_user, - :detail => true, + condition: condition, + current_user: current_user, + detail: true, ) user_tickets_closed_ids = assets_of_tickets(user_tickets_closed, assets) @@ -418,11 +418,11 @@ class TicketsController < ApplicationController count data = { - :month => date_to_check.month, - :year => date_to_check.year, - :text => Date::MONTHNAMES[date_to_check.month], - :created => created, - :closed => closed, + month: date_to_check.month, + year: date_to_check.year, + text: Date::MONTHNAMES[date_to_check.month], + created: created, + closed: closed, } user_ticket_volume_by_year.push data } @@ -440,11 +440,11 @@ class TicketsController < ApplicationController 'tickets.organization_id' => params[:organization_id], } org_tickets_open = Ticket.search( - :limit => limit, + limit: limit, #:query => params[:term], - :condition => condition, - :current_user => current_user, - :detail => true, + condition: condition, + current_user: current_user, + detail: true, ) org_tickets_open_ids = assets_of_tickets(org_tickets_open, assets) @@ -454,11 +454,11 @@ class TicketsController < ApplicationController 'tickets.organization_id' => params[:organization_id], } org_tickets_closed = Ticket.search( - :limit => limit, + limit: limit, #:query => params[:term], - :condition => condition, - :current_user => current_user, - :detail => true, + condition: condition, + current_user: current_user, + detail: true, ) org_tickets_closed_ids = assets_of_tickets(org_tickets_closed, assets) @@ -479,25 +479,25 @@ class TicketsController < ApplicationController closed = Ticket.where('close_time > ? AND close_time < ?', date_start, date_end ).where(condition).count data = { - :month => date_to_check.month, - :year => date_to_check.year, - :text => Date::MONTHNAMES[date_to_check.month], - :created => created, - :closed => closed, + month: date_to_check.month, + year: date_to_check.year, + text: Date::MONTHNAMES[date_to_check.month], + created: created, + closed: closed, } org_ticket_volume_by_year.push data } end # return result - render :json => { - :user_tickets_open_ids => user_tickets_open_ids, - :user_tickets_closed_ids => user_tickets_closed_ids, - :org_tickets_open_ids => org_tickets_open_ids, - :org_tickets_closed_ids => org_tickets_closed_ids, - :user_ticket_volume_by_year => user_ticket_volume_by_year, - :org_ticket_volume_by_year => org_ticket_volume_by_year, - :assets => assets, + render json: { + user_tickets_open_ids: user_tickets_open_ids, + user_tickets_closed_ids: user_tickets_closed_ids, + org_tickets_open_ids: org_tickets_open_ids, + org_tickets_closed_ids: org_tickets_closed_ids, + user_ticket_volume_by_year: user_ticket_volume_by_year, + org_ticket_volume_by_year: org_ticket_volume_by_year, + assets: assets, } end @@ -523,20 +523,20 @@ class TicketsController < ApplicationController # find attachments in upload cache if form_id article.attachments = Store.list( - :object => 'UploadCache', - :o_id => form_id, + object: 'UploadCache', + o_id: form_id, ) end if !article.save - render :json => article.errors, :status => :unprocessable_entity + render json: article.errors, status: :unprocessable_entity return end # remove attachments from upload cache if form_id Store.remove( - :object => 'UploadCache', - :o_id => form_id, + object: 'UploadCache', + o_id: form_id, ) end end diff --git a/app/controllers/translations_controller.rb b/app/controllers/translations_controller.rb index 7dba296f3..b8cbe7807 100644 --- a/app/controllers/translations_controller.rb +++ b/app/controllers/translations_controller.rb @@ -1,17 +1,17 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class TranslationsController < ApplicationController - before_filter :authentication_check, :except => [:load] + before_filter :authentication_check, except: [:load] # GET /translations/lang/:locale def load - render :json => Translation.list( params[:locale] ) + render json: Translation.list( params[:locale] ) end # GET /translations/admin/lang/:locale def admin return if deny_if_not_role(Z_ROLENAME_ADMIN) - render :json => Translation.list( params[:locale], true ) + render json: Translation.list( params[:locale], true ) end # GET /translations diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e840158fd..061d7c78d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class UsersController < ApplicationController - before_filter :authentication_check, :except => [:create, :password_reset_send, :password_reset_verify] + before_filter :authentication_check, except: [:create, :password_reset_send, :password_reset_verify] # @path [GET] /users # @@ -16,15 +16,15 @@ class UsersController < ApplicationController # only allow customer to fetch him self if is_role(Z_ROLENAME_CUSTOMER) && !is_role(Z_ROLENAME_ADMIN) && !is_role('Agent') - users = User.where( :id => current_user.id ) + users = User.where( id: current_user.id ) else users = User.all end users_all = [] users.each {|user| - users_all.push User.lookup( :id => user.id ).attributes_with_associations + users_all.push User.lookup( id: user.id ).attributes_with_associations } - render :json => users_all, :status => :ok + render json: users_all, status: :ok end # @path [GET] /users/{id} @@ -46,12 +46,12 @@ class UsersController < ApplicationController if params[:full] full = User.full( params[:id] ) - render :json => full + render json: full return end user = User.find( params[:id] ) - render :json => user + render json: user end # @path [POST] /users @@ -77,7 +77,7 @@ class UsersController < ApplicationController # check if feature is enabled if !Setting.get('user_create_account') - render :json => { :error => 'Feature not enabled!' }, :status => :unprocessable_entity + render json: { error: 'Feature not enabled!' }, status: :unprocessable_entity return end @@ -85,7 +85,7 @@ class UsersController < ApplicationController group_ids = [] role_ids = [] if count <= 2 - Role.where( :name => [ Z_ROLENAME_ADMIN, 'Agent'] ).each { |role| + Role.where( name: [ Z_ROLENAME_ADMIN, 'Agent'] ).each { |role| role_ids.push role.id } Group.all().each { |group| @@ -94,7 +94,7 @@ class UsersController < ApplicationController # everybody else will go as customer per default else - role_ids.push Role.where( :name => Z_ROLENAME_CUSTOMER ).first.id + role_ids.push Role.where( name: Z_ROLENAME_CUSTOMER ).first.id end user.role_ids = role_ids user.group_ids = group_ids @@ -115,9 +115,9 @@ class UsersController < ApplicationController # check if user already exists if user.email - exists = User.where( :email => user.email ).first + exists = User.where( email: user.email ).first if exists - render :json => { :error => 'User already exists!' }, :status => :unprocessable_entity + render json: { error: 'User already exists!' }, status: :unprocessable_entity return end end @@ -133,7 +133,7 @@ class UsersController < ApplicationController if params[:invite] && current_user # generate token - token = Token.create( :action => 'PasswordReset', :user_id => user.id ) + token = Token.create( action: 'PasswordReset', user_id: user.id ) # send mail data = {} @@ -156,28 +156,28 @@ class UsersController < ApplicationController # prepare subject & body [:subject, :body].each { |key| data[key.to_sym] = NotificationFactory.build( - :locale => user.preferences[:locale], - :string => data[key.to_sym], - :objects => { - :token => token, - :user => user, - :current_user => current_user, + locale: user.preferences[:locale], + string: data[key.to_sym], + objects: { + token: token, + user: user, + current_user: current_user, } ) } # send notification NotificationFactory.send( - :recipient => user, - :subject => data[:subject], - :body => data[:body] + recipient: user, + subject: data[:subject], + body: data[:body] ) end user_new = User.find( user.id ) - render :json => user_new, :status => :created + render json: user_new, status: :created rescue Exception => e - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end @@ -219,9 +219,9 @@ class UsersController < ApplicationController # get new data user_new = User.find( params[:id] ) - render :json => user_new, :status => :ok + render json: user_new, status: :ok rescue Exception => e - render :json => { :error => e.message }, :status => :unprocessable_entity + render json: { error: e.message }, status: :unprocessable_entity end end @@ -266,9 +266,9 @@ class UsersController < ApplicationController end query_params = { - :query => params[:term], - :limit => params[:limit], - :current_user => current_user, + query: params[:term], + limit: params[:limit], + current_user: current_user, } if params[:role_ids] && !params[:role_ids].empty? query_params[:role_ids] = params[:role_ids] @@ -285,12 +285,12 @@ class UsersController < ApplicationController if user.email && user.email.to_s != '' realname = realname + ' <' + user.email.to_s + '>' end - a = { :id => user.id, :label => realname, :value => realname } + a = { id: user.id, label: realname, value: realname } users.push a } # return result - render :json => users + render json: users return end @@ -302,9 +302,9 @@ class UsersController < ApplicationController } # return result - render :json => { - :assets => assets, - :user_ids => user_ids.uniq, + render json: { + assets: assets, + user_ids: user_ids.uniq, } end @@ -336,7 +336,7 @@ class UsersController < ApplicationController history = user.history_get(true) # return result - render :json => history + render json: history end =begin @@ -363,7 +363,7 @@ curl http://localhost/api/v1/users/password_reset.json -v -u #{login}:#{password # check if feature is enabled if !Setting.get('user_lost_password') - render :json => { :error => 'Feature not enabled!' }, :status => :unprocessable_entity + render json: { error: 'Feature not enabled!' }, status: :unprocessable_entity return end @@ -372,17 +372,17 @@ curl http://localhost/api/v1/users/password_reset.json -v -u #{login}:#{password # only if system is in develop mode, send token back to browser for browser tests if Setting.get('developer_mode') == true - render :json => { :message => 'ok', :token => token.name }, :status => :ok + render json: { message: 'ok', token: token.name }, status: :ok return end # token sent to user, send ok to browser - render :json => { :message => 'ok' }, :status => :ok + render json: { message: 'ok' }, status: :ok return end # unable to generate token - render :json => { :message => 'failed' }, :status => :ok + render json: { message: 'failed' }, status: :ok end =begin @@ -412,7 +412,7 @@ curl http://localhost/api/v1/users/password_reset_verify.json -v -u #{login}:#{p # check password policy result = password_policy(params[:password]) if result != true - render :json => { :message => 'failed', :notice => result }, :status => :ok + render json: { message: 'failed', notice: result }, status: :ok return end @@ -422,9 +422,9 @@ curl http://localhost/api/v1/users/password_reset_verify.json -v -u #{login}:#{p user = User.password_reset_check( params[:token] ) end if user - render :json => { :message => 'ok', :user_login => user.login }, :status => :ok + render json: { message: 'ok', user_login: user.login }, status: :ok else - render :json => { :message => 'failed' }, :status => :ok + render json: { message: 'failed' }, status: :ok end end @@ -453,30 +453,30 @@ curl http://localhost/api/v1/users/password_change.json -v -u #{login}:#{passwor # check old password if !params[:password_old] - render :json => { :message => 'failed', :notice => ['Current password needed!'] }, :status => :ok + render json: { message: 'failed', notice: ['Current password needed!'] }, status: :ok return end user = User.authenticate( current_user.login, params[:password_old] ) if !user - render :json => { :message => 'failed', :notice => ['Current password is wrong!'] }, :status => :ok + render json: { message: 'failed', notice: ['Current password is wrong!'] }, status: :ok return end # set new password if !params[:password_new] - render :json => { :message => 'failed', :notice => ['Please supply your new password!'] }, :status => :ok + render json: { message: 'failed', notice: ['Please supply your new password!'] }, status: :ok return end # check password policy result = password_policy(params[:password_new]) if result != true - render :json => { :message => 'failed', :notice => result }, :status => :ok + render json: { message: 'failed', notice: result }, status: :ok return end - user.update_attributes( :password => params[:password_new] ) - render :json => { :message => 'ok', :user_login => user.login }, :status => :ok + user.update_attributes( password: params[:password_new] ) + render json: { message: 'ok', user_login: user.login }, status: :ok end =begin @@ -502,7 +502,7 @@ curl http://localhost/api/v1/users/preferences.json -v -u #{login}:#{password} - def preferences if !current_user - render :json => { :message => 'No current user!' }, :status => :unprocessable_entity + render json: { message: 'No current user!' }, status: :unprocessable_entity return end if params[:user] @@ -511,7 +511,7 @@ curl http://localhost/api/v1/users/preferences.json -v -u #{login}:#{password} - } current_user.save end - render :json => { :message => 'ok' }, :status => :ok + render json: { message: 'ok' }, status: :ok end =begin @@ -537,32 +537,32 @@ curl http://localhost/api/v1/users/account.json -v -u #{login}:#{password} -H "C def account_remove if !current_user - render :json => { :message => 'No current user!' }, :status => :unprocessable_entity + render json: { message: 'No current user!' }, status: :unprocessable_entity return end # provider + uid to remove if !params[:provider] - render :json => { :message => 'provider needed!' }, :status => :unprocessable_entity + render json: { message: 'provider needed!' }, status: :unprocessable_entity return end if !params[:uid] - render :json => { :message => 'uid needed!' }, :status => :unprocessable_entity + render json: { message: 'uid needed!' }, status: :unprocessable_entity return end # remove from database record = Authorization.where( - :user_id => current_user.id, - :provider => params[:provider], - :uid => params[:uid], + user_id: current_user.id, + provider: params[:provider], + uid: params[:uid], ) if !record.first - render :json => { :message => 'No record found!' }, :status => :unprocessable_entity + render json: { message: 'No record found!' }, status: :unprocessable_entity return end record.destroy_all - render :json => { :message => 'ok' }, :status => :ok + render json: { message: 'ok' }, status: :ok end =begin @@ -589,9 +589,9 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u if file send_data( file.content, - :filename => file.filename, - :type => file.preferences['Content-Type'] || file.preferences['Mime-Type'], - :disposition => 'inline' + filename: file.filename, + type: file.preferences['Content-Type'] || file.preferences['Mime-Type'], + disposition: 'inline' ) return end @@ -600,9 +600,9 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u image = 'R0lGODdhMAAwAOMAAMzMzJaWlr6+vqqqqqOjo8XFxbe3t7GxsZycnAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAMAAwAAAEcxDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru98TwuAA+KQAQqJK8EAgBAgMEqmkzUgBIeSwWGZtR5XhSqAULACCoGCJGwlm1MGQrq9RqgB8fm4ZTUgDBIEcRR9fz6HiImKi4yNjo+QkZKTlJWWkBEAOw==' send_data( Base64.decode64(image), - :filename => 'image.gif', - :type => 'image/gif', - :disposition => 'inline' + filename: 'image.gif', + type: 'image/gif', + disposition: 'inline' ) end @@ -634,24 +634,24 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content file_resize = StaticAssets.data_url_attributes( params[:avatar_resize] ) avatar = Avatar.add( - :object => 'User', - :o_id => current_user.id, - :full => { - :content => file_full[:content], - :mime_type => file_full[:mime_type], + object: 'User', + o_id: current_user.id, + full: { + content: file_full[:content], + mime_type: file_full[:mime_type], }, - :resize => { - :content => file_resize[:content], - :mime_type => file_resize[:mime_type], + resize: { + content: file_resize[:content], + mime_type: file_resize[:mime_type], }, - :source => 'upload ' + Time.now.to_s, - :deletable => true, + source: 'upload ' + Time.now.to_s, + deletable: true, ) # update user link - current_user.update_attributes( :image => avatar.store_hash ) + current_user.update_attributes( image: avatar.store_hash ) - render :json => { :avatar => avatar }, :status => :ok + render json: { avatar: avatar }, status: :ok end def avatar_set_default @@ -659,7 +659,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content # get & validate image if !params[:id] - render :json => { :message => 'No id of avatar!' }, :status => :unprocessable_entity + render json: { message: 'No id of avatar!' }, status: :unprocessable_entity return end @@ -667,9 +667,9 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content avatar = Avatar.set_default( 'User', current_user.id, params[:id] ) # update user link - current_user.update_attributes( :image => avatar.store_hash ) + current_user.update_attributes( image: avatar.store_hash ) - render :json => {}, :status => :ok + render json: {}, status: :ok end def avatar_destroy @@ -677,7 +677,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content # get & validate image if !params[:id] - render :json => { :message => 'No id of avatar!' }, :status => :unprocessable_entity + render json: { message: 'No id of avatar!' }, status: :unprocessable_entity return end @@ -686,9 +686,9 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content # update user link avatar = Avatar.get_default( 'User', current_user.id ) - current_user.update_attributes( :image => avatar.store_hash ) + current_user.update_attributes( image: avatar.store_hash ) - render :json => {}, :status => :ok + render json: {}, status: :ok end def avatar_list @@ -696,7 +696,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content # list of avatars result = Avatar.list( 'User', current_user.id ) - render :json => { :avatars => result }, :status => :ok + render json: { avatars: result }, status: :ok end private diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb index 94a22c662..25cd4e956 100644 --- a/app/models/activity_stream.rb +++ b/app/models/activity_stream.rb @@ -2,8 +2,8 @@ class ActivityStream < ApplicationModel self.table_name = 'activity_streams' - belongs_to :activity_stream_type, :class_name => 'TypeLookup' - belongs_to :activity_stream_object, :class_name => 'ObjectLookup' + belongs_to :activity_stream_type, class_name: 'TypeLookup' + belongs_to :activity_stream_object, class_name: 'ObjectLookup' =begin @@ -32,7 +32,7 @@ add a new activity entry for an object role_id = nil if data[:role] - role = Role.lookup( :name => data[:role] ) + role = Role.lookup( name: data[:role] ) if !role raise "No such Role #{data[:role]}" end @@ -41,11 +41,11 @@ add a new activity entry for an object # check newest entry - is needed result = ActivityStream.where( - :o_id => data[:o_id], + o_id: data[:o_id], #:activity_stream_type_id => type_id, - :role_id => role_id, - :activity_stream_object_id => object_id, - :created_by_id => data[:created_by_id] + role_id: role_id, + activity_stream_object_id: object_id, + created_by_id: data[:created_by_id] ).order('created_at DESC, id DESC').first # resturn if old entry is really fresh @@ -53,13 +53,13 @@ add a new activity entry for an object # create history record = { - :o_id => data[:o_id], - :activity_stream_type_id => type_id, - :activity_stream_object_id => object_id, - :role_id => role_id, - :group_id => data[:group_id], - :created_at => data[:created_at], - :created_by_id => data[:created_by_id] + o_id: data[:o_id], + activity_stream_type_id: type_id, + activity_stream_object_id: object_id, + role_id: role_id, + group_id: data[:group_id], + created_at: data[:created_at], + created_by_id: data[:created_by_id] } ActivityStream.create(record) @@ -76,8 +76,8 @@ remove whole activity entries of an object def self.remove( object_name, o_id ) object_id = ObjectLookup.by_name( object_name ) ActivityStream.where( - :activity_stream_object_id => object_id, - :o_id => o_id, + activity_stream_object_id: object_id, + o_id: o_id, ).destroy_all end @@ -94,7 +94,7 @@ return all activity entries of an user group_ids = user.group_ids # do not return an activity stream for custoers - customer_role = Role.lookup( :name => 'Customer' ) + customer_role = Role.lookup( name: 'Customer' ) return [] if role_ids.include?(customer_role.id) if group_ids.empty? diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 0695b89b4..7db50cb62 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -316,14 +316,14 @@ returns return cache if cache # puts "Fillup- + #{self.to_s}.#{data[:id].to_s}" - record = self.where( :id => data[:id] ).first + record = self.where( id: data[:id] ).first self.cache_set( data[:id], record ) return record elsif data[:name] cache = self.cache_get( data[:name] ) return cache if cache - records = self.where( :name => data[:name] ) + records = self.where( name: data[:name] ) records.each {|record| if record.name == data[:name] self.cache_set( data[:name], record ) @@ -335,7 +335,7 @@ returns cache = self.cache_get( data[:login] ) return cache if cache - records = self.where( :login => data[:login] ) + records = self.where( login: data[:login] ) records.each {|record| if record.login == data[:login] self.cache_set( data[:login], record ) @@ -362,20 +362,20 @@ returns def self.create_if_not_exists(data) if data[:id] - record = self.where( :id => data[:id] ).first + record = self.where( id: data[:id] ).first return record if record elsif data[:name] - records = self.where( :name => data[:name] ) + records = self.where( name: data[:name] ) records.each {|record| return record if record.name == data[:name] } elsif data[:login] - records = self.where( :login => data[:login] ) + records = self.where( login: data[:login] ) records.each {|record| return record if record.login == data[:login] } elsif data[:locale] && data[:source] - records = self.where( :locale => data[:locale], :source => data[:source] ) + records = self.where( locale: data[:locale], source: data[:source] ) records.each {|record| return record if record.source == data[:source] } @@ -397,7 +397,7 @@ returns def self.create_or_update(data) if data[:id] - records = self.where( :id => data[:id] ) + records = self.where( id: data[:id] ) records.each {|record| record.update_attributes( data ) return record @@ -406,7 +406,7 @@ returns record.save return record elsif data[:name] - records = self.where( :name => data[:name] ) + records = self.where( name: data[:name] ) records.each {|record| if record.name == data[:name] record.update_attributes( data ) @@ -417,7 +417,7 @@ returns record.save return record elsif data[:login] - records = self.where( :login => data[:login] ) + records = self.where( login: data[:login] ) records.each {|record| if record.login.downcase == data[:login].downcase record.update_attributes( data ) @@ -428,7 +428,7 @@ returns record.save return record elsif data[:locale] - records = self.where( :locale => data[:locale] ) + records = self.where( locale: data[:locale] ) records.each {|record| if record.locale.downcase == data[:locale].downcase record.update_attributes( data ) @@ -474,7 +474,7 @@ end if updated_at == nil Cache.delete( key ) else - Cache.write( key, updated_at, { :expires_in => expires_in } ) + Cache.write( key, updated_at, { expires_in: expires_in } ) end end @@ -547,8 +547,8 @@ class OwnModel < ApplicationModel class_name = self.class.name class_name.gsub!(/::/, '') Sessions.broadcast( - :event => class_name + ':create', - :data => { :id => self.id, :updated_at => self.updated_at } + event: class_name + ':create', + data: { id: self.id, updated_at: self.updated_at } ) end @@ -576,8 +576,8 @@ class OwnModel < ApplicationModel class_name = self.class.name class_name.gsub!(/::/, '') Sessions.broadcast( - :event => class_name + ':update', - :data => { :id => self.id, :updated_at => self.updated_at } + event: class_name + ':update', + data: { id: self.id, updated_at: self.updated_at } ) end @@ -633,8 +633,8 @@ class OwnModel < ApplicationModel class_name = self.class.name class_name.gsub!(/::/, '') Sessions.broadcast( - :event => class_name + ':destroy', - :data => { :id => self.id, :updated_at => self.updated_at } + event: class_name + ':destroy', + data: { id: self.id, updated_at: self.updated_at } ) end @@ -749,10 +749,10 @@ log object update activity stream, if configured - will be executed automaticall # default ignored attributes ignore_attributes = { - :created_at => true, - :updated_at => true, - :created_by_id => true, - :updated_by_id => true, + created_at: true, + updated_at: true, + created_by_id: true, + updated_by_id: true, } if self.class.activity_stream_support_config[:ignore_attributes] self.class.activity_stream_support_config[:ignore_attributes].each {|key, value| @@ -856,10 +856,10 @@ log object update history with all updated attributes, if configured - will be e # default ignored attributes ignore_attributes = { - :created_at => true, - :updated_at => true, - :created_by_id => true, - :updated_by_id => true, + created_at: true, + updated_at: true, + created_by_id: true, + updated_by_id: true, } if self.class.history_support_config[:ignore_attributes] self.class.history_support_config[:ignore_attributes].each {|key, value| @@ -887,7 +887,7 @@ log object update history with all updated attributes, if configured - will be e if self.respond_to?( attribute_name ) && self.send(attribute_name) relation_class = self.send(attribute_name).class if relation_class && value_id[0] - relation_model = relation_class.lookup( :id => value_id[0] ) + relation_model = relation_class.lookup( id: value_id[0] ) if relation_model if relation_model['name'] value_str[0] = relation_model['name'] @@ -897,7 +897,7 @@ log object update history with all updated attributes, if configured - will be e end end if relation_class && value_id[1] - relation_model = relation_class.lookup( :id => value_id[1] ) + relation_model = relation_class.lookup( id: value_id[1] ) if relation_model if relation_model['name'] value_str[1] = relation_model['name'] @@ -909,11 +909,11 @@ log object update history with all updated attributes, if configured - will be e end end data = { - :history_attribute => attribute_name, - :value_from => value_str[0].to_s, - :value_to => value_str[1].to_s, - :id_from => value_id[0], - :id_to => value_id[1], + history_attribute: attribute_name, + value_from: value_str[0].to_s, + value_to: value_str[1].to_s, + id_from: value_id[0], + id_to: value_id[1], } #puts "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}" self.history_log( 'updated', self.updated_by_id, data ) @@ -948,7 +948,7 @@ returns =end def attachments - Store.list( :object => self.class.to_s, :o_id => self.id ) + Store.list( object: self.class.to_s, o_id: self.id ) end =begin @@ -985,8 +985,8 @@ return object and assets object = self.find(id) assets = object.assets({}) { - :id => id, - :assets => assets, + id: id, + assets: assets, } end @@ -1044,12 +1044,12 @@ get assets of object list article_store = [] attachments_buffer.each do |attachment| article_store.push Store.add( - :object => self.class.to_s, - :o_id => self.id, - :data => attachment.content, - :filename => attachment.filename, - :preferences => attachment.preferences, - :created_by_id => self.created_by_id, + object: self.class.to_s, + o_id: self.id, + data: attachment.content, + filename: attachment.filename, + preferences: attachment.preferences, + created_by_id: self.created_by_id, ) end attachments_buffer = nil diff --git a/app/models/application_model/activity_stream_base.rb b/app/models/application_model/activity_stream_base.rb index 1f0317712..3329d51b3 100644 --- a/app/models/application_model/activity_stream_base.rb +++ b/app/models/application_model/activity_stream_base.rb @@ -32,13 +32,13 @@ returns updated_at = Time.new end ActivityStream.add( - :o_id => self['id'], - :type => type, - :object => self.class.name, - :group_id => self['group_id'], - :role => role, - :created_at => updated_at, - :created_by_id => user_id, + o_id: self['id'], + type: type, + object: self.class.name, + group_id: self['group_id'], + role: role, + created_at: updated_at, + created_by_id: user_id, ) end diff --git a/app/models/application_model/assets.rb b/app/models/application_model/assets.rb index 4fa7f1b1c..d6ba96151 100644 --- a/app/models/application_model/assets.rb +++ b/app/models/application_model/assets.rb @@ -33,7 +33,7 @@ returns ['created_by_id', 'updated_by_id'].each {|item| if self[ item ] if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ] - user = User.lookup( :id => self[ item ] ) + user = User.lookup( id: self[ item ] ) data = user.assets( data ) end end diff --git a/app/models/application_model/history_log_base.rb b/app/models/application_model/history_log_base.rb index 3a7a4fbbc..2077f6a18 100644 --- a/app/models/application_model/history_log_base.rb +++ b/app/models/application_model/history_log_base.rb @@ -92,8 +92,8 @@ returns end } return { - :history => history[:list], - :assets => history[:assets], + history: history[:list], + assets: history[:assets], } end diff --git a/app/models/application_model/search_index_base.rb b/app/models/application_model/search_index_base.rb index c357cd9c4..dfc7854f6 100644 --- a/app/models/application_model/search_index_base.rb +++ b/app/models/application_model/search_index_base.rb @@ -20,9 +20,9 @@ returns # default ignored attributes ignore_attributes = { - :created_by_id => true, - :updated_by_id => true, - :active => true, + created_by_id: true, + updated_by_id: true, + active: true, } if self.class.search_index_support_config[:ignore_attributes] self.class.search_index_support_config[:ignore_attributes].each {|key, value| @@ -123,7 +123,7 @@ returns next if !relation_class # lookup ref object - relation_model = relation_class.lookup( :id => value ) + relation_model = relation_class.lookup( id: value ) next if !relation_model # get name of ref object diff --git a/app/models/authorization.rb b/app/models/authorization.rb index 659a30149..b7c70f4b1 100644 --- a/app/models/authorization.rb +++ b/app/models/authorization.rb @@ -6,22 +6,22 @@ class Authorization < ApplicationModel after_update :delete_user_cache after_destroy :delete_user_cache validates_presence_of :user_id, :uid, :provider - validates_uniqueness_of :uid, :scope => :provider + validates_uniqueness_of :uid, scope: :provider def self.find_from_hash(hash) - auth = Authorization.where( :provider => hash['provider'], :uid => hash['uid'] ).first + auth = Authorization.where( provider: hash['provider'], uid: hash['uid'] ).first if auth # update auth tokens auth.update_attributes( - :token => hash['credentials']['token'], - :secret => hash['credentials']['secret'] + token: hash['credentials']['token'], + secret: hash['credentials']['secret'] ) # update username of auth entry if empty if !auth.username && hash['info']['nickname'] auth.update_attributes( - :username => hash['info']['nickname'], + username: hash['info']['nickname'], ) end @@ -31,13 +31,13 @@ class Authorization < ApplicationModel # save/update avatar avatar = Avatar.add( - :object => 'User', - :o_id => user.id, - :url => hash['info']['image'], - :source => hash['provider'], - :deletable => true, - :updated_by_id => user.id, - :created_by_id => user.id, + object: 'User', + o_id: user.id, + url: hash['info']['image'], + source: hash['provider'], + deletable: true, + updated_by_id: user.id, + created_by_id: user.id, ) # update user link @@ -54,13 +54,13 @@ class Authorization < ApplicationModel # save/update avatar avatar = Avatar.add( - :object => 'User', - :o_id => user.id, - :url => hash['info']['image'], - :source => hash['provider'], - :deletable => true, - :updated_by_id => user.id, - :created_by_id => user.id, + object: 'User', + o_id: user.id, + url: hash['info']['image'], + source: hash['provider'], + deletable: true, + updated_by_id: user.id, + created_by_id: user.id, ) # update user link @@ -76,12 +76,12 @@ class Authorization < ApplicationModel end Authorization.create( - :user => user, - :uid => hash['uid'], - :username => hash['info']['nickname'] || hash['username'], - :provider => hash['provider'], - :token => hash['credentials']['token'], - :secret => hash['credentials']['secret'] + user: user, + uid: hash['uid'], + username: hash['info']['nickname'] || hash['username'], + provider: hash['provider'], + token: hash['credentials']['token'], + secret: hash['credentials']['secret'] ) end diff --git a/app/models/avatar.rb b/app/models/avatar.rb index da6ea4a6a..8ba6f6300 100644 --- a/app/models/avatar.rb +++ b/app/models/avatar.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Avatar < ApplicationModel - belongs_to :object_lookup, :class_name => 'ObjectLookup' + belongs_to :object_lookup, class_name: 'ObjectLookup' =begin @@ -31,13 +31,13 @@ add an avatar based on auto detection (email address) puts "#{data[:url]}: #{url}" Avatar.add( - :object => data[:object], - :o_id => data[:o_id], - :url => url, - :source => 'gravatar.com', - :deletable => false, - :updated_by_id => 1, - :created_by_id => 1, + object: data[:object], + o_id: data[:o_id], + url: url, + source: 'gravatar.com', + deletable: false, + updated_by_id: 1, + created_by_id: 1, ) end @@ -75,24 +75,24 @@ add a avatar add_init_avatar(object_id, data[:o_id]) record = { - :o_id => data[:o_id], - :object_lookup_id => object_id, - :default => true, - :deletable => data[:deletable], - :initial => false, - :source => data[:source], - :source_url => data[:url], - :updated_by_id => data[:updated_by_id], - :created_by_id => data[:created_by_id], + o_id: data[:o_id], + object_lookup_id: object_id, + default: true, + deletable: data[:deletable], + initial: false, + source: data[:source], + source_url: data[:url], + updated_by_id: data[:updated_by_id], + created_by_id: data[:created_by_id], } # check if avatar with url already exists avatar_already_exists = nil if data[:source] && !data[:source].empty? avatar_already_exists = Avatar.where( - :object_lookup_id => object_id, - :o_id => data[:o_id], - :source => data[:source], + object_lookup_id: object_id, + o_id: data[:o_id], + source: data[:source], ).first end @@ -119,8 +119,8 @@ add a avatar data[:url], {}, { - :open_timeout => 4, - :read_timeout => 6, + open_timeout: 4, + read_timeout: 6, }, ) if !response.success? @@ -159,28 +159,28 @@ add a avatar object_name = "Avatar::#{data[:object]}" if data[:full] store_full = Store.add( - :object => "#{object_name}::Full", - :o_id => data[:o_id], - :data => data[:full][:content], - :filename => 'avatar_full', - :preferences => { + object: "#{object_name}::Full", + o_id: data[:o_id], + data: data[:full][:content], + filename: 'avatar_full', + preferences: { 'Mime-Type' => data[:full][:mime_type] }, - :created_by_id => data[:created_by_id], + created_by_id: data[:created_by_id], ) record[:store_full_id] = store_full.id record[:store_hash] = Digest::MD5.hexdigest( data[:full][:content] ) end if data[:resize] store_resize = Store.add( - :object => "#{object_name}::Resize", - :o_id => data[:o_id], - :data => data[:resize][:content], - :filename => 'avatar', - :preferences => { + object: "#{object_name}::Resize", + o_id: data[:o_id], + data: data[:resize][:content], + filename: 'avatar', + preferences: { 'Mime-Type' => data[:resize][:mime_type] }, - :created_by_id => data[:created_by_id], + created_by_id: data[:created_by_id], ) record[:store_resize_id] = store_resize.id record[:store_hash] = Digest::MD5.hexdigest( data[:resize][:content] ) @@ -211,9 +211,9 @@ set avatars as default def self.set_default( object_name, o_id, avatar_id ) object_id = ObjectLookup.by_name( object_name ) avatar = Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, - :id => avatar_id, + object_lookup_id: object_id, + o_id: o_id, + id: avatar_id, ).first avatar.default = true avatar.save! @@ -235,18 +235,18 @@ remove all avatars of an object def self.remove( object_name, o_id ) object_id = ObjectLookup.by_name( object_name ) Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ).destroy_all object_name_store = "Avatar::#{object_name}" Store.remove( - :object => "#{object_name_store}::Full", - :o_id => o_id, + object: "#{object_name_store}::Full", + o_id: o_id, ) Store.remove( - :object => "#{object_name_store}::Resize", - :o_id => o_id, + object: "#{object_name_store}::Resize", + o_id: o_id, ) end @@ -261,9 +261,9 @@ remove one avatars of an object def self.remove_one( object_name, o_id, avatar_id ) object_id = ObjectLookup.by_name( object_name ) Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, - :id => avatar_id, + object_lookup_id: object_id, + o_id: o_id, + id: avatar_id, ).destroy_all end @@ -278,8 +278,8 @@ return all avatars of an user def self.list(object_name, o_id) object_id = ObjectLookup.by_name( object_name ) avatars = Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ).order( 'initial DESC, deletable ASC, created_at ASC, id DESC' ) # add initial avatar @@ -311,7 +311,7 @@ returns: def self.get_by_hash(hash) avatar = Avatar.where( - :store_hash => hash, + store_hash: hash, ).first return if !avatar file = Store.find(avatar.store_resize_id) @@ -332,9 +332,9 @@ returns: def self.get_default(object_name, o_id) object_id = ObjectLookup.by_name( object_name ) Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, - :default => true, + object_lookup_id: object_id, + o_id: o_id, + default: true, ).first end @@ -342,8 +342,8 @@ returns: def self.set_default_items(object_id, o_id, avatar_id) avatars = Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ).order( 'created_at ASC, id DESC' ) avatars.each do |avatar| next if avatar.id == avatar_id @@ -355,20 +355,20 @@ returns: def self.add_init_avatar(object_id, o_id) count = Avatar.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ).count return if count > 0 Avatar.create( - :o_id => o_id, - :object_lookup_id => object_id, - :default => true, - :source => 'init', - :initial => true, - :deletable => false, - :updated_by_id => 1, - :created_by_id => 1, + o_id: o_id, + object_lookup_id: object_id, + default: true, + source: 'init', + initial: true, + deletable: false, + updated_by_id: 1, + created_by_id: 1, ) end end \ No newline at end of file diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 6ee4d30b2..7e197f93a 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -130,7 +130,7 @@ class Channel::EmailParser data[:body] = Encode.conv( mail.text_part.charset, data[:body] ) if !data[:body].valid_encoding? - data[:body] = data[:body].encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?') + data[:body] = data[:body].encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '?') end # html attachment/body may exists and will be converted to text @@ -143,7 +143,7 @@ class Channel::EmailParser data[:body] = data[:body].html2text.to_s.force_encoding('utf-8') if !data[:body].force_encoding('UTF-8').valid_encoding? - data[:body] = data[:body].encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?') + data[:body] = data[:body].encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '?') end # any other attachments @@ -165,9 +165,9 @@ class Channel::EmailParser headers_store['Charset'] = mail.html_part.charset end attachment = { - :data => mail.html_part.body.to_s, - :filename => mail.html_part.filename || filename, - :preferences => headers_store + data: mail.html_part.body.to_s, + filename: mail.html_part.filename || filename, + preferences: headers_store } data[:attachments].push attachment end @@ -196,7 +196,7 @@ class Channel::EmailParser data[:body] = Encode.conv( mail.charset, data[:body] ) if !data[:body].force_encoding('UTF-8').valid_encoding? - data[:body] = data[:body].encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?') + data[:body] = data[:body].encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '?') end # html part only, convert ot text and add it as attachment @@ -209,7 +209,7 @@ class Channel::EmailParser data[:body] = data[:body].html2text.to_s.force_encoding('utf-8') if !data[:body].valid_encoding? - data[:body] = data[:body].encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?') + data[:body] = data[:body].encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '?') end # any other attachments @@ -228,9 +228,9 @@ class Channel::EmailParser headers_store['Charset'] = mail.charset end attachment = { - :data => mail.body.decoded, - :filename => mail.filename || filename, - :preferences => headers_store + data: mail.body.decoded, + filename: mail.filename || filename, + preferences: headers_store } data[:attachments].push attachment end @@ -316,9 +316,9 @@ class Channel::EmailParser headers_store.delete('Content-Disposition') attach = { - :data => file.body.to_s, - :filename => filename, - :preferences => headers_store, + data: file.body.to_s, + filename: filename, + preferences: headers_store, } [attach] end @@ -358,18 +358,18 @@ class Channel::EmailParser # create sender if mail[ 'x-zammad-customer-login'.to_sym ] - user = User.where( :login => mail[ 'x-zammad-customer-login'.to_sym ] ).first + user = User.where( login: mail[ 'x-zammad-customer-login'.to_sym ] ).first end if !user - user = User.where( :email => mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email] ).first + user = User.where( email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email] ).first end if !user puts 'create user...' user = user_create( - :login => mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], - :firstname => mail[ 'x-zammad-customer-firstname'.to_sym ] || mail[:from_display_name], - :lastname => mail[ 'x-zammad-customer-lastname'.to_sym ], - :email => mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], + login: mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], + firstname: mail[ 'x-zammad-customer-firstname'.to_sym ] || mail[:from_display_name], + lastname: mail[ 'x-zammad-customer-lastname'.to_sym ], + email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], ) end @@ -379,9 +379,9 @@ class Channel::EmailParser items = mail[item.to_sym].tree items.addresses.each {|item| user_create( - :firstname => item.display_name, - :lastname => '', - :email => item.address, + firstname: item.display_name, + lastname: '', + email: item.address, ) } end @@ -404,7 +404,7 @@ class Channel::EmailParser end if state_type.name != 'new' - ticket.state = Ticket::State.where( :name => 'open' ).first + ticket.state = Ticket::State.where( name: 'open' ).first ticket.save end end @@ -414,11 +414,11 @@ class Channel::EmailParser # set attributes ticket = Ticket.new( - :group_id => channel[:group_id] || 1, - :customer_id => user.id, - :title => mail[:subject] || '', - :state_id => Ticket::State.where( :name => 'new' ).first.id, - :priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id, + group_id: channel[:group_id] || 1, + customer_id: user.id, + title: mail[:subject] || '', + state_id: Ticket::State.where( name: 'new' ).first.id, + priority_id: Ticket::Priority.where( name: '2 normal' ).first.id, ) set_attributes_by_x_headers( ticket, 'ticket', mail ) @@ -431,16 +431,16 @@ class Channel::EmailParser # set attributes article = Ticket::Article.new( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where( :name => 'email' ).first.id, - :sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id, - :body => mail[:body], - :from => mail[:from], - :to => mail[:to], - :cc => mail[:cc], - :subject => mail[:subject], - :message_id => mail[:message_id], - :internal => false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where( name: 'email' ).first.id, + sender_id: Ticket::Article::Sender.where( name: 'Customer' ).first.id, + body: mail[:body], + from: mail[:from], + to: mail[:to], + cc: mail[:cc], + subject: mail[:subject], + message_id: mail[:message_id], + internal: false, ) # x-headers lookup @@ -451,22 +451,22 @@ class Channel::EmailParser # store mail plain Store.add( - :object => 'Ticket::Article::Mail', - :o_id => article.id, - :data => msg, - :filename => "ticket-#{ticket.number}-#{article.id}.eml", - :preferences => {} + object: 'Ticket::Article::Mail', + o_id: article.id, + data: msg, + filename: "ticket-#{ticket.number}-#{article.id}.eml", + preferences: {} ) # store attachments if mail[:attachments] mail[:attachments].each do |attachment| Store.add( - :object => 'Ticket::Article', - :o_id => article.id, - :data => attachment[:data], - :filename => attachment[:filename], - :preferences => attachment[:preferences] + object: 'Ticket::Article', + o_id: article.id, + data: attachment[:data], + filename: attachment[:filename], + preferences: attachment[:preferences] ) end end @@ -497,11 +497,11 @@ class Channel::EmailParser def user_create(data) # return existing - user = User.where( :login => data[:email].downcase ).first + user = User.where( login: data[:email].downcase ).first return user if user # create new user - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) # fillup ['firstname', 'lastname'].each { |item| @@ -517,8 +517,8 @@ class Channel::EmailParser user = User.create(data) user.update_attributes( - :updated_by_id => user.id, - :created_by_id => user.id, + updated_by_id: user.id, + created_by_id: user.id, ) user end @@ -547,12 +547,12 @@ class Channel::EmailParser item = assoc.class_name.constantize if item.respond_to?(:name) - if item.lookup( :name => mail[ header.to_sym ] ) - item_object[key] = item.lookup( :name => mail[ header.to_sym ] ).id + if item.lookup( name: mail[ header.to_sym ] ) + item_object[key] = item.lookup( name: mail[ header.to_sym ] ).id end elsif item.respond_to?(:login) - if item.lookup( :login => mail[ header.to_sym ] ) - item_object[key] = item.lookup( :login => mail[ header.to_sym ] ).id + if item.lookup( login: mail[ header.to_sym ] ) + item_object[key] = item.lookup( login: mail[ header.to_sym ] ).id end end end diff --git a/app/models/channel/email_send.rb b/app/models/channel/email_send.rb index 18bfba6b6..e8866a143 100644 --- a/app/models/channel/email_send.rb +++ b/app/models/channel/email_send.rb @@ -4,7 +4,7 @@ require 'net/imap' module Channel::EmailSend def self.send(attr, notification = false) - channel = Channel.where( :area => 'Email::Outbound', :active => true ).first + channel = Channel.where( area: 'Email::Outbound', active: true ).first begin c = eval 'Channel::' + channel[:adapter] + '.new' c.send(attr, channel, notification) diff --git a/app/models/channel/facebook.rb b/app/models/channel/facebook.rb index 476c565c8..746207dc6 100644 --- a/app/models/channel/facebook.rb +++ b/app/models/channel/facebook.rb @@ -25,7 +25,7 @@ class Channel::Facebook 'id', 'comments', { - :message => self.body + message: self.body } ) # client.direct_message_create( diff --git a/app/models/channel/filter/database.rb b/app/models/channel/filter/database.rb index a0ed78e75..8ad26844f 100644 --- a/app/models/channel/filter/database.rb +++ b/app/models/channel/filter/database.rb @@ -6,7 +6,7 @@ module Channel::Filter::Database def self.run( channel, mail ) # process postmaster filter - filters = PostmasterFilter.where( :active => true, :channel => 'email' ) + filters = PostmasterFilter.where( active: true, channel: 'email' ) filters.each {|filter| puts " proccess filter #{filter.name} ..." match = true diff --git a/app/models/channel/smtp.rb b/app/models/channel/smtp.rb index 42e8f6d3b..3667d046b 100644 --- a/app/models/channel/smtp.rb +++ b/app/models/channel/smtp.rb @@ -8,13 +8,13 @@ class Channel::SMTP mail = Channel::EmailBuild.build(attr, notification) mail.delivery_method :smtp, { - :openssl_verify_mode => 'none', - :address => channel[:options][:host], - :port => channel[:options][:port] || 25, - :domain => channel[:options][:host], - :user_name => channel[:options][:user], - :password => channel[:options][:password], - :enable_starttls_auto => true, + openssl_verify_mode: 'none', + address: channel[:options][:host], + port: channel[:options][:port] || 25, + domain: channel[:options][:host], + user_name: channel[:options][:user], + password: channel[:options][:password], + enable_starttls_auto: true, } mail.deliver end diff --git a/app/models/channel/twitter2.rb b/app/models/channel/twitter2.rb index a0db2ec5e..8fa40f12b 100644 --- a/app/models/channel/twitter2.rb +++ b/app/models/channel/twitter2.rb @@ -28,7 +28,7 @@ class Channel::TWITTER2 channel[:options][:search].each { |search| puts " - searching for #{search[:item]}" tweets = [] - @client.search( search[:item], :count => 50, :result_type => 'recent' ).collect do |tweet| + @client.search( search[:item], count: 50, result_type: 'recent' ).collect do |tweet| tweets.push tweet end @article_type = 'twitter status' @@ -74,7 +74,7 @@ class Channel::TWITTER2 all_tweets.each do |tweet| # check if tweet is already imported - article = Ticket::Article.where( :message_id => tweet.id.to_s ).first + article = Ticket::Article.where( message_id: tweet.id.to_s ).first # check if sender already exists next if article @@ -140,34 +140,34 @@ class Channel::TWITTER2 # create sender in db # puts tweet.inspect # user = User.where( :login => tweet.sender.screen_name ).first - auth = Authorization.where( :uid => sender.id, :provider => 'twitter' ).first + auth = Authorization.where( uid: sender.id, provider: 'twitter' ).first user = nil if auth puts 'user_id', auth.user_id - user = User.where( :id => auth.user_id ).first + user = User.where( id: auth.user_id ).first end if !user puts 'create user...' - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) user = User.create( - :login => sender.screen_name, - :firstname => sender.name, - :lastname => '', - :email => '', - :password => '', - :image_source => sender.profile_image_url.to_s, - :note => sender.description, - :active => true, - :roles => roles, - :updated_by_id => 1, - :created_by_id => 1 + login: sender.screen_name, + firstname: sender.name, + lastname: '', + email: '', + password: '', + image_source: sender.profile_image_url.to_s, + note: sender.description, + active: true, + roles: roles, + updated_by_id: 1, + created_by_id: 1 ) puts 'autentication create...' authentication = Authorization.create( - :uid => sender.id, - :username => sender.screen_name, - :user_id => user.id, - :provider => 'twitter' + uid: sender.id, + username: sender.screen_name, + user_id: user.id, + provider: 'twitter' ) else puts 'user exists'#, user.inspect @@ -185,7 +185,7 @@ class Channel::TWITTER2 # check if ticket exists if tweet.respond_to?('in_reply_to_status_id') && tweet.in_reply_to_status_id && tweet.in_reply_to_status_id.to_s != '' puts 'tweet.in_reply_to_status_id found: ' + tweet.in_reply_to_status_id.to_s - article = Ticket::Article.where( :message_id => tweet.in_reply_to_status_id.to_s ).first + article = Ticket::Article.where( message_id: tweet.in_reply_to_status_id.to_s ).first if article puts 'article with id found tweet.in_reply_to_status_id found: ' + tweet.in_reply_to_status_id.to_s return article.ticket @@ -193,14 +193,14 @@ class Channel::TWITTER2 end # find if record already exists - article = Ticket::Article.where( :message_id => tweet.id.to_s ).first + article = Ticket::Article.where( message_id: tweet.id.to_s ).first if article return article.ticket end ticket = nil if @article_type == 'twitter direct-message' - ticket = Ticket.where( :customer_id => user.id ).first + ticket = Ticket.where( customer_id: user.id ).first if ticket state_type = Ticket::StateType.where( ticket.state.state_type_id ) if state_type.name == 'closed' || state_type.name == 'closed' @@ -209,27 +209,27 @@ class Channel::TWITTER2 end end if !ticket - group = Group.where( :name => group ).first + group = Group.where( name: group ).first group_id = 1 if group group_id = group.id end - state = Ticket::State.where( :name => 'new' ).first + state = Ticket::State.where( name: 'new' ).first state_id = 1 if state state_id = state.id end - priority = Ticket::Priority.where( :name => '2 normal' ).first + priority = Ticket::Priority.where( name: '2 normal' ).first priority_id = 1 if priority priority_id = priority.id end ticket = Ticket.create( - :group_id => group_id, - :customer_id => user.id, - :title => tweet.text[0,40], - :state_id => state_id, - :priority_id => priority_id, + group_id: group_id, + customer_id: user.id, + title: tweet.text[0,40], + state_id: state_id, + priority_id: priority_id, ) end @@ -239,12 +239,12 @@ class Channel::TWITTER2 def fetch_article_create( user, ticket, tweet, sender ) # find if record already exists - article = Ticket::Article.where( :message_id => tweet.id.to_s ).first + article = Ticket::Article.where( message_id: tweet.id.to_s ).first return article if article # set ticket state to open if not new if ticket.state.name != 'new' - ticket.state = Ticket::State.where( :name => 'open' ).first + ticket.state = Ticket::State.where( name: 'open' ).first ticket.save end @@ -255,21 +255,21 @@ class Channel::TWITTER2 end article = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where( :name => @article_type ).first.id, - :sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id, - :body => tweet.text, - :from => sender.name, - :to => to, - :message_id => tweet.id, - :internal => false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where( name: @article_type ).first.id, + sender_id: Ticket::Article::Sender.where( name: 'Customer' ).first.id, + body: tweet.text, + from: sender.name, + to: to, + message_id: tweet.id, + internal: false, ) end def send(attr, notification = false) # logger.debug('tweeeeettttt!!!!!!') - channel = Channel.where( :area => 'Twitter::Inbound', :active => true ).first + channel = Channel.where( area: 'Twitter::Inbound', active: true ).first client = Twitter::REST::Client.new do |config| config.consumer_key = channel[:options][:consumer_key] @@ -292,7 +292,7 @@ class Channel::TWITTER2 message = client.update( attr[:body].to_s, { - :in_reply_to_status_id => attr[:in_reply_to] + in_reply_to_status_id: attr[:in_reply_to] } ) # puts message.inspect diff --git a/app/models/email_address.rb b/app/models/email_address.rb index 15cb26856..76f7eafc0 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -1,9 +1,9 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class EmailAddress < ApplicationModel - has_many :groups, :after_add => :cache_update, :after_remove => :cache_update - validates :realname, :presence => true - validates :email, :presence => true + has_many :groups, after_add: :cache_update, after_remove: :cache_update + validates :realname, presence: true + validates :email, presence: true latest_change_support diff --git a/app/models/group.rb b/app/models/group.rb index 3151fa7dd..c8f97d3b0 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,12 +1,12 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Group < ApplicationModel - has_and_belongs_to_many :users, :after_add => :cache_update, :after_remove => :cache_update + has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update belongs_to :email_address belongs_to :signature - validates :name, :presence => true + validates :name, presence: true - activity_stream_support :role => Z_ROLENAME_ADMIN + activity_stream_support role: Z_ROLENAME_ADMIN history_support latest_change_support end \ No newline at end of file diff --git a/app/models/history.rb b/app/models/history.rb index cfa0a24c3..55e2c05a3 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -5,9 +5,9 @@ class History < ApplicationModel include History::Assets self.table_name = 'histories' - belongs_to :history_type, :class_name => 'History::Type' - belongs_to :history_object, :class_name => 'History::Object' - belongs_to :history_attribute, :class_name => 'History::Attribute' + belongs_to :history_type, class_name: 'History::Type' + belongs_to :history_object, class_name: 'History::Object' + belongs_to :history_attribute, class_name: 'History::Attribute' # before_validation :check_type, :check_object # attr_writer :history_type, :history_object @@ -60,23 +60,23 @@ add a new history entry for an object # create history record = { - :id => data[:id], - :o_id => data[:o_id], - :history_type_id => history_type.id, - :history_object_id => history_object.id, - :history_attribute_id => history_attribute_id, - :related_history_object_id => related_history_object_id, - :related_o_id => data[:related_o_id], - :value_from => data[:value_from], - :value_to => data[:value_to], - :id_from => data[:id_from], - :id_to => data[:id_to], - :created_at => data[:created_at], - :created_by_id => data[:created_by_id] + id: data[:id], + o_id: data[:o_id], + history_type_id: history_type.id, + history_object_id: history_object.id, + history_attribute_id: history_attribute_id, + related_history_object_id: related_history_object_id, + related_o_id: data[:related_o_id], + value_from: data[:value_from], + value_to: data[:value_to], + id_from: data[:id_from], + id_to: data[:id_to], + created_at: data[:created_at], + created_by_id: data[:created_by_id] } history_record = nil if data[:id] - history_record = History.where( :id => data[:id] ).first + history_record = History.where( id: data[:id] ).first end if history_record history_record.update_attributes(record) @@ -98,11 +98,11 @@ remove whole history entries of an object =end def self.remove( requested_object, requested_object_id ) - history_object = History::Object.where( :name => requested_object ).first + history_object = History::Object.where( name: requested_object ).first return if !history_object History.where( - :history_object_id => history_object.id, - :o_id => requested_object_id, + history_object_id: history_object.id, + o_id: requested_object_id, ).destroy_all end @@ -152,8 +152,8 @@ returns def self.list( requested_object, requested_object_id, related_history_object = nil, assets = nil ) if !related_history_object history_object = self.object_lookup( requested_object ) - history = History.where( :history_object_id => history_object.id ). - where( :o_id => requested_object_id ). + history = History.where( history_object_id: history_object.id ). + where( o_id: requested_object_id ). order('created_at ASC, id ASC') else history_object_requested = self.object_lookup( requested_object ) @@ -208,8 +208,8 @@ returns end if assets return { - :list => list, - :assets => asset_list, + list: list, + assets: asset_list, } end list @@ -223,7 +223,7 @@ returns return @@cache_type[ id ] if @@cache_type[ id ] # lookup - history_type = History::Type.lookup( :id => id ) + history_type = History::Type.lookup( id: id ) @@cache_type[ id ] = history_type return history_type end @@ -234,7 +234,7 @@ returns return @@cache_type[ name ] if @@cache_type[ name ] # lookup - history_type = History::Type.lookup( :name => name ) + history_type = History::Type.lookup( name: name ) if history_type @@cache_type[ name ] = history_type return history_type @@ -242,7 +242,7 @@ returns # create history_type = History::Type.create( - :name => name + name: name ) @@cache_type[ name ] = history_type return history_type @@ -254,7 +254,7 @@ returns return @@cache_object[ id ] if @@cache_object[ id ] # lookup - history_object = History::Object.lookup( :id => id ) + history_object = History::Object.lookup( id: id ) @@cache_object[ id ] = history_object return history_object end @@ -265,7 +265,7 @@ returns return @@cache_object[ name ] if @@cache_object[ name ] # lookup - history_object = History::Object.lookup( :name => name ) + history_object = History::Object.lookup( name: name ) if history_object @@cache_object[ name ] = history_object return history_object @@ -273,7 +273,7 @@ returns # create history_object = History::Object.create( - :name => name + name: name ) @@cache_object[ name ] = history_object return history_object @@ -285,7 +285,7 @@ returns return @@cache_attribute[ id ] if @@cache_attribute[ id ] # lookup - history_attribute = History::Attribute.lookup( :id => id ) + history_attribute = History::Attribute.lookup( id: id ) @@cache_attribute[ id ] = history_attribute return history_attribute end @@ -296,7 +296,7 @@ returns return @@cache_attribute[ name ] if @@cache_attribute[ name ] # lookup - history_attribute = History::Attribute.lookup( :name => name ) + history_attribute = History::Attribute.lookup( name: name ) if history_attribute @@cache_attribute[ name ] = history_attribute return history_attribute @@ -304,7 +304,7 @@ returns # create history_attribute = History::Attribute.create( - :name => name + name: name ) @@cache_attribute[ name ] = history_attribute return history_attribute diff --git a/app/models/history/assets.rb b/app/models/history/assets.rb index 8f37e1cf4..e9f3b1816 100644 --- a/app/models/history/assets.rb +++ b/app/models/history/assets.rb @@ -23,7 +23,7 @@ returns def assets (data) if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self['created_by_id'] ] - user = User.lookup( :id => self['created_by_id'] ) + user = User.lookup( id: self['created_by_id'] ) data = user.assets( data ) end diff --git a/app/models/job.rb b/app/models/job.rb index e8e74082d..6aa84e2e6 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -4,7 +4,7 @@ class Job < ApplicationModel store :timeplan store :condition store :execute - validates :name, :presence => true + validates :name, presence: true before_create :updated_matching before_update :updated_matching @@ -22,7 +22,7 @@ class Job < ApplicationModel 5 => 'fri', 6 => 'sat', } - jobs = Job.where( :active => true ) + jobs = Job.where( active: true ) jobs.each do |job| # only execute jobs, older then 1 min, to give admin posibility to change diff --git a/app/models/link.rb b/app/models/link.rb index 5a3001146..039b888e0 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -1,8 +1,8 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Link < ApplicationModel - belongs_to :link_type, :class_name => 'Link::Type' - belongs_to :link_object, :class_name => 'Link::Object' + belongs_to :link_type, class_name: 'Link::Type' + belongs_to :link_object, class_name: 'Link::Object' @map = { 'normal' => 'normal', @@ -20,7 +20,7 @@ class Link < ApplicationModel =end def self.list(data) - linkobject = self.link_object_get( :name => data[:link_object] ) + linkobject = self.link_object_get( name: data[:link_object] ) return if !linkobject items = [] @@ -75,19 +75,19 @@ class Link < ApplicationModel def self.add(data) if data.has_key?(:link_type) - linktype = self.link_type_get( :name => data[:link_type] ) + linktype = self.link_type_get( name: data[:link_type] ) data[:link_type_id] = linktype.id data.delete( :link_type ) end if data.has_key?(:link_object_source) - linkobject = self.link_object_get( :name => data[:link_object_source] ) + linkobject = self.link_object_get( name: data[:link_object_source] ) data[:link_object_source_id] = linkobject.id data.delete( :link_object_source ) end if data.has_key?(:link_object_target) - linkobject = self.link_object_get( :name => data[:link_object_target] ) + linkobject = self.link_object_get( name: data[:link_object_target] ) data[:link_object_target_id] = linkobject.id data.delete( :link_object_target ) end @@ -109,26 +109,26 @@ class Link < ApplicationModel def self.remove(data) if data.has_key?(:link_object_source) - linkobject = self.link_object_get( :name => data[:link_object_source] ) + linkobject = self.link_object_get( name: data[:link_object_source] ) data[:link_object_source_id] = linkobject.id end if data.has_key?(:link_object_target) - linkobject = self.link_object_get( :name => data[:link_object_target] ) + linkobject = self.link_object_get( name: data[:link_object_target] ) data[:link_object_target_id] = linkobject.id end # from one site if data.has_key?(:link_type) - linktype = self.link_type_get( :name => data[:link_type] ) + linktype = self.link_type_get( name: data[:link_type] ) data[:link_type_id] = linktype.id end links = Link.where( - :link_type_id => data[:link_type_id], - :link_object_source_id => data[:link_object_source_id], - :link_object_source_value => data[:link_object_source_value], - :link_object_target_id => data[:link_object_target_id], - :link_object_target_value => data[:link_object_target_value] + link_type_id: data[:link_type_id], + link_object_source_id: data[:link_object_source_id], + link_object_source_value: data[:link_object_source_value], + link_object_target_id: data[:link_object_target_id], + link_object_target_value: data[:link_object_target_value] ) links.each { |link| link.destroy @@ -136,15 +136,15 @@ class Link < ApplicationModel # from the other site if data.has_key?(:link_type) - linktype = self.link_type_get( :name => @map[ data[:link_type] ] ) + linktype = self.link_type_get( name: @map[ data[:link_type] ] ) data[:link_type_id] = linktype.id end links = Link.where( - :link_type_id => data[:link_type_id], - :link_object_target_id => data[:link_object_source_id], - :link_object_target_value => data[:link_object_source_value], - :link_object_source_id => data[:link_object_target_id], - :link_object_source_value => data[:link_object_target_value] + link_type_id: data[:link_type_id], + link_object_target_id: data[:link_object_source_id], + link_object_target_value: data[:link_object_source_value], + link_object_source_id: data[:link_object_target_id], + link_object_source_value: data[:link_object_target_value] ) links.each { |link| link.destroy @@ -153,20 +153,20 @@ class Link < ApplicationModel private def self.link_type_get(data) - linktype = Link::Type.where( :name => data[:name] ).first + linktype = Link::Type.where( name: data[:name] ).first if !linktype linktype = Link::Type.create( - :name => data[:name] + name: data[:name] ) end return linktype end def self.link_object_get(data) - linkobject = Link::Object.where( :name => data[:name] ).first + linkobject = Link::Object.where( name: data[:name] ).first if !linkobject linkobject = Link::Object.create( - :name => data[:name] + name: data[:name] ) end return linkobject @@ -175,9 +175,9 @@ class Link < ApplicationModel end class Link::Type < ApplicationModel - validates :name, :presence => true + validates :name, presence: true end class Link::Object < ApplicationModel - validates :name, :presence => true + validates :name, presence: true end diff --git a/app/models/locale.rb b/app/models/locale.rb index 2c1c8f167..a8b0c9191 100644 --- a/app/models/locale.rb +++ b/app/models/locale.rb @@ -9,7 +9,7 @@ class Locale < ApplicationModel url, {}, { - :json => true, + json: true, } ) @@ -17,7 +17,7 @@ class Locale < ApplicationModel result.data.each {|locale| puts locale.inspect - exists = Locale.where(:locale => locale['locale']).first + exists = Locale.where(locale: locale['locale']).first if exists exists.update(locale.symbolize_keys!) else diff --git a/app/models/object_lookup.rb b/app/models/object_lookup.rb index 456b6100c..432bd374d 100644 --- a/app/models/object_lookup.rb +++ b/app/models/object_lookup.rb @@ -9,7 +9,7 @@ class ObjectLookup < ApplicationModel return @@cache_object[ id ] if @@cache_object[ id ] # lookup - lookup = self.lookup( :id => id ) + lookup = self.lookup( id: id ) return if !lookup @@cache_object[ id ] = lookup.name lookup.name @@ -21,7 +21,7 @@ class ObjectLookup < ApplicationModel return @@cache_object[ name ] if @@cache_object[ name ] # lookup - lookup = self.lookup( :name => name ) + lookup = self.lookup( name: name ) if lookup @@cache_object[ name ] = lookup.id return lookup.id @@ -29,7 +29,7 @@ class ObjectLookup < ApplicationModel # create lookup = self.create( - :name => name + name: name ) @@cache_object[ name ] = lookup.id lookup.id diff --git a/app/models/object_manager.rb b/app/models/object_manager.rb index 74c287529..cbd9df08f 100644 --- a/app/models/object_manager.rb +++ b/app/models/object_manager.rb @@ -30,8 +30,8 @@ end class ObjectManager::Attribute < ApplicationModel self.table_name = 'object_manager_attributes' - belongs_to :object_lookup, :class_name => 'ObjectLookup' - validates :name, :presence => true + belongs_to :object_lookup, class_name: 'ObjectLookup' + validates :name, presence: true store :screens store :data_option @@ -113,8 +113,8 @@ add a new attribute entry for an object # check newest entry - is needed result = ObjectManager::Attribute.where( - :object_lookup_id => data[:object_lookup_id], - :name => data[:name], + object_lookup_id: data[:object_lookup_id], + name: data[:name], ).first if result # raise "ERROR: attribute #{data[:name]} for #{data[:object]} already exists" @@ -145,8 +145,8 @@ get the attribute model based on object and name end ObjectManager::Attribute.where( - :object_lookup_id => data[:object_lookup_id], - :name => data[:name], + object_lookup_id: data[:object_lookup_id], + name: data[:name], ).first end @@ -175,15 +175,15 @@ returns: # get attributes in right order result = ObjectManager::Attribute.where( - :object_lookup_id => object_lookup_id, - :active => true, + object_lookup_id: object_lookup_id, + active: true, ).order('position ASC') attributes = [] result.each {|item| data = { - :name => item.name, - :display => item.display, - :tag => item.data_type, + name: item.name, + display: item.display, + tag: item.data_type, #:null => item.null, } if item.screens diff --git a/app/models/observer/organization/ref_object_touch.rb b/app/models/observer/organization/ref_object_touch.rb index c020094f7..dc96082ad 100644 --- a/app/models/observer/organization/ref_object_touch.rb +++ b/app/models/observer/organization/ref_object_touch.rb @@ -19,7 +19,7 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer return if Setting.get('import_mode') # touch organizations tickets - Ticket.select('id').where( :organization_id => record.id ).each {|ticket| + Ticket.select('id').where( organization_id: record.id ).each {|ticket| ticket.touch } diff --git a/app/models/observer/tag/ticket_history.rb b/app/models/observer/tag/ticket_history.rb index b38d7f6e9..7645c7551 100644 --- a/app/models/observer/tag/ticket_history.rb +++ b/app/models/observer/tag/ticket_history.rb @@ -12,11 +12,11 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer # add ticket history History.add( - :o_id => record.o_id, - :history_type => 'added', - :history_object => 'Ticket', - :history_attribute => 'tag', - :value_to => record.tag_item.name, + o_id: record.o_id, + history_type: 'added', + history_object: 'Ticket', + history_attribute: 'tag', + value_to: record.tag_item.name, ) end def after_destroy(record) @@ -26,11 +26,11 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer # add ticket history History.add( - :o_id => record.o_id, - :history_type => 'removed', - :history_object => 'Ticket', - :history_attribute => 'tag', - :value_to => record.tag_item.name, + o_id: record.o_id, + history_type: 'removed', + history_object: 'Ticket', + history_attribute: 'tag', + value_to: record.tag_item.name, ) end end diff --git a/app/models/observer/ticket/article/communicate_email.rb b/app/models/observer/ticket/article/communicate_email.rb index 153100743..d71e87a03 100644 --- a/app/models/observer/ticket/article/communicate_email.rb +++ b/app/models/observer/ticket/article/communicate_email.rb @@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer return if Setting.get('import_mode') # if sender is customer, do not communication - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) return 1 if sender == nil return 1 if sender['name'] == 'Customer' # only apply on emails - type = Ticket::Article::Type.lookup( :id => record.type_id ) + type = Ticket::Article::Type.lookup( id: record.type_id ) return if type['name'] != 'email' # send background job diff --git a/app/models/observer/ticket/article/communicate_email/background_job.rb b/app/models/observer/ticket/article/communicate_email/background_job.rb index 2086515fe..72cc20d37 100644 --- a/app/models/observer/ticket/article/communicate_email/background_job.rb +++ b/app/models/observer/ticket/article/communicate_email/background_job.rb @@ -6,32 +6,32 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob record = Ticket::Article.find( @article_id ) # build subject - ticket = Ticket.lookup( :id => record.ticket_id ) + ticket = Ticket.lookup( id: record.ticket_id ) subject = ticket.subject_build( record.subject ) # send email message = Channel::EmailSend.send( { - :message_id => record.message_id, - :in_reply_to => record.in_reply_to, - :from => record.from, - :to => record.to, - :cc => record.cc, - :subject => subject, - :content_type => record.content_type, - :body => record.body, - :attachments => record.attachments + message_id: record.message_id, + in_reply_to: record.in_reply_to, + from: record.from, + to: record.to, + cc: record.cc, + subject: subject, + content_type: record.content_type, + body: record.body, + attachments: record.attachments } ) # store mail plain Store.add( - :object => 'Ticket::Article::Mail', - :o_id => record.id, - :data => message.to_s, - :filename => "ticket-#{ticket.number}-#{record.id}.eml", - :preferences => {}, - :created_by_id => record.created_by_id, + object: 'Ticket::Article::Mail', + o_id: record.id, + data: message.to_s, + filename: "ticket-#{ticket.number}-#{record.id}.eml", + preferences: {}, + created_by_id: record.created_by_id, ) # add history record @@ -46,14 +46,14 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob } if recipient_list != '' History.add( - :o_id => record.id, - :history_type => 'email', - :history_object => 'Ticket::Article', - :related_o_id => ticket.id, - :related_history_object => 'Ticket', - :value_from => record.subject, - :value_to => recipient_list, - :created_by_id => record.created_by_id, + o_id: record.id, + history_type: 'email', + history_object: 'Ticket::Article', + related_o_id: ticket.id, + related_history_object: 'Ticket', + value_from: record.subject, + value_to: recipient_list, + created_by_id: record.created_by_id, ) end end diff --git a/app/models/observer/ticket/article/communicate_facebook.rb b/app/models/observer/ticket/article/communicate_facebook.rb index 93c67a03a..82d6c56e9 100644 --- a/app/models/observer/ticket/article/communicate_facebook.rb +++ b/app/models/observer/ticket/article/communicate_facebook.rb @@ -9,20 +9,20 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer return if Setting.get('import_mode') # if sender is customer, do not communication - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) return 1 if sender == nil return 1 if sender['name'] == 'Customer' # only apply on emails - type = Ticket::Article::Type.lookup( :id => record.type_id ) + type = Ticket::Article::Type.lookup( id: record.type_id ) return if type['name'] != 'facebook' a = Channel::Facebook.new a.send( { - :from => 'me@znuny.com', - :to => 'medenhofer', - :body => record.body + from: 'me@znuny.com', + to: 'medenhofer', + body: record.body } ) end diff --git a/app/models/observer/ticket/article/communicate_twitter.rb b/app/models/observer/ticket/article/communicate_twitter.rb index 6ac8ba61c..8b38779ab 100644 --- a/app/models/observer/ticket/article/communicate_twitter.rb +++ b/app/models/observer/ticket/article/communicate_twitter.rb @@ -9,21 +9,21 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer return if Setting.get('import_mode') # if sender is customer, do not communication - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) return 1 if sender == nil return 1 if sender['name'] == 'Customer' # only apply on tweets - type = Ticket::Article::Type.lookup( :id => record.type_id ) + type = Ticket::Article::Type.lookup( id: record.type_id ) return if type['name'] != 'twitter direct-message' && type['name'] != 'twitter status' a = Channel::TWITTER2.new message = a.send( { - :type => type['name'], - :to => record.to, - :body => record.body, - :in_reply_to => record.in_reply_to + type: type['name'], + to: record.to, + body: record.body, + in_reply_to: record.in_reply_to }, # Rails.application.config.channel_twitter ) diff --git a/app/models/observer/ticket/article/fillup_from_email.rb b/app/models/observer/ticket/article/fillup_from_email.rb index 8455824df..08fcf3778 100644 --- a/app/models/observer/ticket/article/fillup_from_email.rb +++ b/app/models/observer/ticket/article/fillup_from_email.rb @@ -9,16 +9,16 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer return if Setting.get('import_mode') # if sender is customer, do not change anything - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) return if sender == nil return if sender['name'] == 'Customer' # set email attributes - type = Ticket::Article::Type.lookup( :id => record.type_id ) + type = Ticket::Article::Type.lookup( id: record.type_id ) return if type['name'] != 'email' # set subject if empty - ticket = Ticket.lookup( :id => record.ticket_id ) + ticket = Ticket.lookup( id: record.ticket_id ) if !record.subject || record.subject == '' record.subject = ticket.title end diff --git a/app/models/observer/ticket/article/fillup_from_general.rb b/app/models/observer/ticket/article/fillup_from_general.rb index eb1132928..5ab4440b3 100644 --- a/app/models/observer/ticket/article/fillup_from_general.rb +++ b/app/models/observer/ticket/article/fillup_from_general.rb @@ -9,7 +9,7 @@ class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer return if Setting.get('import_mode') # if sender is customer, do not change anything - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) return if sender == nil return if sender['name'] == 'Customer' diff --git a/app/models/observer/ticket/article_sender_type.rb b/app/models/observer/ticket/article_sender_type.rb index 02c477eb4..df37de539 100644 --- a/app/models/observer/ticket/article_sender_type.rb +++ b/app/models/observer/ticket/article_sender_type.rb @@ -6,7 +6,7 @@ class Observer::Ticket::ArticleSenderType < ActiveRecord::Observer def after_create(record) # get article count - count = Ticket::Article.where( :ticket_id => record.ticket_id ).count + count = Ticket::Article.where( ticket_id: record.ticket_id ).count return if count > 1 record.ticket.create_article_type_id = record.type_id diff --git a/app/models/observer/ticket/close_time.rb b/app/models/observer/ticket/close_time.rb index 577336465..30cdc5929 100644 --- a/app/models/observer/ticket/close_time.rb +++ b/app/models/observer/ticket/close_time.rb @@ -22,8 +22,8 @@ class Observer::Ticket::CloseTime < ActiveRecord::Observer return true if record.close_time # check if ticket is closed now - state = Ticket::State.lookup( :id => record.state_id ) - state_type = Ticket::StateType.lookup( :id => state.state_type_id ) + state = Ticket::State.lookup( id: record.state_id ) + state_type = Ticket::StateType.lookup( id: state.state_type_id ) return true if state_type.name != 'closed' # set close_time diff --git a/app/models/observer/ticket/first_response.rb b/app/models/observer/ticket/first_response.rb index 5d406b978..3ab0fd15d 100644 --- a/app/models/observer/ticket/first_response.rb +++ b/app/models/observer/ticket/first_response.rb @@ -13,8 +13,8 @@ class Observer::Ticket::FirstResponse < ActiveRecord::Observer return true if record.internal # if sender is not agent - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) - type = Ticket::Article::Type.lookup( :id => record.type_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) + type = Ticket::Article::Type.lookup( id: record.type_id ) if sender.name != 'Agent' && type.name !~ /^phone/ return true end diff --git a/app/models/observer/ticket/last_contact.rb b/app/models/observer/ticket/last_contact.rb index a9eb937dc..d097051e4 100644 --- a/app/models/observer/ticket/last_contact.rb +++ b/app/models/observer/ticket/last_contact.rb @@ -10,10 +10,10 @@ class Observer::Ticket::LastContact < ActiveRecord::Observer return true if record.internal # if article is a message to customer - return true if !Ticket::Article::Type.lookup( :id => record.type_id ).communication + return true if !Ticket::Article::Type.lookup( id: record.type_id ).communication # if sender is not customer - sender = Ticket::Article::Sender.lookup( :id => record.sender_id ) + sender = Ticket::Article::Sender.lookup( id: record.sender_id ) if sender.name == 'Customer' # check if last communication is done by agent, else do not set last_contact_customer diff --git a/app/models/observer/ticket/notification.rb b/app/models/observer/ticket/notification.rb index 9d393718c..240294fcb 100644 --- a/app/models/observer/ticket/notification.rb +++ b/app/models/observer/ticket/notification.rb @@ -54,7 +54,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer # get current state of objects if event[:name] == 'Ticket::Article' - article = Ticket::Article.lookup( :id => event[:id] ) + article = Ticket::Article.lookup( id: event[:id] ) # next if article is already deleted next if !article @@ -71,7 +71,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer end elsif event[:name] == 'Ticket' - ticket = Ticket.lookup( :id => event[:id] ) + ticket = Ticket.lookup( id: event[:id] ) # next if ticket is already deleted next if !ticket @@ -115,10 +115,10 @@ class Observer::Ticket::Notification < ActiveRecord::Observer # puts 'CREATED!!!!' # puts record.inspect e = { - :name => record.class.name, - :type => 'create', - :data => record, - :id => record.id, + name: record.class.name, + type: 'create', + data: record, + id: record.id, } EventBuffer.add(e) end @@ -150,11 +150,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer return if real_changes.empty? e = { - :name => record.class.name, - :type => 'update', - :data => record, - :changes => real_changes, - :id => record.id, + name: record.class.name, + type: 'update', + data: record, + changes: real_changes, + id: record.id, } EventBuffer.add(e) end diff --git a/app/models/observer/ticket/notification/background_job.rb b/app/models/observer/ticket/notification/background_job.rb index b4b277e13..aab2cada4 100644 --- a/app/models/observer/ticket/notification/background_job.rb +++ b/app/models/observer/ticket/notification/background_job.rb @@ -66,12 +66,12 @@ class Observer::Ticket::Notification::BackgroundJob # create online notification seen = ticket.online_notification_seen_state OnlineNotification.add( - :type => @p[:type], - :object => 'Ticket', - :o_id => ticket.id, - :seen => seen, - :created_by_id => ticket.updated_by_id || 1, - :user_id => user.id, + type: @p[:type], + object: 'Ticket', + o_id: ticket.id, + seen: seen, + created_by_id: ticket.updated_by_id || 1, + user_id: user.id, ) # create email notification @@ -103,12 +103,12 @@ class Observer::Ticket::Notification::BackgroundJob notification = {} [:subject, :body].each { |key| notification[key.to_sym] = NotificationFactory.build( - :locale => user.preferences[:locale], - :string => template[key], - :objects => { - :ticket => ticket, - :article => article, - :recipient => user, + locale: user.preferences[:locale], + string: template[key], + objects: { + ticket: ticket, + article: article, + recipient: user, } ) } @@ -120,21 +120,21 @@ class Observer::Ticket::Notification::BackgroundJob puts "send ticket notifiaction to agent (#{@p[:type]}/#{ticket.id}/#{user.email})" NotificationFactory.send( - :recipient => user, - :subject => notification[:subject], - :body => notification[:body], - :content_type => 'text/html', + recipient: user, + subject: notification[:subject], + body: notification[:body], + content_type: 'text/html', ) end # add history record if recipient_list != '' History.add( - :o_id => ticket.id, - :history_type => 'notification', - :history_object => 'Ticket', - :value_to => recipient_list, - :created_by_id => ticket.updated_by_id || 1 + o_id: ticket.id, + history_type: 'notification', + history_object: 'Ticket', + value_to: recipient_list, + created_by_id: ticket.updated_by_id || 1 ) end end @@ -184,7 +184,7 @@ class Observer::Ticket::Notification::BackgroundJob if record.respond_to?( attribute_name ) && record.send(attribute_name) relation_class = record.send(attribute_name).class if relation_class && value_id[0] - relation_model = relation_class.lookup( :id => value_id[0] ) + relation_model = relation_class.lookup( id: value_id[0] ) if relation_model if relation_model['name'] value_str[0] = relation_model['name'] @@ -194,7 +194,7 @@ class Observer::Ticket::Notification::BackgroundJob end end if relation_class && value_id[1] - relation_model = relation_class.lookup( :id => value_id[1] ) + relation_model = relation_class.lookup( id: value_id[1] ) if relation_model if relation_model['name'] value_str[1] = relation_model['name'] @@ -281,8 +281,8 @@ State: i18n(#{ticket.state.name.text2html})
body += template_footer(user, ticket, article) template = { - :subject => subject, - :body => body, + subject: subject, + body: body, } template end @@ -342,8 +342,8 @@ Changes:
body += template_footer(user,ticket, article) template = { - :subject => subject, - :body => body, + subject: subject, + body: body, } template end diff --git a/app/models/observer/ticket/reset_new_state.rb b/app/models/observer/ticket/reset_new_state.rb index afa0cc625..1598ad728 100644 --- a/app/models/observer/ticket/reset_new_state.rb +++ b/app/models/observer/ticket/reset_new_state.rb @@ -13,17 +13,17 @@ class Observer::Ticket::ResetNewState < ActiveRecord::Observer return true if record.internal # if sender is agent - return true if Ticket::Article::Sender.lookup( :id => record.sender_id ).name != 'Agent' + return true if Ticket::Article::Sender.lookup( id: record.sender_id ).name != 'Agent' # if article is a message to customer - return true if !Ticket::Article::Type.lookup( :id => record.type_id ).communication + return true if !Ticket::Article::Type.lookup( id: record.type_id ).communication # if current ticket state is still new - ticket = Ticket.lookup( :id => record.ticket_id ) + ticket = Ticket.lookup( id: record.ticket_id ) return true if ticket.state.state_type.name != 'new' # TODO: add config option to state managment in UI - state = Ticket::State.lookup( :name => 'open' ) + state = Ticket::State.lookup( name: 'open' ) return if !state # set ticket to open diff --git a/app/models/observer/ticket/user_ticket_counter.rb b/app/models/observer/ticket/user_ticket_counter.rb index f6ae9139a..3b27aeb04 100644 --- a/app/models/observer/ticket/user_ticket_counter.rb +++ b/app/models/observer/ticket/user_ticket_counter.rb @@ -20,19 +20,19 @@ class Observer::Ticket::UserTicketCounter < ActiveRecord::Observer # open ticket count state_open = Ticket::State.by_category( 'open' ) tickets_open = Ticket.where( - :customer_id => record.customer_id, - :state_id => state_open, + customer_id: record.customer_id, + state_id: state_open, ).count() # closed ticket count state_closed = Ticket::State.by_category( 'closed' ) tickets_closed = Ticket.where( - :customer_id => record.customer_id, - :state_id => state_closed, + customer_id: record.customer_id, + state_id: state_closed, ).count() # check if update is needed - customer = User.lookup( :id => record.customer_id ) + customer = User.lookup( id: record.customer_id ) need_update = false if customer[:preferences][:tickets_open] != tickets_open need_update = true diff --git a/app/models/observer/user/geo.rb b/app/models/observer/user/geo.rb index 51d82364e..875fbd872 100644 --- a/app/models/observer/user/geo.rb +++ b/app/models/observer/user/geo.rb @@ -17,7 +17,7 @@ class Observer::User::Geo < ActiveRecord::Observer # check if geo update is needed based on old/new location if record.id - current = User.where( :id => record.id ).first + current = User.where( id: record.id ).first return if !current current_location = {} diff --git a/app/models/observer/user/ticket_organization.rb b/app/models/observer/user/ticket_organization.rb index a0d3df8d6..224bf2426 100644 --- a/app/models/observer/user/ticket_organization.rb +++ b/app/models/observer/user/ticket_organization.rb @@ -17,7 +17,7 @@ class Observer::User::TicketOrganization < ActiveRecord::Observer return if !record.changes['organization_id'] # update last 100 tickets of user - tickets = Ticket.where( :customer_id => record.id ).limit(100) + tickets = Ticket.where( customer_id: record.id ).limit(100) tickets.each {|ticket| if ticket.organization_id != record.organization_id ticket.organization_id = record.organization_id diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb index 1b645250e..ce793c8e8 100644 --- a/app/models/online_notification.rb +++ b/app/models/online_notification.rb @@ -1,8 +1,8 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class OnlineNotification < ApplicationModel - belongs_to :type_lookup, :class_name => 'TypeLookup' - belongs_to :object_lookup, :class_name => 'ObjectLookup' + belongs_to :type_lookup, class_name: 'TypeLookup' + belongs_to :object_lookup, class_name: 'ObjectLookup' after_create :notify_clients_after_change after_update :notify_clients_after_change @@ -34,12 +34,12 @@ add a new online notification for this user end record = { - :o_id => data[:o_id], - :object_lookup_id => object_id, - :type_lookup_id => type_id, - :seen => data[:seen], - :user_id => data[:user_id], - :created_by_id => data[:created_by_id] + o_id: data[:o_id], + object_lookup_id: object_id, + type_lookup_id: type_id, + seen: data[:seen], + user_id: data[:user_id], + created_by_id: data[:created_by_id] } OnlineNotification.create(record) @@ -72,8 +72,8 @@ remove whole online notifications of an object def self.remove( object_name, o_id ) object_id = ObjectLookup.by_name( object_name ) OnlineNotification.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ).destroy_all end @@ -87,7 +87,7 @@ return all online notifications of an user def self.list(user,limit) - notifications = OnlineNotification.where(:user_id => user.id). + notifications = OnlineNotification.where(user_id: user.id). order( 'created_at DESC, id DESC' ). limit( limit ) list = [] @@ -113,8 +113,8 @@ return all online notifications of an object def self.list_by_object( object_name, o_id) object_id = ObjectLookup.by_name( object_name ) notifications = OnlineNotification.where( - :object_lookup_id => object_id, - :o_id => o_id, + object_lookup_id: object_id, + o_id: o_id, ). order( 'created_at DESC, id DESC' ). limit( 10_000 ) @@ -141,9 +141,9 @@ mark online notification as seen by object def self.seen_by_object(object_name, o_id) object_id = ObjectLookup.by_name( object_name ) notifications = OnlineNotification.where( - :object_lookup_id => object_id, - :o_id => o_id, - :seen => false, + object_lookup_id: object_id, + o_id: o_id, + seen: false, ) notifications.each do |notification| notification.seen = true @@ -172,8 +172,8 @@ returns: notifications = OnlineNotification.list(user, limit) assets = ApplicationModel.assets_of_object_list(notifications) return { - :stream => notifications, - :assets => assets + stream: notifications, + assets: assets } end @@ -181,8 +181,8 @@ returns: Sessions.send_to( self.user_id, { - :event => 'OnlineNotification::changed', - :data => {} + event: 'OnlineNotification::changed', + data: {} } ) end diff --git a/app/models/organization.rb b/app/models/organization.rb index 11d7a2e2c..307c5e1cc 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -8,10 +8,10 @@ class Organization < ApplicationModel include Organization::SearchIndex has_and_belongs_to_many :users - has_many :members, :class_name => 'User' - validates :name, :presence => true + has_many :members, class_name: 'User' + validates :name, presence: true - activity_stream_support :role => Z_ROLENAME_ADMIN + activity_stream_support role: Z_ROLENAME_ADMIN history_support search_index_support notify_clients_support diff --git a/app/models/organization/assets.rb b/app/models/organization/assets.rb index 9ad1eacee..43b064589 100644 --- a/app/models/organization/assets.rb +++ b/app/models/organization/assets.rb @@ -33,7 +33,7 @@ returns if data[ Organization.to_app_model ][ self.id ]['member_ids'] data[ Organization.to_app_model ][ self.id ]['member_ids'].each {|user_id| if !data[ User.to_app_model ][ user_id ] - user = User.lookup( :id => user_id ) + user = User.lookup( id: user_id ) data = user.assets( data ) end } @@ -42,7 +42,7 @@ returns ['created_by_id', 'updated_by_id'].each {|item| if self[ item ] if !data[ User.to_app_model ][ self[ item ] ] - user = User.lookup( :id => self[ item ] ) + user = User.lookup( id: self[ item ] ) data = user.assets( data ) end end diff --git a/app/models/organization/search.rb b/app/models/organization/search.rb index 515450b88..7abcd7f5a 100644 --- a/app/models/organization/search.rb +++ b/app/models/organization/search.rb @@ -33,7 +33,7 @@ returns items = SearchIndexBackend.search( query, limit, 'Organization' ) organizations = [] items.each { |item| - organizations.push Organization.lookup( :id => item[:id] ) + organizations.push Organization.lookup( id: item[:id] ) } return organizations end diff --git a/app/models/organization/search_index.rb b/app/models/organization/search_index.rb index a7aa0eb2b..26bc44fb7 100644 --- a/app/models/organization/search_index.rb +++ b/app/models/organization/search_index.rb @@ -32,7 +32,7 @@ returns next if !relation_class # lookup ref object - relation_model = relation_class.lookup( :id => value ) + relation_model = relation_class.lookup( id: value ) next if !relation_model # get name of ref object @@ -49,7 +49,7 @@ returns # add org member for search index data attributes['member'] = [] - users = User.where( :organization_id => self.id ) + users = User.where( organization_id: self.id ) users.each { |user| attributes['member'].push user.search_index_data } diff --git a/app/models/overview.rb b/app/models/overview.rb index 2a59f73f4..6b12869c6 100644 --- a/app/models/overview.rb +++ b/app/models/overview.rb @@ -4,7 +4,7 @@ class Overview < ApplicationModel store :condition store :order store :view - validates :name, :presence => true - validates :prio, :presence => true - validates :link, :presence => true + validates :name, presence: true + validates :prio, presence: true + validates :link, presence: true end \ No newline at end of file diff --git a/app/models/package.rb b/app/models/package.rb index a170ad1ed..83f427e66 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -55,7 +55,7 @@ class Package < ApplicationModel end end data.each {|file| - self.install( :file => path + '/' + file ) + self.install( file: path + '/' + file ) } data end @@ -186,16 +186,16 @@ class Package < ApplicationModel # package meta data meta = { - :name => package.elements['zpm/name'].text, - :version => package.elements['zpm/version'].text, - :vendor => package.elements['zpm/vendor'].text, - :state => 'uninstalled', - :created_by_id => 1, - :updated_by_id => 1, + name: package.elements['zpm/name'].text, + version: package.elements['zpm/version'].text, + vendor: package.elements['zpm/vendor'].text, + state: 'uninstalled', + created_by_id: 1, + updated_by_id: 1, } # verify if package can get installed - package_db = Package.where( :name => meta[:name] ).first + package_db = Package.where( name: meta[:name] ).first if package_db if !data[:reinstall] if Gem::Version.new( package_db.version ) == Gem::Version.new( meta[:version] ) @@ -208,9 +208,9 @@ class Package < ApplicationModel # uninstall files of old package self.uninstall({ - :name => package_db.name, - :version => package_db.version, - :migration_not_down => true, + name: package_db.name, + version: package_db.version, + migration_not_down: true, }) end @@ -218,12 +218,12 @@ class Package < ApplicationModel record = Package.create( meta ) if !data[:reinstall] Store.add( - :object => 'Package', - :o_id => record.id, - :data => package.to_s, - :filename => meta[:name] + '-' + meta[:version] + '.zpm', - :preferences => {}, - :created_by_id => UserInfo.current_user_id || 1, + object: 'Package', + o_id: record.id, + data: package.to_s, + filename: meta[:name] + '-' + meta[:version] + '.zpm', + preferences: {}, + created_by_id: UserInfo.current_user_id || 1, ) end @@ -253,13 +253,13 @@ class Package < ApplicationModel # Package.reinstall( package_name ) def self.reinstall(package_name) - package = Package.where( :name => package_name ).first + package = Package.where( name: package_name ).first if !package raise "No such package '#{package_name}'" end file = self._get_bin( package.name, package.version ) - self.install( :string => file, :reinstall => true ) + self.install( string: file, reinstall: true ) end # Package.uninstall( :name => 'package', :version => '0.1.1' ) @@ -275,8 +275,8 @@ class Package < ApplicationModel # package meta data meta = { - :name => package.elements['zpm/name'].text, - :version => package.elements['zpm/version'].text, + name: package.elements['zpm/name'].text, + version: package.elements['zpm/version'].text, } # down migrations @@ -301,8 +301,8 @@ class Package < ApplicationModel # delete package record = Package.where( - :name => meta[:name], - :version => meta[:version], + name: meta[:name], + version: meta[:version], ).first record.destroy @@ -340,15 +340,15 @@ class Package < ApplicationModel def self._get_bin( name, version ) package = Package.where( - :name => name, - :version => version, + name: name, + version: version, ).first if !package raise "No such package '#{name}' version '#{version}'" end list = Store.list( - :object => 'Package', - :o_id => package.id, + object: 'Package', + o_id: package.id, ) # find file @@ -442,7 +442,7 @@ class Package < ApplicationModel location = @@root + '/db/addon/' + package.underscore return true if !File.exists?( location ) - migrations_done = Package::Migration.where( :name => package.underscore ) + migrations_done = Package::Migration.where( name: package.underscore ) # get existing migrations migrations_existing = [] @@ -474,26 +474,26 @@ class Package < ApplicationModel # down if direction == 'reverse' - done = Package::Migration.where( :name => package.underscore, :version => version ).first + done = Package::Migration.where( name: package.underscore, version: version ).first next if !done logger.info "NOTICE: down package migration '#{migration}'" load "#{location}/#{migration}" classname = name.camelcase Kernel.const_get(classname).down - record = Package::Migration.where( :name => package.underscore, :version => version ).first + record = Package::Migration.where( name: package.underscore, version: version ).first if record record.destroy end # up else - done = Package::Migration.where( :name => package.underscore, :version => version ).first + done = Package::Migration.where( name: package.underscore, version: version ).first next if done logger.info "NOTICE: up package migration '#{migration}'" load "#{location}/#{migration}" classname = name.camelcase Kernel.const_get(classname).up - Package::Migration.create( :name => package.underscore, :version => version ) + Package::Migration.create( name: package.underscore, version: version ) end # reload new files diff --git a/app/models/postmaster_filter.rb b/app/models/postmaster_filter.rb index 9f8c2f917..beb454d43 100644 --- a/app/models/postmaster_filter.rb +++ b/app/models/postmaster_filter.rb @@ -3,5 +3,5 @@ class PostmasterFilter < ApplicationModel store :perform store :match - validates :name, :presence => true + validates :name, presence: true end diff --git a/app/models/recent_view.rb b/app/models/recent_view.rb index b31e0bb86..7dc6cc594 100644 --- a/app/models/recent_view.rb +++ b/app/models/recent_view.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class RecentView < ApplicationModel - belongs_to :object_lookup, :class_name => 'ObjectLookup' + belongs_to :object_lookup, class_name: 'ObjectLookup' after_create :notify_clients after_update :notify_clients @@ -17,31 +17,31 @@ class RecentView < ApplicationModel # create entry record = { - :o_id => o_id, - :recent_view_object_id => object_lookup_id.to_i, - :created_by_id => user.id, + o_id: o_id, + recent_view_object_id: object_lookup_id.to_i, + created_by_id: user.id, } RecentView.create(record) end def self.log_destroy( requested_object, requested_object_id ) return if requested_object == 'RecentView' - RecentView.where( :recent_view_object_id => ObjectLookup.by_name( requested_object ) ). - where( :o_id => requested_object_id ). + RecentView.where( recent_view_object_id: ObjectLookup.by_name( requested_object ) ). + where( o_id: requested_object_id ). destroy_all end def self.user_log_destroy( user ) - RecentView.where( :created_by_id => user.id ).destroy_all + RecentView.where( created_by_id: user.id ).destroy_all end def self.list( user, limit = 10, type = nil ) if !type - recent_views = RecentView.where( :created_by_id => user.id ). + recent_views = RecentView.where( created_by_id: user.id ). order('created_at DESC, id DESC'). limit(limit) else - recent_views = RecentView.select('DISTINCT(o_id), recent_view_object_id').where( :created_by_id => user.id, :recent_view_object_id => ObjectLookup.by_name(type) ) . + recent_views = RecentView.select('DISTINCT(o_id), recent_view_object_id').where( created_by_id: user.id, recent_view_object_id: ObjectLookup.by_name(type) ) . order('created_at DESC, id DESC'). limit(limit) end @@ -68,8 +68,8 @@ class RecentView < ApplicationModel assets = ApplicationModel.assets_of_object_list(recent_viewed) return { - :stream => recent_viewed, - :assets => assets, + stream: recent_viewed, + assets: assets, } end @@ -77,8 +77,8 @@ class RecentView < ApplicationModel Sessions.send_to( self.created_by_id, { - :event => 'RecentView::changed', - :data => {} + event: 'RecentView::changed', + data: {} } ) end @@ -90,7 +90,7 @@ class RecentView < ApplicationModel # check if object exists begin return if !Kernel.const_get( object ) - record = Kernel.const_get( object ).lookup( :id => o_id ) + record = Kernel.const_get( object ).lookup( id: o_id ) return if !record rescue return @@ -98,6 +98,6 @@ class RecentView < ApplicationModel # check permission return if !record.respond_to?(:permission) - record.permission( :current_user => user ) + record.permission( current_user: user ) end end \ No newline at end of file diff --git a/app/models/role.rb b/app/models/role.rb index 58722d401..405183fa0 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -2,8 +2,8 @@ class Role < ApplicationModel - has_and_belongs_to_many :users, :after_add => :cache_update, :after_remove => :cache_update - validates :name, :presence => true - activity_stream_support :role => Z_ROLENAME_ADMIN + has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update + validates :name, presence: true + activity_stream_support role: Z_ROLENAME_ADMIN latest_change_support end \ No newline at end of file diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 341d06947..beee83d29 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -36,7 +36,7 @@ class Scheduler < ApplicationModel if job.period while true self._start_job( job, runner, runner_count ) - job = Scheduler.lookup( :id => job.id ) + job = Scheduler.lookup( id: job.id ) # exit is job got deleted break if !job @@ -124,7 +124,7 @@ class Scheduler < ApplicationModel def self.check( name, time_warning = 10, time_critical = 20 ) time_warning_time = Time.now - time_warning.minutes time_critical_time = Time.now - time_critical.minutes - scheduler = Scheduler.where( :name => name ).first + scheduler = Scheduler.where( name: name ).first if !scheduler puts "CRITICAL - no such scheduler jobs '#{name}'" return true diff --git a/app/models/setting.rb b/app/models/setting.rb index 3ee3ea3db..8335e3166 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -36,11 +36,11 @@ class Setting < ApplicationModel end def self.set(name, value) - setting = Setting.where( :name => name ).first + setting = Setting.where( name: name ).first if !setting raise "Can't find config setting '#{name}'" end - setting.state = { :value => value } + setting.state = { value: value } setting.save logger.info "Setting.set() name:#{name}, value:#{value.inspect}" end @@ -60,7 +60,7 @@ class Setting < ApplicationModel def state_check if self.state || self.state == false if !self.state.respond_to?('has_key?') || !self.state.has_key?(:value) - self.state = { :value => self.state } + self.state = { value: self.state } end end end diff --git a/app/models/signature.rb b/app/models/signature.rb index cbeafa0fc..07590bd12 100644 --- a/app/models/signature.rb +++ b/app/models/signature.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Signature < ApplicationModel - has_many :groups, :after_add => :cache_update, :after_remove => :cache_update - validates :name, :presence => true + has_many :groups, after_add: :cache_update, after_remove: :cache_update + validates :name, presence: true latest_change_support end \ No newline at end of file diff --git a/app/models/sla.rb b/app/models/sla.rb index be1458777..070beb4bc 100644 --- a/app/models/sla.rb +++ b/app/models/sla.rb @@ -3,7 +3,7 @@ class Sla < ApplicationModel store :condition store :data - validates :name, :presence => true + validates :name, presence: true after_create :escalation_calculation_rebuild after_update :escalation_calculation_rebuild diff --git a/app/models/store.rb b/app/models/store.rb index d72f49e8c..817d63845 100644 --- a/app/models/store.rb +++ b/app/models/store.rb @@ -5,9 +5,9 @@ class Store < ApplicationModel load 'store/file.rb' store :preferences - belongs_to :store_object, :class_name => 'Store::Object' - belongs_to :store_file, :class_name => 'Store::File' - validates :filename, :presence => true + belongs_to :store_object, class_name: 'Store::Object' + belongs_to :store_file, class_name: 'Store::File' + validates :filename, presence: true =begin @@ -33,7 +33,7 @@ returns data = data.stringify_keys # lookup store_object.id - store_object = Store::Object.create_if_not_exists( :name => data['object'] ) + store_object = Store::Object.create_if_not_exists( name: data['object'] ) data['store_object_id'] = store_object.id # add to real store @@ -79,8 +79,8 @@ returns def self.list(data) # search - store_object_id = Store::Object.lookup( :name => data[:object] ) - stores = Store.where( :store_object_id => store_object_id, :o_id => data[:o_id].to_i ). + store_object_id = Store::Object.lookup( name: data[:object] ) + stores = Store.where( store_object_id: store_object_id, o_id: data[:o_id].to_i ). order('created_at ASC, id ASC') return stores end @@ -102,9 +102,9 @@ returns def self.remove(data) # search - store_object_id = Store::Object.lookup( :name => data[:object] ) - stores = Store.where( :store_object_id => store_object_id ). - where( :o_id => data[:o_id] ). + store_object_id = Store::Object.lookup( name: data[:object] ) + stores = Store.where( store_object_id: store_object_id ). + where( o_id: data[:o_id] ). order('created_at ASC, id ASC') stores.each do |store| @@ -130,7 +130,7 @@ returns # check backend for references store = Store.find(store_id) - files = Store.where( :store_file_id => store.store_file_id ) + files = Store.where( store_file_id: store.store_file_id ) if files.count == 1 && files.first.id == store.id Store::File.find( store.store_file_id ).destroy end @@ -140,7 +140,7 @@ returns end def content - file = Store::File.where( :id => self.store_file_id ).first + file = Store::File.where( id: self.store_file_id ).first if !file raise "No such file #{ self.store_file_id }!" end @@ -148,7 +148,7 @@ returns end def provider - file = Store::File.where( :id => self.store_file_id ).first + file = Store::File.where( id: self.store_file_id ).first if !file raise "No such file #{ self.store_file_id }!" end diff --git a/app/models/store/file.rb b/app/models/store/file.rb index 4e86d51d9..e701ca086 100644 --- a/app/models/store/file.rb +++ b/app/models/store/file.rb @@ -8,7 +8,7 @@ class Store::File < ApplicationModel def self.add(data) sha = Digest::SHA256.hexdigest( data ) - file = Store::File.where( :sha => sha ).first + file = Store::File.where( sha: sha ).first if file == nil # load backend based on config @@ -19,8 +19,8 @@ class Store::File < ApplicationModel adapter = self.load_adapter( "Store::Provider::#{ adapter_name }" ) adapter.add( data, sha ) file = Store::File.create( - :provider => adapter_name, - :sha => sha, + provider: adapter_name, + sha: sha, ) end file @@ -33,7 +33,7 @@ class Store::File < ApplicationModel c = adapter.get( self.sha ) else # fallback until migration is done - c = Store::Provider::DB.where( :md5 => self.md5 ).first.data + c = Store::Provider::DB.where( md5: self.md5 ).first.data end c end diff --git a/app/models/store/object.rb b/app/models/store/object.rb index 8d2f11c67..b3f4f0556 100644 --- a/app/models/store/object.rb +++ b/app/models/store/object.rb @@ -1,5 +1,5 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Store::Object < ApplicationModel - validates :name, :presence => true + validates :name, presence: true end \ No newline at end of file diff --git a/app/models/store/provider/db.rb b/app/models/store/provider/db.rb index fc8cd462d..44d80b7ac 100644 --- a/app/models/store/provider/db.rb +++ b/app/models/store/provider/db.rb @@ -5,20 +5,20 @@ class Store::Provider::DB < ApplicationModel def self.add(data, sha) Store::Provider::DB.create( - :data => data, - :sha => sha, + data: data, + sha: sha, ) true end def self.get(sha) - file = Store::Provider::DB.where( :sha => sha ).first + file = Store::Provider::DB.where( sha: sha ).first return if !file file.data end def self.delete(sha) - Store::Provider::DB.where( :sha => sha ).destroy_all + Store::Provider::DB.where( sha: sha ).destroy_all true end diff --git a/app/models/tag.rb b/app/models/tag.rb index 2a5031e48..ba3002516 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,8 +1,8 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Tag < ApplicationModel - belongs_to :tag_object, :class_name => 'Tag::Object' - belongs_to :tag_item, :class_name => 'Tag::Item' + belongs_to :tag_object, class_name: 'Tag::Object' + belongs_to :tag_item, class_name: 'Tag::Item' @@cache_item = {} @@cache_object = {} @@ -19,10 +19,10 @@ class Tag < ApplicationModel # create history Tag.create( - :tag_object_id => tag_object_id, - :tag_item_id => tag_item_id, - :o_id => data[:o_id], - :created_by_id => data[:created_by_id], + tag_object_id: tag_object_id, + tag_item_id: tag_item_id, + o_id: data[:o_id], + created_by_id: data[:created_by_id], ) return true end @@ -39,9 +39,9 @@ class Tag < ApplicationModel # create history result = Tag.where( - :tag_object_id => tag_object_id, - :tag_item_id => tag_item_id, - :o_id => data[:o_id], + tag_object_id: tag_object_id, + tag_item_id: tag_item_id, + o_id: data[:o_id], ) result.each { |item| item.destroy @@ -52,8 +52,8 @@ class Tag < ApplicationModel def self.tag_list( data ) tag_object_id_requested = self.tag_object_lookup( data[:object] ) tag_search = Tag.where( - :tag_object_id => tag_object_id_requested, - :o_id => data[:o_id], + tag_object_id: tag_object_id_requested, + o_id: data[:o_id], ) tags = [] tag_search.each {|tag| @@ -83,7 +83,7 @@ class Tag < ApplicationModel return @@cache_item[ name ] if @@cache_item[ name ] # lookup - tag_item = Tag::Item.where( :name => name ).first + tag_item = Tag::Item.where( name: name ).first if tag_item @@cache_item[ name ] = tag_item.id return tag_item.id @@ -91,7 +91,7 @@ class Tag < ApplicationModel # create tag_item = Tag::Item.create( - :name => name + name: name ) @@cache_item[ name ] = tag_item.id return tag_item.id @@ -114,7 +114,7 @@ class Tag < ApplicationModel return @@cache_object[ name ] if @@cache_object[ name ] # lookup - tag_object = Tag::Object.where( :name => name ).first + tag_object = Tag::Object.where( name: name ).first if tag_object @@cache_object[ name ] = tag_object.id return tag_object.id @@ -122,7 +122,7 @@ class Tag < ApplicationModel # create tag_object = Tag::Object.create( - :name => name + name: name ) @@cache_object[ name ] = tag_object.id return tag_object.id diff --git a/app/models/template.rb b/app/models/template.rb index 0626f1c9c..28a65d409 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -2,6 +2,6 @@ class Template < ApplicationModel store :options - validates :name, :presence => true + validates :name, presence: true notify_clients_support end \ No newline at end of file diff --git a/app/models/text_module.rb b/app/models/text_module.rb index 6e1df9944..7fad792ab 100644 --- a/app/models/text_module.rb +++ b/app/models/text_module.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class TextModule < ApplicationModel - validates :name, :presence => true - validates :content, :presence => true + validates :name, presence: true + validates :content, presence: true notify_clients_support end \ No newline at end of file diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 20de3f9b6..aba0470ba 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -22,41 +22,41 @@ class Ticket < ApplicationModel latest_change_support - activity_stream_support :ignore_attributes => { - :create_article_type_id => true, - :create_article_sender_id => true, - :article_count => true, + activity_stream_support ignore_attributes: { + create_article_type_id: true, + create_article_sender_id: true, + article_count: true, } - history_support :ignore_attributes => { - :create_article_type_id => true, - :create_article_sender_id => true, - :article_count => true, + history_support ignore_attributes: { + create_article_type_id: true, + create_article_sender_id: true, + article_count: true, } search_index_support( - :ignore_attributes => { - :create_article_type_id => true, - :create_article_sender_id => true, - :article_count => true, + ignore_attributes: { + create_article_type_id: true, + create_article_sender_id: true, + article_count: true, }, - :keep_attributes => { - :customer_id => true, - :organization_id => true, + keep_attributes: { + customer_id: true, + organization_id: true, }, ) belongs_to :group - has_many :articles, :class_name => 'Ticket::Article', :after_add => :cache_update, :after_remove => :cache_update + has_many :articles, class_name: 'Ticket::Article', after_add: :cache_update, after_remove: :cache_update belongs_to :organization - belongs_to :state, :class_name => 'Ticket::State' - belongs_to :priority, :class_name => 'Ticket::Priority' - belongs_to :owner, :class_name => 'User' - belongs_to :customer, :class_name => 'User' - belongs_to :created_by, :class_name => 'User' - belongs_to :updated_by, :class_name => 'User' - belongs_to :create_article_type, :class_name => 'Ticket::Article::Type' - belongs_to :create_article_sender, :class_name => 'Ticket::Article::Sender' + belongs_to :state, class_name: 'Ticket::State' + belongs_to :priority, class_name: 'Ticket::Priority' + belongs_to :owner, class_name: 'User' + belongs_to :customer, class_name: 'User' + belongs_to :created_by, class_name: 'User' + belongs_to :updated_by, class_name: 'User' + belongs_to :create_article_type, class_name: 'Ticket::Article::Type' + belongs_to :create_article_sender, class_name: 'Ticket::Article::Sender' self.inheritance_column = nil @@ -76,7 +76,7 @@ returns =end def agent_of_group - Group.find( self.group_id ).users.where( :active => true ).joins(:roles).where( 'roles.name' => Z_ROLENAME_AGENT, 'roles.active' => true ).uniq() + Group.find( self.group_id ).users.where( active: true ).joins(:roles).where( 'roles.name' => Z_ROLENAME_AGENT, 'roles.active' => true ).uniq() end =begin @@ -128,12 +128,12 @@ returns def merge_to(data) # update articles - Ticket::Article.where( :ticket_id => self.id ).each {|article| + Ticket::Article.where( ticket_id: self.id ).each {|article| article.touch } # quiet update of reassign of articles - Ticket::Article.where( :ticket_id => self.id ).update_all( ['ticket_id = ?', data[:ticket_id] ] ) + Ticket::Article.where( ticket_id: self.id ).update_all( ['ticket_id = ?', data[:ticket_id] ] ) # touch new ticket (to broadcast change) Ticket.find( data[:ticket_id] ).touch @@ -142,31 +142,31 @@ returns # create new merge article Ticket::Article.create( - :ticket_id => self.id, - :type_id => Ticket::Article::Type.lookup( :name => 'note' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => Z_ROLENAME_AGENT ).id, - :body => 'merged', - :internal => false, - :created_by_id => data[:user_id], - :updated_by_id => data[:user_id], + ticket_id: self.id, + type_id: Ticket::Article::Type.lookup( name: 'note' ).id, + sender_id: Ticket::Article::Sender.lookup( name: Z_ROLENAME_AGENT ).id, + body: 'merged', + internal: false, + created_by_id: data[:user_id], + updated_by_id: data[:user_id], ) # add history to both # link tickets Link.add( - :link_type => 'parent', - :link_object_source => 'Ticket', - :link_object_source_value => data[:ticket_id], - :link_object_target => 'Ticket', - :link_object_target_value => self.id + link_type: 'parent', + link_object_source: 'Ticket', + link_object_source_value: data[:ticket_id], + link_object_target: 'Ticket', + link_object_target_value: self.id ) # set state to 'merged' - self.state_id = Ticket::State.lookup( :name => 'merged' ).id + self.state_id = Ticket::State.lookup( name: 'merged' ).id # rest owner - self.owner_id = User.where( :login => '-' ).first.id + self.owner_id = User.where( login: '-' ).first.id # save ticket self.save @@ -186,8 +186,8 @@ returns =end def online_notification_seen_state - state = Ticket::State.lookup( :id => self.state_id ) - state_type = Ticket::StateType.lookup( :id => state.state_type_id ) + state = Ticket::State.lookup( id: self.state_id ) + state_type = Ticket::StateType.lookup( id: state.state_type_id ) return true if state_type.name == 'closed' return true if state_type.name == 'merged' false @@ -224,8 +224,8 @@ returns return if !self.changes['state_id'] # check if new state isn't pending* - current_state = Ticket::State.lookup( :id => self.state_id ) - current_state_type = Ticket::StateType.lookup( :id => current_state.state_type_id ) + current_state = Ticket::State.lookup( id: self.state_id ) + current_state_type = Ticket::StateType.lookup( id: current_state.state_type_id ) # in case, set pending_time to nil if current_state_type.name !~ /^pending/i diff --git a/app/models/ticket/activity_stream_log.rb b/app/models/ticket/activity_stream_log.rb index 889f02131..a1b981e5e 100644 --- a/app/models/ticket/activity_stream_log.rb +++ b/app/models/ticket/activity_stream_log.rb @@ -26,13 +26,13 @@ returns return if !self.class.activity_stream_support_config role = self.class.activity_stream_support_config[:role] ActivityStream.add( - :o_id => self['id'], - :type => type, - :object => self.class.name, - :group_id => self['group_id'], - :role => role, - :created_at => self.updated_at, - :created_by_id => user_id, + o_id: self['id'], + type: type, + object: self.class.name, + group_id: self['group_id'], + role: role, + created_at: self.updated_at, + created_by_id: user_id, ) end diff --git a/app/models/ticket/article.rb b/app/models/ticket/article.rb index 1f569fde7..24b209446 100644 --- a/app/models/ticket/article.rb +++ b/app/models/ticket/article.rb @@ -9,22 +9,22 @@ class Ticket::Article < ApplicationModel include Ticket::Article::ActivityStreamLog belongs_to :ticket - belongs_to :type, :class_name => 'Ticket::Article::Type' - belongs_to :sender, :class_name => 'Ticket::Article::Sender' - belongs_to :created_by, :class_name => 'User' - belongs_to :updated_by, :class_name => 'User' + belongs_to :type, class_name: 'Ticket::Article::Type' + belongs_to :sender, class_name: 'Ticket::Article::Sender' + belongs_to :created_by, class_name: 'User' + belongs_to :updated_by, class_name: 'User' before_create :check_subject before_update :check_subject notify_clients_support - activity_stream_support :ignore_attributes => { - :type_id => true, - :sender_id => true, + activity_stream_support ignore_attributes: { + type_id: true, + sender_id: true, } - history_support :ignore_attributes => { - :type_id => true, - :sender_id => true, + history_support ignore_attributes: { + type_id: true, + sender_id: true, } private @@ -39,12 +39,12 @@ class Ticket::Article < ApplicationModel end class Sender < ApplicationModel - validates :name, :presence => true + validates :name, presence: true latest_change_support end class Type < ApplicationModel - validates :name, :presence => true + validates :name, presence: true latest_change_support end end \ No newline at end of file diff --git a/app/models/ticket/article/activity_stream_log.rb b/app/models/ticket/article/activity_stream_log.rb index a0aeb33f0..169569600 100644 --- a/app/models/ticket/article/activity_stream_log.rb +++ b/app/models/ticket/article/activity_stream_log.rb @@ -25,15 +25,15 @@ returns return if !self.class.activity_stream_support_config role = self.class.activity_stream_support_config[:role] - ticket = Ticket.lookup( :id => self.ticket_id ) + ticket = Ticket.lookup( id: self.ticket_id ) ActivityStream.add( - :o_id => self['id'], - :type => type, - :object => self.class.name, - :group_id => ticket.group_id, - :role => role, - :created_at => self.updated_at, - :created_by_id => user_id, + o_id: self['id'], + type: type, + object: self.class.name, + group_id: ticket.group_id, + role: role, + created_at: self.updated_at, + created_by_id: user_id, ) end diff --git a/app/models/ticket/article/assets.rb b/app/models/ticket/article/assets.rb index 42bb98024..e7cb2968e 100644 --- a/app/models/ticket/article/assets.rb +++ b/app/models/ticket/article/assets.rb @@ -44,7 +44,7 @@ returns ['created_by_id', 'updated_by_id'].each {|item| if self[ item ] if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ] - user = User.lookup( :id => self[ item ] ) + user = User.lookup( id: self[ item ] ) data = user.assets( data ) end end diff --git a/app/models/ticket/assets.rb b/app/models/ticket/assets.rb index 856ef52fd..248959e5d 100644 --- a/app/models/ticket/assets.rb +++ b/app/models/ticket/assets.rb @@ -32,7 +32,7 @@ returns ['created_by_id', 'updated_by_id', 'owner_id', 'customer_id'].each {|item| if self[ item ] if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self[ item ] ] - user = User.lookup( :id => self[ item ] ) + user = User.lookup( id: self[ item ] ) data = user.assets( data ) end end diff --git a/app/models/ticket/escalation.rb b/app/models/ticket/escalation.rb index 89d8a2371..80a37bfc0 100644 --- a/app/models/ticket/escalation.rb +++ b/app/models/ticket/escalation.rb @@ -17,7 +17,7 @@ returns def self.rebuild_all state_list_open = Ticket::State.by_category( 'open' ) - tickets = Ticket.where( :state_id => state_list_open ) + tickets = Ticket.where( state_id: state_list_open ) tickets.each {|ticket| ticket.escalation_calculation } @@ -39,7 +39,7 @@ returns def escalation_calculation # set escalation off if ticket is already closed - state = Ticket::State.lookup( :id => self.state_id ) + state = Ticket::State.lookup( id: self.state_id ) if state.ignore_escalation? # nothing to change @@ -177,8 +177,8 @@ returns sla_selected = nil sla_list = Cache.get( 'SLA::List::Active' ) if sla_list == nil - sla_list = Sla.where( :active => true ) - Cache.write( 'SLA::List::Active', sla_list, { :expires_in => 1.hour } ) + sla_list = Sla.where( active: true ) + Cache.write( 'SLA::List::Active', sla_list, { expires_in: 1.hour } ) end sla_list.each {|sla| if !sla.condition || sla.condition.empty? diff --git a/app/models/ticket/history_log.rb b/app/models/ticket/history_log.rb index 7e3ae9e3f..5ae0a8ffa 100644 --- a/app/models/ticket/history_log.rb +++ b/app/models/ticket/history_log.rb @@ -73,8 +73,8 @@ returns end } return { - :history => list, - :assets => assets, + history: list, + assets: assets, } end diff --git a/app/models/ticket/number.rb b/app/models/ticket/number.rb index 368e210d2..7b02c95b3 100644 --- a/app/models/ticket/number.rb +++ b/app/models/ticket/number.rb @@ -20,7 +20,7 @@ returns # generate number (1..50_000).each { |i| number = adapter.generate - ticket = Ticket.where( :number => number ).first + ticket = Ticket.where( number: number ).first return number if !ticket } raise "Can't generate new ticket number!" diff --git a/app/models/ticket/number/date.rb b/app/models/ticket/number/date.rb index 1c880bd40..7d64ccc81 100644 --- a/app/models/ticket/number/date.rb +++ b/app/models/ticket/number/date.rb @@ -14,9 +14,9 @@ module Ticket::Number::Date # read counter counter_increment = nil Ticket::Counter.transaction do - counter = Ticket::Counter.where( :generator => 'Date' ).lock(true).first + counter = Ticket::Counter.where( generator: 'Date' ).lock(true).first if !counter - counter = Ticket::Counter.new( :generator => 'Date', :content => '0' ) + counter = Ticket::Counter.new( generator: 'Date', content: '0' ) end # increase counter @@ -74,9 +74,9 @@ module Ticket::Number::Date # probe format if string =~ /#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,50})/i then - ticket = Ticket.where( :number => $1 ).first + ticket = Ticket.where( number: $1 ).first elsif string =~ /#{ticket_hook}\s{0,2}(#{system_id}\d{2,50})/i then - ticket = Ticket.where( :number => $1 ).first + ticket = Ticket.where( number: $1 ).first end return ticket end diff --git a/app/models/ticket/number/increment.rb b/app/models/ticket/number/increment.rb index 5defeef37..2297eff73 100644 --- a/app/models/ticket/number/increment.rb +++ b/app/models/ticket/number/increment.rb @@ -12,9 +12,9 @@ module Ticket::Number::Increment min_digs = config[:min_size] || 4; counter_increment = nil Ticket::Counter.transaction do - counter = Ticket::Counter.where( :generator => 'Increment' ).lock(true).first + counter = Ticket::Counter.where( generator: 'Increment' ).lock(true).first if !counter - counter = Ticket::Counter.new( :generator => 'Increment', :content => '0' ) + counter = Ticket::Counter.new( generator: 'Increment', content: '0' ) end counter_increment = counter.content.to_i @@ -78,9 +78,9 @@ module Ticket::Number::Increment # probe format if string =~ /#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,48})/i then - ticket = Ticket.where( :number => $1 ).first + ticket = Ticket.where( number: $1 ).first elsif string =~ /#{ticket_hook}\s{0,2}(#{system_id}\d{2,48})/i then - ticket = Ticket.where( :number => $1 ).first + ticket = Ticket.where( number: $1 ).first end return ticket end diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index 94a79cd50..34caad2f5 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -22,9 +22,9 @@ returns if data[:current_user].is_role('Customer') role = data[:current_user].is_role( 'Customer' ) if data[:current_user].organization_id && data[:current_user].organization.shared - overviews = Overview.where( :role_id => role.id, :active => true ) + overviews = Overview.where( role_id: role.id, active: true ) else - overviews = Overview.where( :role_id => role.id, :organization_shared => false, :active => true ) + overviews = Overview.where( role_id: role.id, organization_shared: false, active: true ) end return overviews end @@ -32,7 +32,7 @@ returns # get agent overviews role = data[:current_user].is_role( 'Agent' ) return if !role - Overview.where( :role_id => role.id, :active => true ) + Overview.where( role_id: role.id, active: true ) end =begin @@ -126,17 +126,17 @@ returns overviews.each { |overview| # get count - count = Ticket.where( :group_id => group_ids ).where( _condition( overview.condition ) ).count() + count = Ticket.where( group_id: group_ids ).where( _condition( overview.condition ) ).count() # get meta info all = { - :name => overview.name, - :prio => overview.prio, - :link => overview.link, + name: overview.name, + prio: overview.prio, + link: overview.link, } # push to result data - result.push all.merge( { :count => count } ) + result.push all.merge( { count: count } ) } return result end @@ -148,7 +148,7 @@ returns order_by = overview_selected.group_by + '_id, ' + order_by end tickets = Ticket.select( 'id' ). - where( :group_id => group_ids ). + where( group_id: group_ids ). where( _condition( overview_selected.condition ) ). order( order_by ). limit( 500 ) @@ -158,33 +158,33 @@ returns ticket_ids.push ticket.id } - tickets_count = Ticket.where( :group_id => group_ids ). + tickets_count = Ticket.where( group_id: group_ids ). where( _condition( overview_selected.condition ) ). count() return { - :ticket_ids => ticket_ids, - :tickets_count => tickets_count, - :overview => overview_selected_raw, + ticket_ids: ticket_ids, + tickets_count: tickets_count, + overview: overview_selected_raw, } end # get tickets for overview data[:start_page] ||= 1 - tickets = Ticket.where( :group_id => group_ids ). + tickets = Ticket.where( group_id: group_ids ). where( _condition( overview_selected.condition ) ). order( overview_selected[:order][:by].to_s + ' ' + overview_selected[:order][:direction].to_s )#. # limit( overview_selected.view[ data[:view_mode].to_sym ][:per_page] ). # offset( overview_selected.view[ data[:view_mode].to_sym ][:per_page].to_i * ( data[:start_page].to_i - 1 ) ) - tickets_count = Ticket.where( :group_id => group_ids ). + tickets_count = Ticket.where( group_id: group_ids ). where( _condition( overview_selected.condition ) ). count() return { - :tickets => tickets, - :tickets_count => tickets_count, - :overview => overview_selected_raw, + tickets: tickets, + tickets_count: tickets_count, + overview: overview_selected_raw, } end diff --git a/app/models/ticket/priority.rb b/app/models/ticket/priority.rb index 384e4a68e..1c95ba2da 100644 --- a/app/models/ticket/priority.rb +++ b/app/models/ticket/priority.rb @@ -2,5 +2,5 @@ class Ticket::Priority < ApplicationModel self.table_name = 'ticket_priorities' - validates :name, :presence => true + validates :name, presence: true end diff --git a/app/models/ticket/screen_options.rb b/app/models/ticket/screen_options.rb index 5d68fd5f1..ee68149f9 100644 --- a/app/models/ticket/screen_options.rb +++ b/app/models/ticket/screen_options.rb @@ -15,7 +15,7 @@ returns =end def self.agents - User.where( :active => true ).joins(:roles).where( 'roles.name' => 'Agent', 'roles.active' => true ).uniq() + User.where( active: true ).joins(:roles).where( 'roles.name' => 'Agent', 'roles.active' => true ).uniq() end =begin @@ -63,7 +63,7 @@ returns state_ids.push params[:ticket].state.id end state_types.each {|type| - state_type = Ticket::StateType.where( :name => type ).first + state_type = Ticket::StateType.where( name: type ).first if state_type state_type.states.each {|state| assets = state.assets(assets) @@ -75,7 +75,7 @@ returns # get priorities priority_ids = [] - Ticket::Priority.where( :active => true ).each { |priority| + Ticket::Priority.where( active: true ).each { |priority| assets = priority.assets(assets) priority_ids.push priority.id } @@ -89,7 +89,7 @@ returns types.push 'email' end types.each {|type_name| - type = Ticket::Article::Type.lookup( :name => type_name ) + type = Ticket::Article::Type.lookup( name: type_name ) if type type_ids.push type.id end @@ -103,10 +103,10 @@ returns agents[ user.id ] = 1 } - dependencies = { :group_id => { '' => { :owner_id => [] } } } - Group.where( :active => true ).each { |group| + dependencies = { group_id: { '' => { owner_id: [] } } } + Group.where( active: true ).each { |group| assets = group.assets(assets) - dependencies[:group_id][group.id] = { :owner_id => [] } + dependencies[:group_id][group.id] = { owner_id: [] } group.users.each {|user| next if !agents[ user.id ] assets = user.assets(assets) @@ -115,9 +115,9 @@ returns } return { - :assets => assets, - :filter => filter, - :dependencies => dependencies, + assets: assets, + filter: filter, + dependencies: dependencies, } end @@ -148,8 +148,8 @@ returns # get tickets tickets_open = Ticket.where( - :customer_id => data[:customer_id], - :state_id => state_list_open + customer_id: data[:customer_id], + state_id: state_list_open ).limit( data[:limit] || 15 ).order('created_at DESC') assets = {} ticket_ids_open = [] @@ -159,8 +159,8 @@ returns } tickets_closed = Ticket.where( - :customer_id => data[:customer_id], - :state_id => state_list_closed + customer_id: data[:customer_id], + state_id: state_list_closed ).limit( data[:limit] || 15 ).order('created_at DESC') ticket_ids_closed = [] tickets_closed.each {|ticket| @@ -169,9 +169,9 @@ returns } return { - :ticket_ids_open => ticket_ids_open, - :ticket_ids_closed => ticket_ids_closed, - :assets => assets, + ticket_ids_open: ticket_ids_open, + ticket_ids_closed: ticket_ids_closed, + assets: assets, } end diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index 2fb6d8a5f..41ced1f6e 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -104,7 +104,7 @@ returns end tickets = [] items.each { |item| - tickets.push Ticket.lookup( :id => item[:id] ) + tickets.push Ticket.lookup( id: item[:id] ) } return tickets end @@ -141,7 +141,7 @@ returns tickets = [] tickets_all.each { |ticket| - tickets.push Ticket.lookup( :id => ticket.id ) + tickets.push Ticket.lookup( id: ticket.id ) } return tickets end diff --git a/app/models/ticket/search_index.rb b/app/models/ticket/search_index.rb index 519d5921d..8087673e9 100644 --- a/app/models/ticket/search_index.rb +++ b/app/models/ticket/search_index.rb @@ -20,9 +20,9 @@ returns # default ignored attributes ignore_attributes = { - :created_by_id => true, - :updated_by_id => true, - :active => true, + created_by_id: true, + updated_by_id: true, + active: true, } if self.class.search_index_support_config[:ignore_attributes] self.class.search_index_support_config[:ignore_attributes].each {|key, value| @@ -42,7 +42,7 @@ returns } # add tags - tags = Tag.tag_list( :object=> 'Ticket', :o_id => self.id ) + tags = Tag.tag_list( object: 'Ticket', o_id: self.id ) if tags && !tags.empty? attributes[:tag] = tags end @@ -57,7 +57,7 @@ returns attachment_max_size_in_mb = Setting.get('es_attachment_max_size_in_mb') || 40 # collect article data - articles = Ticket::Article.where( :ticket_id => self.id ) + articles = Ticket::Article.where( ticket_id: self.id ) attributes['articles'] = [] articles.each {|article| article_attributes = article.attributes diff --git a/app/models/ticket/state.rb b/app/models/ticket/state.rb index 8987a994f..cdc42d0ec 100644 --- a/app/models/ticket/state.rb +++ b/app/models/ticket/state.rb @@ -1,8 +1,8 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Ticket::State < ApplicationModel - belongs_to :state_type, :class_name => 'Ticket::StateType' - validates :name, :presence => true + belongs_to :state_type, class_name: 'Ticket::StateType' + validates :name, presence: true latest_change_support @@ -21,11 +21,11 @@ returns: def self.by_category(category) if category == 'open' return Ticket::State.where( - :state_type_id => Ticket::StateType.where( :name => ['new', 'open', 'pending reminder', 'pending action'] ) + state_type_id: Ticket::StateType.where( name: ['new', 'open', 'pending reminder', 'pending action'] ) ) elsif category == 'closed' return Ticket::State.where( - :state_type_id => Ticket::StateType.where( :name => ['closed'] ) + state_type_id: Ticket::StateType.where( name: ['closed'] ) ) end raise "Unknown category '#{category}'" diff --git a/app/models/ticket/state_type.rb b/app/models/ticket/state_type.rb index 162b014e1..679784791 100644 --- a/app/models/ticket/state_type.rb +++ b/app/models/ticket/state_type.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ class Ticket::StateType < ApplicationModel - has_many :states, :class_name => 'Ticket::State' - validates :name, :presence => true + has_many :states, class_name: 'Ticket::State' + validates :name, presence: true latest_change_support end \ No newline at end of file diff --git a/app/models/token.rb b/app/models/token.rb index a5c1c338a..b48d34aa5 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -8,7 +8,7 @@ class Token < ActiveRecord::Base def self.check( data ) # fetch token - token = Token.where( :action => data[:action], :name => data[:name] ).first + token = Token.where( action: data[:action], name: data[:name] ).first return if !token # check if token is still valid @@ -29,6 +29,6 @@ class Token < ActiveRecord::Base def generate_token begin self.name = SecureRandom.hex(20) - end while Token.exists?( :name => self.name ) + end while Token.exists?( name: self.name ) end end diff --git a/app/models/translation.rb b/app/models/translation.rb index bce8448db..eab31a644 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -23,7 +23,7 @@ load translations from online url, {}, { - :json => true, + json: true, } ) raise "Can't load translations from #{url}: #{result.error}" if !result.success? @@ -31,7 +31,7 @@ load translations from online #puts translation.inspect # handle case insensitive sql - exists = Translation.where(:locale => translation['locale'], :format => translation['format'], :source => translation['source']) + exists = Translation.where(locale: translation['locale'], format: translation['format'], source: translation['source']) translaten = nil exists.each {|item| if item.source == translation['source'] @@ -61,7 +61,7 @@ push translations to online def self.push(locale) # only push changed translations - translations = Translation.where(:locale => locale) + translations = Translation.where(locale: locale) translations_to_push = [] translations.each {|translation| if translation.target != translation.target_initial @@ -76,13 +76,13 @@ push translations to online result = UserAgent.post( url, { - :locale => locale, - :translations => translations_to_push, - :fqdn => Setting.get('fqdn'), - :translator_key => '', + locale: locale, + translations: translations_to_push, + fqdn: Setting.get('fqdn'), + translator_key: '', }, { - :json => true, + json: true, } ) raise "Can't push translations to #{url}: #{result.error}" if !result.success? @@ -105,7 +105,7 @@ get list of translations end if !list list = [] - translations = Translation.where( :locale => locale.downcase ).order( :source ) + translations = Translation.where( locale: locale.downcase ).order( :source ) translations.each { |item| if admin data = [ @@ -134,7 +134,7 @@ get list of translations end return { - :list => list, + list: list, } end @@ -149,13 +149,13 @@ translate strings in ruby context, e. g. for notifications def self.translate(locale, string) # translate string - records = Translation.where( :locale => locale, :source => string ) + records = Translation.where( locale: locale, source: string ) records.each {|record| return record.target if record.source == string } # fallback lookup in en - records = Translation.where( :locale => 'en', :source => string ) + records = Translation.where( locale: 'en', source: string ) records.each {|record| return record.target if record.source == string } diff --git a/app/models/type_lookup.rb b/app/models/type_lookup.rb index 05f9a6da6..e8a1ac4fe 100644 --- a/app/models/type_lookup.rb +++ b/app/models/type_lookup.rb @@ -9,7 +9,7 @@ class TypeLookup < ApplicationModel return @@cache_object[ id ] if @@cache_object[ id ] # lookup - lookup = self.lookup( :id => id ) + lookup = self.lookup( id: id ) return if !lookup @@cache_object[ id ] = lookup.name lookup.name @@ -21,7 +21,7 @@ class TypeLookup < ApplicationModel return @@cache_object[ name ] if @@cache_object[ name ] # lookup - lookup = self.lookup( :name => name ) + lookup = self.lookup( name: name ) if lookup @@cache_object[ name ] = lookup.id return lookup.id @@ -29,7 +29,7 @@ class TypeLookup < ApplicationModel # create lookup = self.create( - :name => name + name: name ) @@cache_object[ name ] = lookup.id lookup.id diff --git a/app/models/user.rb b/app/models/user.rb index 48211a8ae..3cb7aa050 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,38 +37,38 @@ class User < ApplicationModel after_destroy :avatar_destroy notify_clients_support - has_and_belongs_to_many :groups, :after_add => :cache_update, :after_remove => :cache_update - has_and_belongs_to_many :roles, :after_add => :cache_update, :after_remove => :cache_update - has_and_belongs_to_many :organizations, :after_add => :cache_update, :after_remove => :cache_update - has_many :tokens, :after_add => :cache_update, :after_remove => :cache_update - has_many :authorizations, :after_add => :cache_update, :after_remove => :cache_update - belongs_to :organization, :class_name => 'Organization' + has_and_belongs_to_many :groups, after_add: :cache_update, after_remove: :cache_update + has_and_belongs_to_many :roles, after_add: :cache_update, after_remove: :cache_update + has_and_belongs_to_many :organizations, after_add: :cache_update, after_remove: :cache_update + has_many :tokens, after_add: :cache_update, after_remove: :cache_update + has_many :authorizations, after_add: :cache_update, after_remove: :cache_update + belongs_to :organization, class_name: 'Organization' store :preferences activity_stream_support( - :role => Z_ROLENAME_ADMIN, - :ignore_attributes => { - :last_login => true, - :image => true, - :image_source => true, + role: Z_ROLENAME_ADMIN, + ignore_attributes: { + last_login: true, + image: true, + image_source: true, } ) history_support( - :ignore_attributes => { - :password => true, - :image => true, - :image_source => true, + ignore_attributes: { + password: true, + image: true, + image_source: true, } ) search_index_support( - :ignore_attributes => { - :password => true, - :image => true, - :image_source => true, - :source => true, - :login_failed => true, - :preferences => true, + ignore_attributes: { + password: true, + image: true, + image_source: true, + source: true, + login_failed: true, + preferences: true, } ) @@ -160,8 +160,8 @@ returns assets = ApplicationModel.assets_of_object_list(activity_stream) return { - :activity_stream => activity_stream, - :assets => assets, + activity_stream: activity_stream, + assets: assets, } end @@ -184,11 +184,11 @@ returns return if !password || password == '' # try to find user based on login - user = User.where( :login => username.downcase, :active => true ).first + user = User.where( login: username.downcase, active: true ).first # try second lookup with email if !user - user = User.where( :email => username.downcase, :active => true ).first + user = User.where( email: username.downcase, active: true ).first end # check failed logins @@ -248,18 +248,18 @@ returns if hash['info']['urls'] then url = hash['info']['urls']['Website'] || hash['info']['urls']['Twitter'] || '' end - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) self.create( - :login => hash['info']['nickname'] || hash['uid'], - :firstname => hash['info']['name'], - :email => hash['info']['email'], - :image => hash['info']['image'], + login: hash['info']['nickname'] || hash['uid'], + firstname: hash['info']['name'], + email: hash['info']['email'], + image: hash['info']['image'], # :url => url.to_s, - :note => hash['info']['description'], - :source => hash['provider'], - :roles => roles, - :updated_by_id => 1, - :created_by_id => 1, + note: hash['info']['description'], + source: hash['provider'], + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) end @@ -279,11 +279,11 @@ returns return if !username || username == '' # try to find user based on login - user = User.where( :login => username.downcase, :active => true ).first + user = User.where( login: username.downcase, active: true ).first # try second lookup with email if !user - user = User.where( :email => username.downcase, :active => true ).first + user = User.where( email: username.downcase, active: true ).first end # check if email address exists @@ -291,7 +291,7 @@ returns return if !user.email # generate token - token = Token.create( :action => 'PasswordReset', :user_id => user.id ) + token = Token.create( action: 'PasswordReset', user_id: user.id ) # send mail data = {} @@ -313,20 +313,20 @@ Your #{config.product_name} Team' # prepare subject & body [:subject, :body].each { |key| data[key.to_sym] = NotificationFactory.build( - :locale => user.preferences[:locale], - :string => data[key.to_sym], - :objects => { - :token => token, - :user => user, + locale: user.preferences[:locale], + string: data[key.to_sym], + objects: { + token: token, + user: user, } ) } # send notification NotificationFactory.send( - :recipient => user, - :subject => data[:subject], - :body => data[:body] + recipient: user, + subject: data[:subject], + body: data[:body] ) token end @@ -344,7 +344,7 @@ returns =end def self.password_reset_check(token) - user = Token.check( :action => 'PasswordReset', :name => token ) + user = Token.check( action: 'PasswordReset', name: token ) # reset login failed if token is valid if user @@ -369,14 +369,14 @@ returns def self.password_reset_via_token(token,password) # check token - user = Token.check( :action => 'PasswordReset', :name => token ) + user = Token.check( action: 'PasswordReset', name: token ) return if !user # reset password - user.update_attributes( :password => password ) + user.update_attributes( password: password ) # delete token - Token.where( :action => 'PasswordReset', :name => token ).first.destroy + Token.where( action: 'PasswordReset', name: token ).first.destroy user end @@ -473,7 +473,7 @@ returns self.login = self.login.downcase check = true while check - exists = User.where( :login => self.login ).first + exists = User.where( login: self.login ).first if exists && exists.id != self.id self.login = self.login + rand(999).to_s else @@ -490,12 +490,12 @@ returns # save/update avatar avatar = Avatar.auto_detection( - :object => 'User', - :o_id => self.id, - :url => self.email, - :source => 'app', - :updated_by_id => self.updated_by_id, - :created_by_id => self.updated_by_id, + object: 'User', + o_id: self.id, + url: self.email, + source: 'app', + updated_by_id: self.updated_by_id, + created_by_id: self.updated_by_id, ) # update user link diff --git a/app/models/user/assets.rb b/app/models/user/assets.rb index 03e848747..227490710 100644 --- a/app/models/user/assets.rb +++ b/app/models/user/assets.rb @@ -36,8 +36,8 @@ returns authorizations = self.authorizations() authorizations.each do | authorization | attributes['accounts'][authorization.provider] = { - :uid => authorization[:uid], - :username => authorization[:username] + uid: authorization[:uid], + username: authorization[:username] } end @@ -46,7 +46,7 @@ returns # get roles if attributes['role_ids'] attributes['role_ids'].each {|role_id| - role = Role.lookup( :id => role_id ) + role = Role.lookup( id: role_id ) data = role.assets( data ) } end @@ -54,7 +54,7 @@ returns # get groups if attributes['group_ids'] attributes['group_ids'].each {|group_id| - group = Group.lookup( :id => group_id ) + group = Group.lookup( id: group_id ) data = group.assets( data ) } end @@ -62,21 +62,21 @@ returns # get groups if attributes['organization_ids'] attributes['organization_ids'].each {|organization_id| - organization = Organization.lookup( :id => organization_id ) + organization = Organization.lookup( id: organization_id ) data = organization.assets( data ) } end end if self.organization_id if !data[ Organization.to_app_model ] || !data[ Organization.to_app_model ][ self.organization_id ] - organization = Organization.lookup( :id => self.organization_id ) + organization = Organization.lookup( id: self.organization_id ) data = organization.assets( data ) end end ['created_by_id', 'updated_by_id'].each {|item| if self[ item ] if !data[ User.to_app_model ][ self[ item ] ] - user = User.lookup( :id => self[ item ] ) + user = User.lookup( id: self[ item ] ) data = user.assets( data ) end end diff --git a/app/models/user/search.rb b/app/models/user/search.rb index 16192d2ae..41ea0db2c 100644 --- a/app/models/user/search.rb +++ b/app/models/user/search.rb @@ -33,7 +33,7 @@ returns items = SearchIndexBackend.search( query, limit, 'User' ) users = [] items.each { |item| - users.push User.lookup( :id => item[:id] ) + users.push User.lookup( id: item[:id] ) } return users end diff --git a/config/application.rb b/config/application.rb index de8919d17..37d2f5941 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) + Bundler.require(*Rails.groups(assets: %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end diff --git a/config/environments/development.rb b/config/environments/development.rb index aff97c145..495dcbd9b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -32,10 +32,10 @@ Zammad::Application.configure do # Automatically inject JavaScript needed for LiveReload config.middleware.use(Rack::LiveReload, - :min_delay => 500, # default 1000 - :max_delay => 10_000, # default 60_000 - :live_reload_port => 35_738, - :source => :vendored + min_delay: 500, # default 1000 + max_delay: 10_000, # default 60_000 + live_reload_port: 35_738, + source: :vendored ) # define cache store diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 1f1af61d6..d4279d7b7 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -2,7 +2,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do # twitter database connect provider :twitter_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse', - :client_options => { :authorize_path => '/oauth/authorize', :site => 'https://api.twitter.com' } + client_options: { authorize_path: '/oauth/authorize', site: 'https://api.twitter.com' } # facebook database connect provider :facebook_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse' @@ -12,6 +12,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do # google database connect provider :google_oauth2_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse', - :authorize_options => { :access_type => 'online', :approval_prompt => '' } + authorize_options: { access_type: 'online', approval_prompt: '' } end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index eee49a519..b8aef91aa 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -6,5 +6,5 @@ # which shouldn't be used to store highly confidential information # (create the session table with "rails generate session_migration") Zammad::Application.config.session_store :active_record_store, { - :key => '_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s).to_s[5..15] + key: '_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s).to_s[5..15] } diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index da4fb076f..999df2018 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,7 +5,7 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] + wrap_parameters format: [:json] end # Disable root element in JSON by default. diff --git a/config/routes.rb b/config/routes.rb index 2228cda49..da0be492b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,12 +1,12 @@ Zammad::Application.routes.draw do # app init - match '/init', :to => 'init#index', :via => :get - match '/app', :to => 'init#index', :via => :get + match '/init', to: 'init#index', via: :get + match '/app', to: 'init#index', via: :get # You can have the root of your site routed with "root" # just remember to delete public/index.html. - root :to => 'init#index', :via => :get + root to: 'init#index', via: :get # load routes from external files dir = File.expand_path('../', __FILE__) diff --git a/config/routes/activity_stream.rb b/config/routes/activity_stream.rb index 0d7194c6d..7ff765d0b 100644 --- a/config/routes/activity_stream.rb +++ b/config/routes/activity_stream.rb @@ -1,6 +1,6 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path - match api_path + '/activity_stream', :to => 'activity_stream#show', :via => :get + match api_path + '/activity_stream', to: 'activity_stream#show', via: :get end \ No newline at end of file diff --git a/config/routes/auth.rb b/config/routes/auth.rb index 31b6717fd..733d94a5f 100644 --- a/config/routes/auth.rb +++ b/config/routes/auth.rb @@ -2,19 +2,19 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # omniauth - match '/auth/:provider/callback', :to => 'sessions#create_omniauth', :via => [:post, :get, :puts, :delete] + match '/auth/:provider/callback', to: 'sessions#create_omniauth', via: [:post, :get, :puts, :delete] # sso - match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get] + match '/auth/sso', to: 'sessions#create_sso', via: [:post, :get] # sessions - match api_path + '/signin', :to => 'sessions#create', :via => :post - match api_path + '/signshow', :to => 'sessions#show', :via => :get - match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete] + match api_path + '/signin', to: 'sessions#create', via: :post + match api_path + '/signshow', to: 'sessions#show', via: :get + match api_path + '/signout', to: 'sessions#destroy', via: [:get, :delete] - match api_path + '/sessions/switch/:id', :to => 'sessions#switch_to_user', :via => :get - match api_path + '/sessions/switch_back', :to => 'sessions#switch_back_to_user', :via => :get - match api_path + '/sessions', :to => 'sessions#list', :via => :get - match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete + match api_path + '/sessions/switch/:id', to: 'sessions#switch_to_user', via: :get + match api_path + '/sessions/switch_back', to: 'sessions#switch_back_to_user', via: :get + match api_path + '/sessions', to: 'sessions#list', via: :get + match api_path + '/sessions/:id', to: 'sessions#delete', via: :delete end \ No newline at end of file diff --git a/config/routes/channel.rb b/config/routes/channel.rb index 2939a3773..e9cf82143 100644 --- a/config/routes/channel.rb +++ b/config/routes/channel.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # channels - match api_path + '/channels', :to => 'channels#index', :via => :get - match api_path + '/channels/:id', :to => 'channels#show', :via => :get - match api_path + '/channels', :to => 'channels#create', :via => :post - match api_path + '/channels/:id', :to => 'channels#update', :via => :put - match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete + match api_path + '/channels', to: 'channels#index', via: :get + match api_path + '/channels/:id', to: 'channels#show', via: :get + match api_path + '/channels', to: 'channels#create', via: :post + match api_path + '/channels/:id', to: 'channels#update', via: :put + match api_path + '/channels/:id', to: 'channels#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/email_address.rb b/config/routes/email_address.rb index 986bb2f26..99f0e6de1 100644 --- a/config/routes/email_address.rb +++ b/config/routes/email_address.rb @@ -2,9 +2,9 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # groups - match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get - match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get - match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post - match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put + match api_path + '/email_addresses', to: 'email_addresses#index', via: :get + match api_path + '/email_addresses/:id', to: 'email_addresses#show', via: :get + match api_path + '/email_addresses', to: 'email_addresses#create', via: :post + match api_path + '/email_addresses/:id', to: 'email_addresses#update', via: :put end \ No newline at end of file diff --git a/config/routes/getting_started.rb b/config/routes/getting_started.rb index b12ff6481..0cdbe97f8 100644 --- a/config/routes/getting_started.rb +++ b/config/routes/getting_started.rb @@ -2,11 +2,11 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # getting_started - match api_path + '/getting_started', :to => 'getting_started#index', :via => :get - match api_path + '/getting_started/base', :to => 'getting_started#base', :via => :post - match api_path + '/getting_started/email_probe', :to => 'getting_started#email_probe', :via => :post - match api_path + '/getting_started/email_outbound', :to => 'getting_started#email_outbound', :via => :post - match api_path + '/getting_started/email_inbound', :to => 'getting_started#email_inbound', :via => :post - match api_path + '/getting_started/email_verify', :to => 'getting_started#email_verify', :via => :post + match api_path + '/getting_started', to: 'getting_started#index', via: :get + match api_path + '/getting_started/base', to: 'getting_started#base', via: :post + match api_path + '/getting_started/email_probe', to: 'getting_started#email_probe', via: :post + match api_path + '/getting_started/email_outbound', to: 'getting_started#email_outbound', via: :post + match api_path + '/getting_started/email_inbound', to: 'getting_started#email_inbound', via: :post + match api_path + '/getting_started/email_verify', to: 'getting_started#email_verify', via: :post end \ No newline at end of file diff --git a/config/routes/group.rb b/config/routes/group.rb index 1ae094968..4c3340c84 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -2,9 +2,9 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # groups - match api_path + '/groups', :to => 'groups#index', :via => :get - match api_path + '/groups/:id', :to => 'groups#show', :via => :get - match api_path + '/groups', :to => 'groups#create', :via => :post - match api_path + '/groups/:id', :to => 'groups#update', :via => :put + match api_path + '/groups', to: 'groups#index', via: :get + match api_path + '/groups/:id', to: 'groups#show', via: :get + match api_path + '/groups', to: 'groups#create', via: :post + match api_path + '/groups/:id', to: 'groups#update', via: :put end \ No newline at end of file diff --git a/config/routes/ical_tickets.rb b/config/routes/ical_tickets.rb index b5cd0a9f0..507e42790 100644 --- a/config/routes/ical_tickets.rb +++ b/config/routes/ical_tickets.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # ical ticket - match api_path + '/ical/tickets/:action_token', :to => 'ical_tickets#all', :via => :get - match api_path + '/ical/tickets_new_open/:action_token', :to => 'ical_tickets#new_open', :via => :get - match api_path + '/ical/tickets_pending/:action_token', :to => 'ical_tickets#pending', :via => :get - match api_path + '/ical/tickets_escalation/:action_token', :to => 'ical_tickets#escalation', :via => :get + match api_path + '/ical/tickets/:action_token', to: 'ical_tickets#all', via: :get + match api_path + '/ical/tickets_new_open/:action_token', to: 'ical_tickets#new_open', via: :get + match api_path + '/ical/tickets_pending/:action_token', to: 'ical_tickets#pending', via: :get + match api_path + '/ical/tickets_escalation/:action_token', to: 'ical_tickets#escalation', via: :get end \ No newline at end of file diff --git a/config/routes/import_otrs.rb b/config/routes/import_otrs.rb index 8b8c58079..f9c0af468 100644 --- a/config/routes/import_otrs.rb +++ b/config/routes/import_otrs.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # import otrs - match api_path + '/import/otrs/url_check', :to => 'import_otrs#url_check', :via => :post - match api_path + '/import/otrs/import_start', :to => 'import_otrs#import_start', :via => :post - match api_path + '/import/otrs/import_status', :to => 'import_otrs#import_status', :via => :get + match api_path + '/import/otrs/url_check', to: 'import_otrs#url_check', via: :post + match api_path + '/import/otrs/import_start', to: 'import_otrs#import_start', via: :post + match api_path + '/import/otrs/import_status', to: 'import_otrs#import_status', via: :get end \ No newline at end of file diff --git a/config/routes/job.rb b/config/routes/job.rb index 7e3d0a4e7..5810bfd14 100644 --- a/config/routes/job.rb +++ b/config/routes/job.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # jobs - match api_path + '/jobs', :to => 'jobs#index', :via => :get - match api_path + '/jobs/:id', :to => 'jobs#show', :via => :get - match api_path + '/jobs', :to => 'jobs#create', :via => :post - match api_path + '/jobs/:id', :to => 'jobs#update', :via => :put - match api_path + '/jobs/:id', :to => 'jobs#destroy', :via => :delete + match api_path + '/jobs', to: 'jobs#index', via: :get + match api_path + '/jobs/:id', to: 'jobs#show', via: :get + match api_path + '/jobs', to: 'jobs#create', via: :post + match api_path + '/jobs/:id', to: 'jobs#update', via: :put + match api_path + '/jobs/:id', to: 'jobs#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/link.rb b/config/routes/link.rb index 4db9d8283..7288e0c1c 100644 --- a/config/routes/link.rb +++ b/config/routes/link.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # links - match api_path + '/links', :to => 'links#index', :via => :get - match api_path + '/links/add', :to => 'links#add', :via => :get - match api_path + '/links/remove', :to => 'links#remove', :via => :get + match api_path + '/links', to: 'links#index', via: :get + match api_path + '/links/add', to: 'links#add', via: :get + match api_path + '/links/remove', to: 'links#remove', via: :get end \ No newline at end of file diff --git a/config/routes/message.rb b/config/routes/message.rb index 4071ff9eb..f5114062c 100644 --- a/config/routes/message.rb +++ b/config/routes/message.rb @@ -2,7 +2,7 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # messages - match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ] - match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ] + match api_path + '/message_send', to: 'long_polling#message_send', via: [ :get, :post ] + match api_path + '/message_receive', to: 'long_polling#message_receive', via: [ :get, :post ] end \ No newline at end of file diff --git a/config/routes/network.rb b/config/routes/network.rb index a54cca873..cbdda0645 100644 --- a/config/routes/network.rb +++ b/config/routes/network.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # networkss - match api_path + '/networks', :to => 'networks#index', :via => :get - match api_path + '/networks/:id', :to => 'networks#show', :via => :get - match api_path + '/networks', :to => 'networks#create', :via => :post - match api_path + '/networks/:id', :to => 'networks#update', :via => :put - match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete + match api_path + '/networks', to: 'networks#index', via: :get + match api_path + '/networks/:id', to: 'networks#show', via: :get + match api_path + '/networks', to: 'networks#create', via: :post + match api_path + '/networks/:id', to: 'networks#update', via: :put + match api_path + '/networks/:id', to: 'networks#destroy',via: :delete end \ No newline at end of file diff --git a/config/routes/object_manager_attribute.rb b/config/routes/object_manager_attribute.rb index f5c37f0ca..7571dfcb5 100644 --- a/config/routes/object_manager_attribute.rb +++ b/config/routes/object_manager_attribute.rb @@ -2,11 +2,11 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # object_manager - match api_path + '/object_manager_attributes_list', :to => 'object_manager_attributes#list', :via => :get - match api_path + '/object_manager_attributes', :to => 'object_manager_attributes#index', :via => :get - match api_path + '/object_manager_attributes/:id', :to => 'object_manager_attributes#show', :via => :get - match api_path + '/object_manager_attributes', :to => 'object_manager_attributes#create', :via => :post - match api_path + '/object_manager_attributes/:id', :to => 'object_manager_attributes#update', :via => :put - match api_path + '/object_manager_attributes/:id', :to => 'object_manager_attributes#destroy', :via => :delete + match api_path + '/object_manager_attributes_list', to: 'object_manager_attributes#list', via: :get + match api_path + '/object_manager_attributes', to: 'object_manager_attributes#index', via: :get + match api_path + '/object_manager_attributes/:id', to: 'object_manager_attributes#show', via: :get + match api_path + '/object_manager_attributes', to: 'object_manager_attributes#create', via: :post + match api_path + '/object_manager_attributes/:id', to: 'object_manager_attributes#update', via: :put + match api_path + '/object_manager_attributes/:id', to: 'object_manager_attributes#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/online_notification.rb b/config/routes/online_notification.rb index 6c3a6d8fb..c34e81e55 100644 --- a/config/routes/online_notification.rb +++ b/config/routes/online_notification.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # groups - match api_path + '/online_notifications', :to => 'online_notifications#index', :via => :get - match api_path + '/online_notifications/:id', :to => 'online_notifications#update', :via => :put - match api_path + '/online_notifications/mark_all_as_read', :to => 'online_notifications#mark_all_as_read', :via => :post + match api_path + '/online_notifications', to: 'online_notifications#index', via: :get + match api_path + '/online_notifications/:id', to: 'online_notifications#update', via: :put + match api_path + '/online_notifications/mark_all_as_read', to: 'online_notifications#mark_all_as_read', via: :post end \ No newline at end of file diff --git a/config/routes/organization.rb b/config/routes/organization.rb index 7181e6cf3..029197ee6 100644 --- a/config/routes/organization.rb +++ b/config/routes/organization.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # organizations - match api_path + '/organizations', :to => 'organizations#index', :via => :get - match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get - match api_path + '/organizations', :to => 'organizations#create', :via => :post - match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put - match api_path + '/organizations/history/:id',:to => 'organizations#history',:via => :get + match api_path + '/organizations', to: 'organizations#index', via: :get + match api_path + '/organizations/:id', to: 'organizations#show', via: :get + match api_path + '/organizations', to: 'organizations#create', via: :post + match api_path + '/organizations/:id', to: 'organizations#update', via: :put + match api_path + '/organizations/history/:id',to: 'organizations#history',via: :get end \ No newline at end of file diff --git a/config/routes/overview.rb b/config/routes/overview.rb index 819a806a8..383128cbd 100644 --- a/config/routes/overview.rb +++ b/config/routes/overview.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # overviews - match api_path + '/overviews', :to => 'overviews#index', :via => :get - match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get - match api_path + '/overviews', :to => 'overviews#create', :via => :post - match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put - match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete + match api_path + '/overviews', to: 'overviews#index', via: :get + match api_path + '/overviews/:id', to: 'overviews#show', via: :get + match api_path + '/overviews', to: 'overviews#create', via: :post + match api_path + '/overviews/:id', to: 'overviews#update', via: :put + match api_path + '/overviews/:id', to: 'overviews#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/package.rb b/config/routes/package.rb index 6ea4ff9ab..aeff15cd9 100644 --- a/config/routes/package.rb +++ b/config/routes/package.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # overviews - match api_path + '/packages', :to => 'packages#index', :via => :get - match api_path + '/packages', :to => 'packages#install', :via => :post - match api_path + '/packages', :to => 'packages#uninstall', :via => :delete + match api_path + '/packages', to: 'packages#index', via: :get + match api_path + '/packages', to: 'packages#install', via: :post + match api_path + '/packages', to: 'packages#uninstall', via: :delete end \ No newline at end of file diff --git a/config/routes/postmaster_filter.rb b/config/routes/postmaster_filter.rb index b8b9dd35f..701e96963 100644 --- a/config/routes/postmaster_filter.rb +++ b/config/routes/postmaster_filter.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # postmaster_filters - match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get - match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get - match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post - match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put - match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete + match api_path + '/postmaster_filters', to: 'postmaster_filters#index', via: :get + match api_path + '/postmaster_filters/:id', to: 'postmaster_filters#show', via: :get + match api_path + '/postmaster_filters', to: 'postmaster_filters#create', via: :post + match api_path + '/postmaster_filters/:id', to: 'postmaster_filters#update', via: :put + match api_path + '/postmaster_filters/:id', to: 'postmaster_filters#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/recent_view.rb b/config/routes/recent_view.rb index 3b959f82f..3162182ee 100644 --- a/config/routes/recent_view.rb +++ b/config/routes/recent_view.rb @@ -1,6 +1,6 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path - match api_path + '/recent_view', :to => 'recent_view#index', :via => :get - match api_path + '/recent_view', :to => 'recent_view#create', :via => :post + match api_path + '/recent_view', to: 'recent_view#index', via: :get + match api_path + '/recent_view', to: 'recent_view#create', via: :post end \ No newline at end of file diff --git a/config/routes/role.rb b/config/routes/role.rb index 81c0596fc..15d02a4b2 100644 --- a/config/routes/role.rb +++ b/config/routes/role.rb @@ -2,9 +2,9 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # roles - match api_path + '/roles', :to => 'roles#index', :via => :get - match api_path + '/roles/:id', :to => 'roles#show', :via => :get - match api_path + '/roles', :to => 'roles#create', :via => :post - match api_path + '/roles/:id', :to => 'roles#update', :via => :put + match api_path + '/roles', to: 'roles#index', via: :get + match api_path + '/roles/:id', to: 'roles#show', via: :get + match api_path + '/roles', to: 'roles#create', via: :post + match api_path + '/roles/:id', to: 'roles#update', via: :put end \ No newline at end of file diff --git a/config/routes/rss.rb b/config/routes/rss.rb index aff1aa2fd..682da0dd7 100644 --- a/config/routes/rss.rb +++ b/config/routes/rss.rb @@ -2,6 +2,6 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # rss - match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get + match api_path + '/rss_fetch', to: 'rss#fetch', via: :get end \ No newline at end of file diff --git a/config/routes/search.rb b/config/routes/search.rb index dc5e42916..a41ab3a2d 100644 --- a/config/routes/search.rb +++ b/config/routes/search.rb @@ -2,9 +2,9 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # search - match api_path + '/search', :to => 'search#search', :via => [:get, :post] + match api_path + '/search', to: 'search#search', via: [:get, :post] # search_user_org - match api_path + '/search_user_org', :to => 'search#search_user_org', :via => [:get, :post] + match api_path + '/search_user_org', to: 'search#search_user_org', via: [:get, :post] end \ No newline at end of file diff --git a/config/routes/setting.rb b/config/routes/setting.rb index ad739dc72..451efa9a9 100644 --- a/config/routes/setting.rb +++ b/config/routes/setting.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # base objects - match api_path + '/settings', :to => 'settings#index', :via => :get - match api_path + '/settings/:id', :to => 'settings#show', :via => :get - match api_path + '/settings', :to => 'settings#create', :via => :post - match api_path + '/settings/:id', :to => 'settings#update', :via => :put - match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete + match api_path + '/settings', to: 'settings#index', via: :get + match api_path + '/settings/:id', to: 'settings#show', via: :get + match api_path + '/settings', to: 'settings#create', via: :post + match api_path + '/settings/:id', to: 'settings#update', via: :put + match api_path + '/settings/:id', to: 'settings#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/signature.rb b/config/routes/signature.rb index a771634e3..241177a2a 100644 --- a/config/routes/signature.rb +++ b/config/routes/signature.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # signatures - match api_path + '/signatures', :to => 'signatures#index', :via => :get - match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get - match api_path + '/signatures', :to => 'signatures#create', :via => :post - match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put - match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete + match api_path + '/signatures', to: 'signatures#index', via: :get + match api_path + '/signatures/:id', to: 'signatures#show', via: :get + match api_path + '/signatures', to: 'signatures#create', via: :post + match api_path + '/signatures/:id', to: 'signatures#update', via: :put + match api_path + '/signatures/:id', to: 'signatures#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/sla.rb b/config/routes/sla.rb index 900695e27..3f98d90ca 100644 --- a/config/routes/sla.rb +++ b/config/routes/sla.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # slas - match api_path + '/slas', :to => 'slas#index', :via => :get - match api_path + '/slas/:id', :to => 'slas#show', :via => :get - match api_path + '/slas', :to => 'slas#create', :via => :post - match api_path + '/slas/:id', :to => 'slas#update', :via => :put - match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete + match api_path + '/slas', to: 'slas#index', via: :get + match api_path + '/slas/:id', to: 'slas#show', via: :get + match api_path + '/slas', to: 'slas#create', via: :post + match api_path + '/slas/:id', to: 'slas#update', via: :put + match api_path + '/slas/:id', to: 'slas#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/tag.rb b/config/routes/tag.rb index f37c59686..5baa44327 100644 --- a/config/routes/tag.rb +++ b/config/routes/tag.rb @@ -2,8 +2,8 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # links - match api_path + '/tags', :to => 'tags#list', :via => :get - match api_path + '/tags/add', :to => 'tags#add', :via => :get - match api_path + '/tags/remove', :to => 'tags#remove', :via => :get + match api_path + '/tags', to: 'tags#list', via: :get + match api_path + '/tags/add', to: 'tags#add', via: :get + match api_path + '/tags/remove', to: 'tags#remove', via: :get end \ No newline at end of file diff --git a/config/routes/taskbar.rb b/config/routes/taskbar.rb index 499bf2291..a948ec81b 100644 --- a/config/routes/taskbar.rb +++ b/config/routes/taskbar.rb @@ -1,10 +1,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path - match api_path + '/taskbar', :to => 'taskbar#index', :via => :get - match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get - match api_path + '/taskbar', :to => 'taskbar#create', :via => :post - match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put - match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete + match api_path + '/taskbar', to: 'taskbar#index', via: :get + match api_path + '/taskbar/:id', to: 'taskbar#show', via: :get + match api_path + '/taskbar', to: 'taskbar#create', via: :post + match api_path + '/taskbar/:id', to: 'taskbar#update', via: :put + match api_path + '/taskbar/:id', to: 'taskbar#destroy',via: :delete end \ No newline at end of file diff --git a/config/routes/template.rb b/config/routes/template.rb index c0c5b0755..dcb08c447 100644 --- a/config/routes/template.rb +++ b/config/routes/template.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # templates - match api_path + '/templates', :to => 'templates#index', :via => :get - match api_path + '/templates/:id', :to => 'templates#show', :via => :get - match api_path + '/templates', :to => 'templates#create', :via => :post - match api_path + '/templates/:id', :to => 'templates#update', :via => :put - match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete + match api_path + '/templates', to: 'templates#index', via: :get + match api_path + '/templates/:id', to: 'templates#show', via: :get + match api_path + '/templates', to: 'templates#create', via: :post + match api_path + '/templates/:id', to: 'templates#update', via: :put + match api_path + '/templates/:id', to: 'templates#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/test.rb b/config/routes/test.rb index 541bb2e65..0583987d0 100644 --- a/config/routes/test.rb +++ b/config/routes/test.rb @@ -1,15 +1,15 @@ Zammad::Application.routes.draw do - match '/tests-core', :to => 'tests#core', :via => :get - match '/tests-ui', :to => 'tests#ui', :via => :get - match '/tests-model', :to => 'tests#model', :via => :get - match '/tests-model-ui', :to => 'tests#model_ui', :via => :get - match '/tests-form', :to => 'tests#form', :via => :get - match '/tests-form-extended', :to => 'tests#form_extended', :via => :get - match '/tests-form-validation', :to => 'tests#form_validation', :via => :get - match '/tests-table', :to => 'tests#table', :via => :get - match '/tests-html-utils', :to => 'tests#html_utils', :via => :get - match '/tests-taskbar', :to => 'tests#taskbar', :via => :get - match '/tests/wait/:sec', :to => 'tests#wait', :via => :get + match '/tests-core', to: 'tests#core', via: :get + match '/tests-ui', to: 'tests#ui', via: :get + match '/tests-model', to: 'tests#model', via: :get + match '/tests-model-ui', to: 'tests#model_ui', via: :get + match '/tests-form', to: 'tests#form', via: :get + match '/tests-form-extended', to: 'tests#form_extended', via: :get + match '/tests-form-validation', to: 'tests#form_validation', via: :get + match '/tests-table', to: 'tests#table', via: :get + match '/tests-html-utils', to: 'tests#html_utils', via: :get + match '/tests-taskbar', to: 'tests#taskbar', via: :get + match '/tests/wait/:sec', to: 'tests#wait', via: :get end \ No newline at end of file diff --git a/config/routes/text_module.rb b/config/routes/text_module.rb index f57d864a5..4dfcfd0e6 100644 --- a/config/routes/text_module.rb +++ b/config/routes/text_module.rb @@ -2,10 +2,10 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # text_modules - match api_path + '/text_modules', :to => 'text_modules#index', :via => :get - match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get - match api_path + '/text_modules', :to => 'text_modules#create', :via => :post - match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put - match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete + match api_path + '/text_modules', to: 'text_modules#index', via: :get + match api_path + '/text_modules/:id', to: 'text_modules#show', via: :get + match api_path + '/text_modules', to: 'text_modules#create', via: :post + match api_path + '/text_modules/:id', to: 'text_modules#update', via: :put + match api_path + '/text_modules/:id', to: 'text_modules#destroy', via: :delete end \ No newline at end of file diff --git a/config/routes/ticket.rb b/config/routes/ticket.rb index a14e0a0c8..439cb431f 100644 --- a/config/routes/ticket.rb +++ b/config/routes/ticket.rb @@ -2,42 +2,42 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # tickets - match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post] - match api_path + '/tickets', :to => 'tickets#index', :via => :get - match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get - match api_path + '/tickets', :to => 'tickets#create', :via => :post - match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put - match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get - match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get - match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get - match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get - match api_path + '/ticket_related/:ticket_id', :to => 'tickets#ticket_related', :via => :get - match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get - match api_path + '/ticket_stats', :to => 'tickets#stats', :via => :get + match api_path + '/tickets/search', to: 'tickets#search', via: [:get, :post] + match api_path + '/tickets', to: 'tickets#index', via: :get + match api_path + '/tickets/:id', to: 'tickets#show', via: :get + match api_path + '/tickets', to: 'tickets#create', via: :post + match api_path + '/tickets/:id', to: 'tickets#update', via: :put + match api_path + '/ticket_create', to: 'tickets#ticket_create', via: :get + match api_path + '/ticket_full/:id', to: 'tickets#ticket_full', via: :get + match api_path + '/ticket_history/:id', to: 'tickets#ticket_history', via: :get + match api_path + '/ticket_customer', to: 'tickets#ticket_customer', via: :get + match api_path + '/ticket_related/:ticket_id', to: 'tickets#ticket_related', via: :get + match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', to: 'tickets#ticket_merge', via: :get + match api_path + '/ticket_stats', to: 'tickets#stats', via: :get # ticket overviews - match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get + match api_path + '/ticket_overviews', to: 'ticket_overviews#show', via: :get # ticket priority - match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get - match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get - match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post - match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put + match api_path + '/ticket_priorities', to: 'ticket_priorities#index', via: :get + match api_path + '/ticket_priorities/:id', to: 'ticket_priorities#show', via: :get + match api_path + '/ticket_priorities', to: 'ticket_priorities#create', via: :post + match api_path + '/ticket_priorities/:id', to: 'ticket_priorities#update', via: :put # ticket state - match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get - match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get - match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post - match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put + match api_path + '/ticket_states', to: 'ticket_states#index', via: :get + match api_path + '/ticket_states/:id', to: 'ticket_states#show', via: :get + match api_path + '/ticket_states', to: 'ticket_states#create', via: :post + match api_path + '/ticket_states/:id', to: 'ticket_states#update', via: :put # ticket articles - match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get - match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get - match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post - match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put - match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get - match api_path + '/ticket_attachment_upload', :to => 'ticket_articles#ticket_attachment_upload_add', :via => :post - match api_path + '/ticket_attachment_upload', :to => 'ticket_articles#ticket_attachment_upload_delete', :via => :delete - match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get + match api_path + '/ticket_articles', to: 'ticket_articles#index', via: :get + match api_path + '/ticket_articles/:id', to: 'ticket_articles#show', via: :get + match api_path + '/ticket_articles', to: 'ticket_articles#create', via: :post + match api_path + '/ticket_articles/:id', to: 'ticket_articles#update', via: :put + match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', to: 'ticket_articles#attachment', via: :get + match api_path + '/ticket_attachment_upload', to: 'ticket_articles#ticket_attachment_upload_add', via: :post + match api_path + '/ticket_attachment_upload', to: 'ticket_articles#ticket_attachment_upload_delete', via: :delete + match api_path + '/ticket_article_plain/:id', to: 'ticket_articles#article_plain', via: :get end \ No newline at end of file diff --git a/config/routes/translation.rb b/config/routes/translation.rb index 836f67796..8d6e88cb1 100644 --- a/config/routes/translation.rb +++ b/config/routes/translation.rb @@ -1,12 +1,12 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path - match api_path + '/translations', :to => 'translations#index', :via => :get - match api_path + '/translations/:id', :to => 'translations#show', :via => :get - match api_path + '/translations', :to => 'translations#create', :via => :post - match api_path + '/translations/:id', :to => 'translations#update', :via => :put - match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete + match api_path + '/translations', to: 'translations#index', via: :get + match api_path + '/translations/:id', to: 'translations#show', via: :get + match api_path + '/translations', to: 'translations#create', via: :post + match api_path + '/translations/:id', to: 'translations#update', via: :put + match api_path + '/translations/:id', to: 'translations#destroy', via: :delete - match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get - match api_path + '/translations/admin/lang/:locale', :to => 'translations#admin', :via => :get + match api_path + '/translations/lang/:locale', to: 'translations#load', via: :get + match api_path + '/translations/admin/lang/:locale', to: 'translations#admin', via: :get end \ No newline at end of file diff --git a/config/routes/user.rb b/config/routes/user.rb index 1a4e101e1..53e281a0d 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -2,23 +2,23 @@ Zammad::Application.routes.draw do api_path = Rails.configuration.api_path # users - match api_path + '/users/search', :to => 'users#search', :via => [:get, :post] - match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post - match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post - match api_path + '/users/password_change', :to => 'users#password_change', :via => :post - match api_path + '/users/preferences', :to => 'users#preferences', :via => :put - match api_path + '/users/account', :to => 'users#account_remove', :via => :delete + match api_path + '/users/search', to: 'users#search', via: [:get, :post] + match api_path + '/users/password_reset', to: 'users#password_reset_send', via: :post + match api_path + '/users/password_reset_verify', to: 'users#password_reset_verify', via: :post + match api_path + '/users/password_change', to: 'users#password_change', via: :post + match api_path + '/users/preferences', to: 'users#preferences', via: :put + match api_path + '/users/account', to: 'users#account_remove', via: :delete - match api_path + '/users/avatar', :to => 'users#avatar_new', :via => :post - match api_path + '/users/avatar', :to => 'users#avatar_list', :via => :get - match api_path + '/users/avatar', :to => 'users#avatar_destroy', :via => :delete - match api_path + '/users/avatar/set', :to => 'users#avatar_set_default', :via => :post + match api_path + '/users/avatar', to: 'users#avatar_new', via: :post + match api_path + '/users/avatar', to: 'users#avatar_list', via: :get + match api_path + '/users/avatar', to: 'users#avatar_destroy', via: :delete + match api_path + '/users/avatar/set', to: 'users#avatar_set_default', via: :post - match api_path + '/users', :to => 'users#index', :via => :get - match api_path + '/users/:id', :to => 'users#show', :via => :get - match api_path + '/users/history/:id', :to => 'users#history', :via => :get - match api_path + '/users', :to => 'users#create', :via => :post - match api_path + '/users/:id', :to => 'users#update', :via => :put - match api_path + '/users/image/:hash', :to => 'users#image', :via => :get + match api_path + '/users', to: 'users#index', via: :get + match api_path + '/users/:id', to: 'users#show', via: :get + match api_path + '/users/history/:id', to: 'users#history', via: :get + match api_path + '/users', to: 'users#create', via: :post + match api_path + '/users/:id', to: 'users#update', via: :put + match api_path + '/users/image/:hash', to: 'users#image', via: :get end \ No newline at end of file diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index 39112c33c..fbffe56d0 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -2,7 +2,7 @@ class CreateBase < ActiveRecord::Migration def up create_table :sessions do |t| - t.string :session_id, :null => false + t.string :session_id, null: false t.text :data t.timestamps end @@ -10,35 +10,35 @@ class CreateBase < ActiveRecord::Migration add_index :sessions, :updated_at create_table :users do |t| - t.references :organization, :null => true - t.column :login, :string, :limit => 100, :null => false - t.column :firstname, :string, :limit => 100, :null => true, :default => '' - t.column :lastname, :string, :limit => 100, :null => true, :default => '' - t.column :email, :string, :limit => 140, :null => true, :default => '' - t.column :image, :string, :limit => 100, :null => true - t.column :image_source, :string, :limit => 200, :null => true - t.column :web, :string, :limit => 100, :null => true, :default => '' - t.column :password, :string, :limit => 100, :null => true - t.column :phone, :string, :limit => 100, :null => true, :default => '' - t.column :fax, :string, :limit => 100, :null => true, :default => '' - t.column :mobile, :string, :limit => 100, :null => true, :default => '' - t.column :department, :string, :limit => 200, :null => true, :default => '' - t.column :street, :string, :limit => 120, :null => true, :default => '' - t.column :zip, :string, :limit => 100, :null => true, :default => '' - t.column :city, :string, :limit => 100, :null => true, :default => '' - t.column :country, :string, :limit => 100, :null => true, :default => '' - t.column :verified, :boolean, :null => false, :default => false - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true, :default => '' - t.column :last_login, :timestamp, :null => true - t.column :source, :string, :limit => 200, :null => true - t.column :login_failed, :integer, :null => false, :default => 0 - t.column :preferences, :string, :limit => 8000,:null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :organization, null: true + t.column :login, :string, limit: 100, null: false + t.column :firstname, :string, limit: 100, null: true, default: '' + t.column :lastname, :string, limit: 100, null: true, default: '' + t.column :email, :string, limit: 140, null: true, default: '' + t.column :image, :string, limit: 100, null: true + t.column :image_source, :string, limit: 200, null: true + t.column :web, :string, limit: 100, null: true, default: '' + t.column :password, :string, limit: 100, null: true + t.column :phone, :string, limit: 100, null: true, default: '' + t.column :fax, :string, limit: 100, null: true, default: '' + t.column :mobile, :string, limit: 100, null: true, default: '' + t.column :department, :string, limit: 200, null: true, default: '' + t.column :street, :string, limit: 120, null: true, default: '' + t.column :zip, :string, limit: 100, null: true, default: '' + t.column :city, :string, limit: 100, null: true, default: '' + t.column :country, :string, limit: 100, null: true, default: '' + t.column :verified, :boolean, null: false, default: false + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true, default: '' + t.column :last_login, :timestamp, null: true + t.column :source, :string, limit: 200, null: true + t.column :login_failed, :integer, null: false, default: 0 + t.column :preferences, :string, limit: 8000,null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :users, [:login], :unique => true + add_index :users, [:login], unique: true add_index :users, [:email] # add_index :users, [:email], :unique => true add_index :users, [:image] @@ -51,89 +51,89 @@ class CreateBase < ActiveRecord::Migration create_table :signatures do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :body, :string, :limit => 5000, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :body, :string, limit: 5000, null: true + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :signatures, [:name], :unique => true + add_index :signatures, [:name], unique: true create_table :email_addresses do |t| - t.column :realname, :string, :limit => 250, :null => false - t.column :email, :string, :limit => 250, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :realname, :string, limit: 250, null: false + t.column :email, :string, limit: 250, null: false + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :email_addresses, [:email], :unique => true + add_index :email_addresses, [:email], unique: true create_table :groups do |t| - t.references :signature, :null => true - t.references :email_address, :null => true - t.column :name, :string, :limit => 100, :null => false - t.column :assignment_timeout, :integer, :null => true - t.column :follow_up_possible, :string, :limit => 100, :null => false, :default => 'yes' - t.column :follow_up_assignment, :boolean, :null => false, :default => true - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :signature, null: true + t.references :email_address, null: true + t.column :name, :string, limit: 100, null: false + t.column :assignment_timeout, :integer, null: true + t.column :follow_up_possible, :string, limit: 100, null: false, default: 'yes' + t.column :follow_up_assignment, :boolean, null: false, default: true + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :groups, [:name], :unique => true + add_index :groups, [:name], unique: true create_table :roles do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :roles, [:name], :unique => true + add_index :roles, [:name], unique: true create_table :organizations do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :shared, :boolean, :null => false, :default => true - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true, :default => '' - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :shared, :boolean, null: false, default: true + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true, default: '' + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :organizations, [:name], :unique => true + add_index :organizations, [:name], unique: true - create_table :roles_users, :id => false do |t| + create_table :roles_users, id: false do |t| t.integer :user_id t.integer :role_id end - create_table :groups_users, :id => false do |t| + create_table :groups_users, id: false do |t| t.integer :user_id t.integer :group_id end - create_table :organizations_users, :id => false do |t| + create_table :organizations_users, id: false do |t| t.integer :user_id t.integer :organization_id end create_table :authorizations do |t| - t.string :provider, :limit => 250, :null => false - t.string :uid, :limit => 250, :null => false - t.string :token, :limit => 250, :null => true - t.string :secret, :limit => 250, :null => true - t.string :username, :limit => 250, :null => true - t.references :user, :null => false + t.string :provider, limit: 250, null: false + t.string :uid, limit: 250, null: false + t.string :token, limit: 250, null: true + t.string :secret, limit: 250, null: true + t.string :username, limit: 250, null: true + t.references :user, null: false t.timestamps end add_index :authorizations, [:uid, :provider] @@ -142,12 +142,12 @@ class CreateBase < ActiveRecord::Migration create_table :translations do |t| - t.column :locale, :string, :limit => 10, :null => false - t.column :source, :string, :limit => 255, :null => false - t.column :target, :string, :limit => 255, :null => false - t.column :target_initial, :string, :limit => 255, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :locale, :string, limit: 10, null: false + t.column :source, :string, limit: 255, null: false + t.column :target, :string, limit: 255, null: false + t.column :target_initial, :string, limit: 255, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :translations, [:source] @@ -155,55 +155,55 @@ class CreateBase < ActiveRecord::Migration create_table :object_lookups do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :object_lookups, [:name], :unique => true + add_index :object_lookups, [:name], unique: true create_table :type_lookups do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :type_lookups, [:name], :unique => true + add_index :type_lookups, [:name], unique: true create_table :tokens do |t| - t.references :user, :null => false - t.string :name, :limit => 100, :null => false - t.string :action, :limit => 40, :null => false + t.references :user, null: false + t.string :name, limit: 100, null: false + t.string :action, limit: 40, null: false t.timestamps end add_index :tokens, :user_id - add_index :tokens, [:name, :action], :unique => true + add_index :tokens, [:name, :action], unique: true add_index :tokens, :created_at create_table :packages do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :version, :string, :limit => 50, :null => false - t.column :vendor, :string, :limit => 150, :null => false - t.column :state, :string, :limit => 50, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :version, :string, limit: 50, null: false + t.column :vendor, :string, limit: 150, null: false + t.column :state, :string, limit: 50, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end create_table :package_migrations do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :version, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false + t.column :version, :string, limit: 250, null: false t.timestamps end create_table :taskbars do |t| - t.column :user_id, :integer, :null => false - t.column :last_contact, :datetime, :null => false - t.column :client_id, :string, :null => false - t.column :key, :string, :limit => 100, :null => false - t.column :callback, :string, :limit => 100, :null => false - t.column :state, :string, :limit => 8000, :null => true - t.column :params, :string, :limit => 2000, :null => true - t.column :prio, :integer, :null => false - t.column :notify, :boolean, :null => false, :default => false - t.column :active, :boolean, :null => false, :default => false + t.column :user_id, :integer, null: false + t.column :last_contact, :datetime, null: false + t.column :client_id, :string, null: false + t.column :key, :string, limit: 100, null: false + t.column :callback, :string, limit: 100, null: false + t.column :state, :string, limit: 8000, null: true + t.column :params, :string, limit: 2000, null: true + t.column :prio, :integer, null: false + t.column :notify, :boolean, null: false, default: false + t.column :active, :boolean, null: false, default: false t.timestamps end add_index :taskbars, [:user_id] @@ -211,32 +211,32 @@ class CreateBase < ActiveRecord::Migration create_table :tags do |t| - t.references :tag_item, :null => false - t.references :tag_object, :null => false - t.column :o_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :tag_item, null: false + t.references :tag_object, null: false + t.column :o_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :tags, [:o_id] add_index :tags, [:tag_object_id] create_table :tag_objects do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :tag_objects, [:name], :unique => true + add_index :tag_objects, [:name], unique: true create_table :tag_items do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :tag_items, [:name], :unique => true + add_index :tag_items, [:name], unique: true create_table :recent_views do |t| - t.references :recent_view_object, :null => false - t.column :o_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :recent_view_object, null: false + t.column :o_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :recent_views, [:o_id] @@ -246,12 +246,12 @@ class CreateBase < ActiveRecord::Migration create_table :activity_streams do |t| - t.references :activity_stream_type, :null => false - t.references :activity_stream_object, :null => false - t.references :role, :null => true - t.references :group, :null => true - t.column :o_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :activity_stream_type, null: false + t.references :activity_stream_object, null: false + t.references :role, null: true + t.references :group, null: true + t.column :o_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :activity_streams, [:o_id] @@ -263,17 +263,17 @@ class CreateBase < ActiveRecord::Migration add_index :activity_streams, [:activity_stream_type_id] create_table :histories do |t| - t.references :history_type, :null => false - t.references :history_object, :null => false - t.references :history_attribute, :null => true - t.column :o_id, :integer, :null => false - t.column :related_o_id, :integer, :null => true - t.column :related_history_object_id, :integer, :null => true - t.column :id_to, :integer, :null => true - t.column :id_from, :integer, :null => true - t.column :value_from, :string, :limit => 250, :null => true - t.column :value_to, :string, :limit => 250, :null => true - t.column :created_by_id, :integer, :null => false + t.references :history_type, null: false + t.references :history_object, null: false + t.references :history_attribute, null: true + t.column :o_id, :integer, null: false + t.column :related_o_id, :integer, null: true + t.column :related_history_object_id, :integer, null: true + t.column :id_to, :integer, null: true + t.column :id_from, :integer, null: true + t.column :value_from, :string, limit: 250, null: true + t.column :value_to, :string, limit: 250, null: true + t.column :created_by_id, :integer, null: false t.timestamps end add_index :histories, [:o_id] @@ -288,37 +288,37 @@ class CreateBase < ActiveRecord::Migration add_index :histories, [:value_to] create_table :history_types do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :history_types, [:name], :unique => true + add_index :history_types, [:name], unique: true create_table :history_objects do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true t.timestamps end - add_index :history_objects, [:name], :unique => true + add_index :history_objects, [:name], unique: true create_table :history_attributes do |t| - t.column :name, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false t.timestamps end - add_index :history_attributes, [:name], :unique => true + add_index :history_attributes, [:name], unique: true create_table :settings do |t| - t.column :title, :string, :limit => 200, :null => false - t.column :name, :string, :limit => 200, :null => false - t.column :area, :string, :limit => 100, :null => false - t.column :description, :string, :limit => 2000, :null => false - t.column :options, :string, :limit => 2000, :null => true - t.column :state, :string, :limit => 2000, :null => true - t.column :state_initial, :string, :limit => 2000, :null => true - t.column :frontend, :boolean, :null => false + t.column :title, :string, limit: 200, null: false + t.column :name, :string, limit: 200, null: false + t.column :area, :string, limit: 100, null: false + t.column :description, :string, limit: 2000, null: false + t.column :options, :string, limit: 2000, null: true + t.column :state, :string, limit: 2000, null: true + t.column :state_initial, :string, limit: 2000, null: true + t.column :frontend, :boolean, null: false t.timestamps end - add_index :settings, [:name], :unique => true + add_index :settings, [:name], unique: true add_index :settings, [:area] add_index :settings, [:frontend] diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 29f00faed..0a7e94b59 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -1,67 +1,67 @@ class CreateTicket < ActiveRecord::Migration def up create_table :ticket_state_types do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_state_types, [:name], :unique => true + add_index :ticket_state_types, [:name], unique: true create_table :ticket_states do |t| - t.references :state_type, :null => false - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :state_type, null: false + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_states, [:name], :unique => true + add_index :ticket_states, [:name], unique: true create_table :ticket_priorities do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_priorities, [:name], :unique => true + add_index :ticket_priorities, [:name], unique: true create_table :tickets do |t| - t.references :group, :null => false - t.references :priority, :null => false - t.references :state, :null => false - t.references :organization, :null => true - t.column :number, :string, :limit => 60, :null => false - t.column :title, :string, :limit => 250,:null => false - t.column :owner_id, :integer, :null => false - t.column :customer_id, :integer, :null => false - t.column :note, :string, :limit => 250,:null => true - t.column :first_response, :timestamp, :null => true - t.column :first_response_escal_date, :timestamp, :null => true - t.column :first_response_sla_time, :timestamp, :null => true - t.column :first_response_in_min, :integer, :null => true - t.column :first_response_diff_in_min, :integer, :null => true - t.column :close_time, :timestamp, :null => true - t.column :close_time_escal_date, :timestamp, :null => true - t.column :close_time_sla_time, :timestamp, :null => true - t.column :close_time_in_min, :integer, :null => true - t.column :close_time_diff_in_min, :integer, :null => true - t.column :update_time_escal_date, :timestamp, :null => true - t.column :updtate_time_sla_time, :timestamp, :null => true - t.column :update_time_in_min, :integer, :null => true - t.column :update_time_diff_in_min, :integer, :null => true - t.column :last_contact, :timestamp, :null => true - t.column :last_contact_agent, :timestamp, :null => true - t.column :last_contact_customer, :timestamp, :null => true - t.column :create_article_type_id, :integer, :null => true - t.column :create_article_sender_id, :integer, :null => true - t.column :article_count, :integer, :null => true - t.column :escalation_time, :timestamp, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :group, null: false + t.references :priority, null: false + t.references :state, null: false + t.references :organization, null: true + t.column :number, :string, limit: 60, null: false + t.column :title, :string, limit: 250,null: false + t.column :owner_id, :integer, null: false + t.column :customer_id, :integer, null: false + t.column :note, :string, limit: 250,null: true + t.column :first_response, :timestamp, null: true + t.column :first_response_escal_date, :timestamp, null: true + t.column :first_response_sla_time, :timestamp, null: true + t.column :first_response_in_min, :integer, null: true + t.column :first_response_diff_in_min, :integer, null: true + t.column :close_time, :timestamp, null: true + t.column :close_time_escal_date, :timestamp, null: true + t.column :close_time_sla_time, :timestamp, null: true + t.column :close_time_in_min, :integer, null: true + t.column :close_time_diff_in_min, :integer, null: true + t.column :update_time_escal_date, :timestamp, null: true + t.column :updtate_time_sla_time, :timestamp, null: true + t.column :update_time_in_min, :integer, null: true + t.column :update_time_diff_in_min, :integer, null: true + t.column :last_contact, :timestamp, null: true + t.column :last_contact_agent, :timestamp, null: true + t.column :last_contact_customer, :timestamp, null: true + t.column :create_article_type_id, :integer, null: true + t.column :create_article_sender_id, :integer, null: true + t.column :article_count, :integer, null: true + t.column :escalation_time, :timestamp, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :tickets, [:state_id] @@ -69,7 +69,7 @@ class CreateTicket < ActiveRecord::Migration add_index :tickets, [:group_id] add_index :tickets, [:owner_id] add_index :tickets, [:customer_id] - add_index :tickets, [:number], :unique => true + add_index :tickets, [:number], unique: true add_index :tickets, [:title] add_index :tickets, [:created_at] add_index :tickets, [:first_response] @@ -91,10 +91,10 @@ class CreateTicket < ActiveRecord::Migration add_index :tickets, [:created_by_id] create_table :ticket_flags do |t| - t.references :tickets, :null => false - t.column :key, :string, :limit => 50, :null => false - t.column :value, :string, :limit => 50, :null => true - t.column :created_by_id, :integer, :null => false + t.references :tickets, null: false + t.column :key, :string, limit: 50, null: false + t.column :value, :string, limit: 50, null: true + t.column :created_by_id, :integer, null: false t.timestamps end add_index :ticket_flags, [:tickets_id, :created_by_id] @@ -103,10 +103,10 @@ class CreateTicket < ActiveRecord::Migration add_index :ticket_flags, [:created_by_id] create_table :ticket_time_accounting do |t| - t.references :tickets, :null => false - t.references :ticket_articles, :null => true - t.column :time_unit, :decimal, :precision => 6, :scale => 2, :null => false - t.column :created_by_id, :integer, :null => false + t.references :tickets, null: false + t.references :ticket_articles, null: true + t.column :time_unit, :decimal, precision: 6, scale: 2, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :ticket_time_accounting, [:tickets_id] @@ -114,47 +114,47 @@ class CreateTicket < ActiveRecord::Migration add_index :ticket_time_accounting, [:created_by_id] create_table :ticket_article_types do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :communication, :boolean, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :communication, :boolean, null: false + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_article_types, [:name], :unique => true + add_index :ticket_article_types, [:name], unique: true create_table :ticket_article_senders do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_article_senders, [:name], :unique => true + add_index :ticket_article_senders, [:name], unique: true create_table :ticket_articles do |t| - t.references :ticket, :null => false - t.references :type, :null => false - t.references :sender, :null => false - t.column :from, :string, :limit => 3000, :null => true - t.column :to, :string, :limit => 3000, :null => true - t.column :cc, :string, :limit => 3000, :null => true - t.column :subject, :string, :limit => 3000, :null => true + t.references :ticket, null: false + t.references :type, null: false + t.references :sender, null: false + t.column :from, :string, limit: 3000, null: true + t.column :to, :string, limit: 3000, null: true + t.column :cc, :string, limit: 3000, null: true + t.column :subject, :string, limit: 3000, null: true # t.column :reply_to, :string, :limit => 3000, :null => true - t.column :message_id, :string, :limit => 3000, :null => true - t.column :message_id_md5, :string, :limit => 32, :null => true - t.column :in_reply_to, :string, :limit => 3000, :null => true - t.column :references, :string, :limit => 3200, :null => true - t.column :body, :text, :limit => 4.megabytes + 1 - t.column :internal, :boolean, :null => false, :default => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :message_id, :string, limit: 3000, null: true + t.column :message_id_md5, :string, limit: 32, null: true + t.column :in_reply_to, :string, limit: 3000, null: true + t.column :references, :string, limit: 3200, null: true + t.column :body, :text, limit: 4.megabytes + 1 + t.column :internal, :boolean, null: false, default: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :ticket_articles, [:ticket_id] add_index :ticket_articles, [:message_id_md5] - add_index :ticket_articles, [:message_id_md5, :type_id], :name => 'index_ticket_articles_message_id_md5_type_id' + add_index :ticket_articles, [:message_id_md5, :type_id], name: 'index_ticket_articles_message_id_md5_type_id' add_index :ticket_articles, [:created_by_id] add_index :ticket_articles, [:created_at] add_index :ticket_articles, [:internal] @@ -162,43 +162,43 @@ class CreateTicket < ActiveRecord::Migration add_index :ticket_articles, [:sender_id] create_table :ticket_article_flags do |t| - t.references :ticket_articles, :null => false - t.column :key, :string, :limit => 50, :null => false - t.column :value, :string, :limit => 50, :null => true - t.column :created_by_id, :integer, :null => false + t.references :ticket_articles, null: false + t.column :key, :string, limit: 50, null: false + t.column :value, :string, limit: 50, null: true + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :ticket_article_flags, [:ticket_articles_id, :created_by_id], :name => 'index_ticket_article_flags_on_articles_id_and_created_by_id' + add_index :ticket_article_flags, [:ticket_articles_id, :created_by_id], name: 'index_ticket_article_flags_on_articles_id_and_created_by_id' add_index :ticket_article_flags, [:ticket_articles_id, :key] add_index :ticket_article_flags, [:ticket_articles_id] add_index :ticket_article_flags, [:created_by_id] create_table :ticket_counters do |t| - t.column :content, :string, :limit => 100, :null => false - t.column :generator, :string, :limit => 100, :null => false + t.column :content, :string, limit: 100, null: false + t.column :generator, :string, limit: 100, null: false end - add_index :ticket_counters, [:generator], :unique => true + add_index :ticket_counters, [:generator], unique: true create_table :overviews do |t| - t.references :user, :null => true - t.references :role, :null => false - t.column :name, :string, :limit => 250, :null => false - t.column :link, :string, :limit => 250, :null => false - t.column :prio, :integer, :null => false - t.column :condition, :string, :limit => 2500, :null => false - t.column :order, :string, :limit => 2500, :null => false - t.column :group_by, :string, :limit => 250, :null => true - t.column :organization_shared, :boolean, :null => false, :default => false - t.column :view, :string, :limit => 1000, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :user, null: true + t.references :role, null: false + t.column :name, :string, limit: 250, null: false + t.column :link, :string, limit: 250, null: false + t.column :prio, :integer, null: false + t.column :condition, :string, limit: 2500, null: false + t.column :order, :string, limit: 2500, null: false + t.column :group_by, :string, limit: 250, null: true + t.column :organization_shared, :boolean, null: false, default: false + t.column :view, :string, limit: 1000, null: false + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :overviews, [:user_id] add_index :overviews, [:name] - create_table :overviews_groups, :id => false do |t| + create_table :overviews_groups, id: false do |t| t.integer :overview_id t.integer :group_id end @@ -206,48 +206,48 @@ class CreateTicket < ActiveRecord::Migration add_index :overviews_groups, [:group_id] create_table :triggers do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :key, :string, :limit => 250, :null => false - t.column :value, :string, :limit => 250, :null => false + t.column :name, :string, limit: 250, null: false + t.column :key, :string, limit: 250, null: false + t.column :value, :string, limit: 250, null: false end add_index :triggers, [:name] add_index :triggers, [:key] add_index :triggers, [:value] create_table :notifications do |t| - t.column :subject, :string, :limit => 250, :null => false - t.column :body, :string, :limit => 8000, :null => false - t.column :content_type, :string, :limit => 250, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true + t.column :subject, :string, limit: 250, null: false + t.column :body, :string, limit: 8000, null: false + t.column :content_type, :string, limit: 250, null: false + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true t.timestamps end create_table :link_types do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true t.timestamps end - add_index :link_types, [:name], :unique => true + add_index :link_types, [:name], unique: true create_table :link_objects do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true t.timestamps end - add_index :link_objects, [:name], :unique => true + add_index :link_objects, [:name], unique: true create_table :links do |t| - t.references :link_type, :null => false - t.column :link_object_source_id, :integer, :null => false - t.column :link_object_source_value, :integer, :null => false - t.column :link_object_target_id, :integer, :null => false - t.column :link_object_target_value, :integer, :null => false + t.references :link_type, null: false + t.column :link_object_source_id, :integer, null: false + t.column :link_object_source_value, :integer, null: false + t.column :link_object_target_id, :integer, null: false + t.column :link_object_target_value, :integer, null: false t.timestamps end - add_index :links, [:link_object_source_id, :link_object_source_value, :link_object_target_id, :link_object_target_value, :link_type_id], :unique => true, :name => 'links_uniq_total' + add_index :links, [:link_object_source_id, :link_object_source_value, :link_object_target_id, :link_object_target_value, :link_type_id], unique: true, name: 'links_uniq_total' end def self.down diff --git a/db/migrate/20120101000020_create_network.rb b/db/migrate/20120101000020_create_network.rb index 5f64426bc..17c0a86da 100644 --- a/db/migrate/20120101000020_create_network.rb +++ b/db/migrate/20120101000020_create_network.rb @@ -1,95 +1,95 @@ class CreateNetwork < ActiveRecord::Migration def up create_table :networks do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :networks, [:name], :unique => true + add_index :networks, [:name], unique: true create_table :network_category_types do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :network_category_types, [:name], :unique => true + add_index :network_category_types, [:name], unique: true create_table :network_privacies do |t| - t.column :name, :string, :limit => 100, :null => false - t.column :key, :string, :limit => 250, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 100, null: false + t.column :key, :string, limit: 250, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :network_privacies, [:name], :unique => true + add_index :network_privacies, [:name], unique: true create_table :network_categories do |t| - t.references :network_category_type, :null => false - t.references :network_privacy, :null => false - t.references :network, :null => false - t.column :name, :string, :limit => 200, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :allow_comments, :boolean, :null => false, :default => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :network_category_type, null: false + t.references :network_privacy, null: false + t.references :network, null: false + t.column :name, :string, limit: 200, null: false + t.column :note, :string, limit: 250, null: true + t.column :allow_comments, :boolean, null: false, default: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :network_categories, [:network_id] - create_table :network_categories_moderator_users, :id => false do |t| + create_table :network_categories_moderator_users, id: false do |t| t.integer :user_id t.integer :network_category_id end 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 => 20_000, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :network_category, null: false + t.column :title, :string, limit: 200, 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 end add_index :network_items, [:network_category_id] create_table :network_item_comments do |t| - t.references :network_item, :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.references :network_item, 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 end add_index :network_item_comments, [:network_item_id] create_table :network_item_plus do |t| - t.references :network_item, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :network_item, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :network_item_plus, [:network_item_id, :created_by_id], :unique => true + add_index :network_item_plus, [:network_item_id, :created_by_id], unique: true create_table :network_category_subscriptions do |t| - t.references :network_categories, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :network_categories, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], :unique => true, :name => 'index_network_category_subscriptions_on_network_c_i_and_c' + add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], unique: true, name: 'index_network_category_subscriptions_on_network_c_i_and_c' create_table :network_item_subscriptions do |t| - t.references :network_item, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :network_item, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :network_item_subscriptions, [:network_item_id, :created_by_id], :unique => true, :name => 'index_network_item_subscriptions_on_item_id_and_created_by_id' + add_index :network_item_subscriptions, [:network_item_id, :created_by_id], unique: true, name: 'index_network_item_subscriptions_on_item_id_and_created_by_id' end diff --git a/db/migrate/20120101000030_create_storage.rb b/db/migrate/20120101000030_create_storage.rb index 8b0266090..8812680e0 100644 --- a/db/migrate/20120101000030_create_storage.rb +++ b/db/migrate/20120101000030_create_storage.rb @@ -1,38 +1,38 @@ class CreateStorage < ActiveRecord::Migration def up create_table :stores do |t| - t.references :store_object, :null => false - t.references :store_file, :null => false - t.column :o_id, :integer, :limit => 8, :null => false - t.column :preferences, :string, :limit => 2500, :null => true - t.column :size, :string, :limit => 50, :null => true - t.column :filename, :string, :limit => 250, :null => false - t.column :created_by_id, :integer, :null => false + t.references :store_object, null: false + t.references :store_file, null: false + t.column :o_id, :integer, limit: 8, null: false + t.column :preferences, :string, limit: 2500, null: true + t.column :size, :string, limit: 50, null: true + t.column :filename, :string, limit: 250, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :stores, [:store_object_id, :o_id] create_table :store_objects do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :note, :string, :limit => 250, :null => true + t.column :name, :string, limit: 250, null: false + t.column :note, :string, limit: 250, null: true t.timestamps end - add_index :store_objects, [:name], :unique => true + add_index :store_objects, [:name], unique: true create_table :store_files do |t| - t.column :sha, :string, :limit => 128, :null => false - t.column :provider, :string, :limit => 20, :null => true + t.column :sha, :string, limit: 128, null: false + t.column :provider, :string, limit: 20, null: true t.timestamps end - add_index :store_files, [:sha], :unique => true + add_index :store_files, [:sha], unique: true add_index :store_files, [:provider] create_table :store_provider_dbs do |t| - t.column :sha, :string, :limit => 128, :null => false - t.column :data, :binary, :limit => 200.megabytes, :null => true + t.column :sha, :string, limit: 128, null: false + t.column :data, :binary, limit: 200.megabytes, null: true t.timestamps end - add_index :store_provider_dbs, [:sha], :unique => true + add_index :store_provider_dbs, [:sha], unique: true end diff --git a/db/migrate/20120101000040_create_delayed_jobs.rb b/db/migrate/20120101000040_create_delayed_jobs.rb index e7841608c..420e1bdac 100644 --- a/db/migrate/20120101000040_create_delayed_jobs.rb +++ b/db/migrate/20120101000040_create_delayed_jobs.rb @@ -1,8 +1,8 @@ class CreateDelayedJobs < ActiveRecord::Migration def self.up - create_table :delayed_jobs, :force => true do |table| - table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue - table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually. + create_table :delayed_jobs, force: true do |table| + table.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue + table.integer :attempts, default: 0 # Provides for retries, but still fail eventually. table.text :handler # YAML-encoded string of the object that will do work table.text :last_error # reason for last failure (See Note below) table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. @@ -13,7 +13,7 @@ class CreateDelayedJobs < ActiveRecord::Migration table.timestamps end - add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' + add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority' end def self.down diff --git a/db/migrate/20120101000070_create_channel.rb b/db/migrate/20120101000070_create_channel.rb index c2f2d85b6..a5c080437 100644 --- a/db/migrate/20120101000070_create_channel.rb +++ b/db/migrate/20120101000070_create_channel.rb @@ -2,13 +2,13 @@ class CreateChannel < ActiveRecord::Migration def up create_table :channels do |t| - t.references :group, :null => true - t.column :adapter, :string, :limit => 100, :null => false - t.column :area, :string, :limit => 100, :null => false - t.column :options, :string, :limit => 2000, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :group, null: true + t.column :adapter, :string, limit: 100, null: false + t.column :area, :string, limit: 100, null: false + t.column :options, :string, limit: 2000, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :channels, [:area] diff --git a/db/migrate/20120101000090_create_template.rb b/db/migrate/20120101000090_create_template.rb index db477a57e..52e8f9ffc 100644 --- a/db/migrate/20120101000090_create_template.rb +++ b/db/migrate/20120101000090_create_template.rb @@ -1,17 +1,17 @@ class CreateTemplate < ActiveRecord::Migration def up create_table :templates do |t| - t.references :user, :null => true - t.column :name, :string, :limit => 250, :null => false - t.column :options, :string, :limit => 2500, :null => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :user, null: true + t.column :name, :string, limit: 250, null: false + t.column :options, :string, limit: 2500, null: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :templates, [:user_id] add_index :templates, [:name] - create_table :templates_groups, :id => false do |t| + create_table :templates_groups, id: false do |t| t.integer :template_id t.integer :group_id end diff --git a/db/migrate/20120101000100_postmaster_filter_create.rb b/db/migrate/20120101000100_postmaster_filter_create.rb index cdb7ec9aa..3798b4576 100644 --- a/db/migrate/20120101000100_postmaster_filter_create.rb +++ b/db/migrate/20120101000100_postmaster_filter_create.rb @@ -1,14 +1,14 @@ class PostmasterFilterCreate < ActiveRecord::Migration def up create_table :postmaster_filters do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :channel, :string, :limit => 250, :null => false - t.column :match, :string, :limit => 5000, :null => false - t.column :perform, :string, :limit => 5000, :null => false - t.column :active, :boolean, :null => false, :default => true - t.column :note, :string, :limit => 250, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :channel, :string, limit: 250, null: false + t.column :match, :string, limit: 5000, null: false + t.column :perform, :string, limit: 5000, null: false + t.column :active, :boolean, null: false, default: true + t.column :note, :string, limit: 250, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :postmaster_filters, [:channel] diff --git a/db/migrate/20120101000110_text_module_create.rb b/db/migrate/20120101000110_text_module_create.rb index 784082f28..d8c995aee 100644 --- a/db/migrate/20120101000110_text_module_create.rb +++ b/db/migrate/20120101000110_text_module_create.rb @@ -1,20 +1,20 @@ class TextModuleCreate < ActiveRecord::Migration def up create_table :text_modules do |t| - t.references :user, :null => true - t.column :name, :string, :limit => 250, :null => false - t.column :keywords, :string, :limit => 500, :null => true - t.column :content, :string, :limit => 5000, :null => false - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.references :user, null: true + t.column :name, :string, limit: 250, null: false + t.column :keywords, :string, limit: 500, null: true + t.column :content, :string, limit: 5000, null: false + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :text_modules, [:user_id] add_index :text_modules, [:name] - create_table :text_modules_groups, :id => false do |t| + create_table :text_modules_groups, id: false do |t| t.integer :text_module_id t.integer :group_id end diff --git a/db/migrate/20130201071513_create_sla.rb b/db/migrate/20130201071513_create_sla.rb index fce0bfbd8..89fc7aac5 100644 --- a/db/migrate/20130201071513_create_sla.rb +++ b/db/migrate/20130201071513_create_sla.rb @@ -1,19 +1,19 @@ class CreateSla < ActiveRecord::Migration def up create_table :slas do |t| - t.column :name, :string, :limit => 150, :null => true - t.column :first_response_time, :integer, :null => true - t.column :update_time, :integer, :null => true - t.column :close_time, :integer, :null => true - t.column :condition, :string, :limit => 5000, :null => true - t.column :data, :string, :limit => 5000, :null => true - t.column :timezone, :string, :limit => 50, :null => true - t.column :active, :boolean, :null => false, :default => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 150, null: true + t.column :first_response_time, :integer, null: true + t.column :update_time, :integer, null: true + t.column :close_time, :integer, null: true + t.column :condition, :string, limit: 5000, null: true + t.column :data, :string, limit: 5000, null: true + t.column :timezone, :string, limit: 50, null: true + t.column :active, :boolean, null: false, default: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :slas, [:name], :unique => true + add_index :slas, [:name], unique: true end def down diff --git a/db/migrate/20130305065226_scheduler_create.rb b/db/migrate/20130305065226_scheduler_create.rb index 61d600236..eae9d9fa4 100644 --- a/db/migrate/20130305065226_scheduler_create.rb +++ b/db/migrate/20130305065226_scheduler_create.rb @@ -3,55 +3,55 @@ require 'setting' class SchedulerCreate < ActiveRecord::Migration def up create_table :schedulers do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :method, :string, :limit => 250, :null => false - t.column :period, :integer, :null => true - t.column :running, :integer, :null => false, :default => false - t.column :last_run, :timestamp, :null => true - t.column :prio, :integer, :null => false - t.column :pid, :string, :limit => 250, :null => true - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :method, :string, limit: 250, null: false + t.column :period, :integer, null: true + t.column :running, :integer, null: false, default: false + t.column :last_run, :timestamp, null: true + t.column :prio, :integer, null: false + t.column :pid, :string, limit: 250, null: true + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :schedulers, [:name], :unique => true + add_index :schedulers, [:name], unique: true Scheduler.create_or_update( - :name => 'Import OTRS diff load', - :method => 'Import::OTRS2.diff_worker', - :period => 60 * 3, - :prio => 1, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + name: 'Import OTRS diff load', + method: 'Import::OTRS2.diff_worker', + period: 60 * 3, + prio: 1, + active: true, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.create_or_update( - :name => 'Check Channels', - :method => 'Channel.fetch', - :period => 30, - :prio => 1, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + name: 'Check Channels', + method: 'Channel.fetch', + period: 30, + prio: 1, + active: true, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.create_or_update( - :name => 'Generate Session data', - :method => 'Sessions.jobs', - :period => 60, - :prio => 1, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + name: 'Generate Session data', + method: 'Sessions.jobs', + period: 60, + prio: 1, + active: true, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.create_or_update( - :name => 'Cleanup expired sessions', - :method => 'SessionHelper.cleanup_expired', - :period => 60 * 60 * 24, - :prio => 2, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + name: 'Cleanup expired sessions', + method: 'SessionHelper.cleanup_expired', + period: 60 * 60 * 24, + prio: 2, + active: true, + updated_by_id: 1, + created_by_id: 1, ) end diff --git a/db/migrate/20130726000001_update_session.rb b/db/migrate/20130726000001_update_session.rb index 2c0fcca00..52a8aa478 100644 --- a/db/migrate/20130726000001_update_session.rb +++ b/db/migrate/20130726000001_update_session.rb @@ -1,6 +1,6 @@ class UpdateSession < ActiveRecord::Migration def up - add_column :sessions, :request_type, :integer, :null => true + add_column :sessions, :request_type, :integer, null: true add_index :sessions, :request_type end def down diff --git a/db/migrate/20130815000002_update_ticket_number.rb b/db/migrate/20130815000002_update_ticket_number.rb index 6e79cb300..feaf14266 100644 --- a/db/migrate/20130815000002_update_ticket_number.rb +++ b/db/migrate/20130815000002_update_ticket_number.rb @@ -1,31 +1,31 @@ class UpdateTicketNumber < ActiveRecord::Migration def up Setting.create_or_update( - :title => 'Ticket Number Format', - :name => 'ticket_number', - :area => 'Ticket::Number', - :description => 'Selects the ticket number generator module. "Increment" increments the ticket + title: 'Ticket Number Format', + name: 'ticket_number', + area: 'Ticket::Number', + description: 'Selects the ticket number generator module. "Increment" increments the ticket number, the SystemID and the counter are used with SystemID.Counter format (e.g. 1010138, 1010139). With "Date" the ticket numbers will be generated by the current date, the SystemID and the counter. The format looks like Year.Month.Day.SystemID.counter (e.g. 201206231010138, 201206231010139). With param "Checksum => true" the counter will be appended as checksum to the string. The format looks like SystemID.Counter.CheckSum (e. g. 10101384, 10101392) or Year.Month.Day.SystemID.Counter.CheckSum (e.g. 2012070110101520, 2012070110101535).', - :options => { - :form => [ + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_number', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'ticket_number', + tag: 'select', + options: { 'Ticket::Number::Increment' => 'Increment (SystemID.Counter)', 'Ticket::Number::Date' => 'Date (Year.Month.Day.SystemID.Counter)', }, }, ], }, - :state => 'Ticket::Number::Increment', - :frontend => false + state: 'Ticket::Number::Increment', + frontend: false ) end def down diff --git a/db/migrate/20130817000001_update_auth.rb b/db/migrate/20130817000001_update_auth.rb index 449334f11..19c9be415 100644 --- a/db/migrate/20130817000001_update_auth.rb +++ b/db/migrate/20130817000001_update_auth.rb @@ -1,50 +1,50 @@ class UpdateAuth < ActiveRecord::Migration def up Setting.create_or_update( - :title => 'Authentication via OTRS', - :name => 'auth_otrs', - :area => 'Security::Authentication', - :description => 'Enables user authentication via OTRS.', - :state => { - :adapter => 'Auth::Otrs', - :required_group_ro => 'stats', - :group_rw_role_map => { + title: 'Authentication via OTRS', + name: 'auth_otrs', + area: 'Security::Authentication', + description: 'Enables user authentication via OTRS.', + state: { + adapter: 'Auth::Otrs', + required_group_ro: 'stats', + group_rw_role_map: { 'admin' => 'Admin', 'stats' => 'Report', }, - :group_ro_role_map => { + group_ro_role_map: { 'stats' => 'Report', }, - :always_role => { + always_role: { 'Agent' => true, }, }, - :frontend => false + frontend: false ) Setting.create_or_update( - :title => 'Authentication via LDAP', - :name => 'auth_ldap', - :area => 'Security::Authentication', - :description => 'Enables user authentication via LDAP.', - :state => { - :adapter => 'Auth::Ldap', - :host => 'localhost', - :port => 389, - :bind_dn => 'cn=Manager,dc=example,dc=org', - :bind_pw => 'example', - :uid => 'mail', - :base => 'dc=example,dc=org', - :always_filter => '', - :always_roles => ['Admin', 'Agent'], - :always_groups => ['Users'], - :sync_params => { - :firstname => 'sn', - :lastname => 'givenName', - :email => 'mail', - :login => 'mail', + title: 'Authentication via LDAP', + name: 'auth_ldap', + area: 'Security::Authentication', + description: 'Enables user authentication via LDAP.', + state: { + adapter: 'Auth::Ldap', + host: 'localhost', + port: 389, + bind_dn: 'cn=Manager,dc=example,dc=org', + bind_pw: 'example', + uid: 'mail', + base: 'dc=example,dc=org', + always_filter: '', + always_roles: ['Admin', 'Agent'], + always_groups: ['Users'], + sync_params: { + firstname: 'sn', + lastname: 'givenName', + email: 'mail', + login: 'mail', }, }, - :frontend => false + frontend: false ) end def down diff --git a/db/migrate/20140128000001_add_search_index.rb b/db/migrate/20140128000001_add_search_index.rb index 61cc3cb86..e1d092e15 100644 --- a/db/migrate/20140128000001_add_search_index.rb +++ b/db/migrate/20140128000001_add_search_index.rb @@ -1,52 +1,52 @@ class AddSearchIndex < ActiveRecord::Migration def up Setting.create_or_update( - :title => 'Elasticsearch Endpoint URL', - :name => 'es_url', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define endpoint of Elastic Search.', - :state => '', - :frontend => false + title: 'Elasticsearch Endpoint URL', + name: 'es_url', + area: 'SearchIndex::Elasticsearch', + description: 'Define endpoint of Elastic Search.', + state: '', + frontend: false ) Setting.create_or_update( - :title => 'Elasticsearch Endpoint User', - :name => 'es_user', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define http basic auth user of Elasticsearch.', - :state => '', - :frontend => false + title: 'Elasticsearch Endpoint User', + name: 'es_user', + area: 'SearchIndex::Elasticsearch', + description: 'Define http basic auth user of Elasticsearch.', + state: '', + frontend: false ) Setting.create_or_update( - :title => 'Elastic Search Endpoint Password', - :name => 'es_password', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define http basic auth password of Elasticsearch.', - :state => '', - :frontend => false + title: 'Elastic Search Endpoint Password', + name: 'es_password', + area: 'SearchIndex::Elasticsearch', + description: 'Define http basic auth password of Elasticsearch.', + state: '', + frontend: false ) Setting.create_or_update( - :title => 'Elastic Search Endpoint Index', - :name => 'es_index', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define Elasticsearch index name.', - :state => 'zammad', - :frontend => false + title: 'Elastic Search Endpoint Index', + name: 'es_index', + area: 'SearchIndex::Elasticsearch', + description: 'Define Elasticsearch index name.', + state: 'zammad', + frontend: false ) Setting.create_or_update( - :title => 'Elastic Search Attachment Extentions', - :name => 'es_attachment_ignore', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define attachment extentions which are ignored for Elasticsearch.', - :state => [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ], - :frontend => false + title: 'Elastic Search Attachment Extentions', + name: 'es_attachment_ignore', + area: 'SearchIndex::Elasticsearch', + description: 'Define attachment extentions which are ignored for Elasticsearch.', + state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ], + frontend: false ) Setting.create_or_update( - :title => 'Elastic Search Attachment Size', - :name => 'es_attachment_max_size_in_mb', - :area => 'SearchIndex::Elasticsearch', - :description => 'Define max. attachment size for Elasticsearch.', - :state => 50, - :frontend => false + title: 'Elastic Search Attachment Size', + name: 'es_attachment_max_size_in_mb', + area: 'SearchIndex::Elasticsearch', + description: 'Define max. attachment size for Elasticsearch.', + state: 50, + frontend: false ) Ticket.search_index_reload diff --git a/db/migrate/20140728000001_update_setting1.rb b/db/migrate/20140728000001_update_setting1.rb index 5f5578180..7516393cd 100644 --- a/db/migrate/20140728000001_update_setting1.rb +++ b/db/migrate/20140728000001_update_setting1.rb @@ -1,48 +1,48 @@ class UpdateSetting1 < ActiveRecord::Migration def up Setting.create_if_not_exists( - :title => 'Send client stats', - :name => 'ui_send_client_stats', - :area => 'System::UI', - :description => 'Send client stats to central server.', - :options => { - :form => [ + title: 'Send client stats', + name: 'ui_send_client_stats', + area: 'System::UI', + description: 'Send client stats to central server.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ui_send_client_stats', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'ui_send_client_stats', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Client storage', - :name => 'ui_client_storage', - :area => 'System::UI', - :description => 'Use client storage to cache data to perform speed of application.', - :options => { - :form => [ + title: 'Client storage', + name: 'ui_client_storage', + area: 'System::UI', + description: 'Use client storage to cache data to perform speed of application.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ui_client_storage', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'ui_client_storage', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) end diff --git a/db/migrate/20140824000002_create_online_notification.rb b/db/migrate/20140824000002_create_online_notification.rb index 101564a20..5c2f6c5f8 100644 --- a/db/migrate/20140824000002_create_online_notification.rb +++ b/db/migrate/20140824000002_create_online_notification.rb @@ -1,12 +1,12 @@ class CreateOnlineNotification < ActiveRecord::Migration def up create_table :online_notifications do |t| - t.column :o_id, :integer, :null => false - t.column :object_lookup_id, :integer, :null => false - t.column :type_lookup_id, :integer, :null => false - t.column :user_id, :integer, :null => false - t.column :seen, :boolean, :null => false, :default => false - t.column :created_by_id, :integer, :null => false + t.column :o_id, :integer, null: false + t.column :object_lookup_id, :integer, null: false + t.column :type_lookup_id, :integer, null: false + t.column :user_id, :integer, null: false + t.column :seen, :boolean, null: false, default: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :online_notifications, [:user_id] diff --git a/db/migrate/20140831000001_create_object_manager.rb b/db/migrate/20140831000001_create_object_manager.rb index 87d905c86..869f1ba07 100644 --- a/db/migrate/20140831000001_create_object_manager.rb +++ b/db/migrate/20140831000001_create_object_manager.rb @@ -1,485 +1,485 @@ class CreateObjectManager < ActiveRecord::Migration def up - add_column :tickets, :pending_time, :timestamp, :null => true + add_column :tickets, :pending_time, :timestamp, null: true add_index :tickets, [:pending_time] - add_column :tickets, :type, :string, :limit => 100, :null => true + add_column :tickets, :type, :string, limit: 100, null: true add_index :tickets, [:type] create_table :object_manager_attributes do |t| - t.references :object_lookup, :null => false - t.column :name, :string, :limit => 200, :null => false - t.column :display, :string, :limit => 200, :null => false - t.column :data_type, :string, :limit => 100, :null => false - t.column :data_option, :string, :limit => 8000, :null => true - t.column :editable, :boolean, :null => false, :default => true - t.column :active, :boolean, :null => false, :default => true - t.column :screens, :string, :limit => 2000, :null => true - t.column :pending_migration, :boolean, :null => false, :default => true - t.column :position, :integer, :null => false - t.column :created_by_id, :integer, :null => false - t.column :updated_by_id, :integer, :null => false + t.references :object_lookup, null: false + t.column :name, :string, limit: 200, null: false + t.column :display, :string, limit: 200, null: false + t.column :data_type, :string, limit: 100, null: false + t.column :data_option, :string, limit: 8000, null: true + t.column :editable, :boolean, null: false, default: true + t.column :active, :boolean, null: false, default: true + t.column :screens, :string, limit: 2000, null: true + t.column :pending_migration, :boolean, null: false, default: true + t.column :position, :integer, null: false + t.column :created_by_id, :integer, null: false + t.column :updated_by_id, :integer, null: false t.timestamps end - add_index :object_manager_attributes, [:object_lookup_id, :name], :unique => true + add_index :object_manager_attributes, [:object_lookup_id, :name], unique: true add_index :object_manager_attributes, [:object_lookup_id] ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'customer_id', - :display => 'Customer', - :data_type => 'user_autocompletion', - :data_option => { - :autocapitalize => false, - :multiple => false, - :null => false, - :limit => 200, - :placeholder => 'Enter Person or Organization/Company', - :minLengt => 2, - :translate => false, + object: 'Ticket', + name: 'customer_id', + display: 'Customer', + data_type: 'user_autocompletion', + data_option: { + autocapitalize: false, + multiple: false, + null: false, + limit: 200, + placeholder: 'Enter Person or Organization/Company', + minLengt: 2, + translate: false, }, - :editable => false, - :active => true, - :screens => { - :create_top => { - :Agent => { - :null => false, + editable: false, + active: true, + screens: { + create_top: { + Agent: { + null: false, }, }, - :edit => {}, + edit: {}, }, - :pending_migration => false, - :position => 10, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 10, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'type', - :display => 'Type', - :data_type => 'select', - :data_option => { - :options => { + object: 'Ticket', + name: 'type', + display: 'Type', + data_type: 'select', + data_option: { + options: { 'Incident' => 'Incident', 'Problem' => 'Problem', 'Request for Change' => 'Request for Change', }, - :nulloption => true, - :multiple => false, - :null => true, - :translate => true, + nulloption: true, + multiple: false, + null: true, + translate: true, }, - :editable => false, - :active => false, - :screens => { - :create_middle => { + editable: false, + active: false, + screens: { + create_middle: { '-all-' => { - :null => false, - :item_class => 'column', + null: false, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => false, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 20, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 20, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'group_id', - :display => 'Group', - :data_type => 'select', - :data_option => { - :relation => 'Group', - :relation_condition => { :access => 'rw' }, - :nulloption => true, - :multiple => false, - :null => false, - :translate => false, + object: 'Ticket', + name: 'group_id', + display: 'Group', + data_type: 'select', + data_option: { + relation: 'Group', + relation_condition: { access: 'rw' }, + nulloption: true, + multiple: false, + null: false, + translate: false, }, - :editable => false, - :active => true, - :screens => { - :create_middle => { + editable: false, + active: true, + screens: { + create_middle: { '-all-' => { - :null => false, - :item_class => 'column', + null: false, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => false, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 20, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 20, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'owner_id', - :display => 'Owner', - :data_type => 'select', - :data_option => { - :relation => 'User', - :relation_condition => { :roles => 'Agent' }, - :nulloption => true, - :multiple => false, - :null => true, - :translate => false, + object: 'Ticket', + name: 'owner_id', + display: 'Owner', + data_type: 'select', + data_option: { + relation: 'User', + relation_condition: { roles: 'Agent' }, + nulloption: true, + multiple: false, + null: true, + translate: false, }, - :editable => false, - :active => true, - :screens => { - :create_middle => { - :Agent => { - :null => true, - :item_class => 'column', + editable: false, + active: true, + screens: { + create_middle: { + Agent: { + null: true, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => true, + edit: { + Agent: { + null: true, }, }, }, - :pending_migration => false, - :position => 30, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 30, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'state_id', - :display => 'State', - :data_type => 'select', - :data_option => { - :relation => 'TicketState', - :nulloption => true, - :multiple => false, - :null => false, - :default => 2, - :translate => true, - :filter => [1,2,3,4,7], + object: 'Ticket', + name: 'state_id', + display: 'State', + data_type: 'select', + data_option: { + relation: 'TicketState', + nulloption: true, + multiple: false, + null: false, + default: 2, + translate: true, + filter: [1,2,3,4,7], }, - :editable => false, - :active => true, - :screens => { - :create_middle => { - :Agent => { - :null => false, - :item_class => 'column', + editable: false, + active: true, + screens: { + create_middle: { + Agent: { + null: false, + item_class: 'column', }, - :Customer => { - :item_class => 'column', - :nulloption => false, - :null => true, - :filter => [1,4], - :default => 1, + Customer: { + item_class: 'column', + nulloption: false, + null: true, + filter: [1,4], + default: 1, }, }, - :edit => { - :Agent => { - :nulloption => false, - :null => false, - :filter => [2,3,4,7], + edit: { + Agent: { + nulloption: false, + null: false, + filter: [2,3,4,7], }, - :Customer => { - :nulloption => false, - :null => true, - :filter => [2,4], - :default => 2, + Customer: { + nulloption: false, + null: true, + filter: [2,4], + default: 2, }, }, }, - :pending_migration => false, - :position => 40, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 40, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'pending_time', - :display => 'Pending till', - :data_type => 'datetime', - :data_option => { - :future => true, - :past => false, - :diff => 24, - :null => true, - :translate => true, - :required_if => { - :state_id => [3,7] + object: 'Ticket', + name: 'pending_time', + display: 'Pending till', + data_type: 'datetime', + data_option: { + future: true, + past: false, + diff: 24, + null: true, + translate: true, + required_if: { + state_id: [3,7] }, - :shown_if => { - :state_id => [3,7] + shown_if: { + state_id: [3,7] }, }, - :editable => false, - :active => true, - :screens => { - :create_middle => { + editable: false, + active: true, + screens: { + create_middle: { '-all-' => { - :null => false, - :item_class => 'column', + null: false, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => false, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 41, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 41, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'priority_id', - :display => 'Priority', - :data_type => 'select', - :data_option => { - :relation => 'TicketPriority', - :nulloption => true, - :multiple => false, - :null => false, - :default => 2, - :translate => true, + object: 'Ticket', + name: 'priority_id', + display: 'Priority', + data_type: 'select', + data_option: { + relation: 'TicketPriority', + nulloption: true, + multiple: false, + null: false, + default: 2, + translate: true, }, - :editable => false, - :active => true, - :screens => { - :create_middle => { - :Agent => { - :null => false, - :item_class => 'column', + editable: false, + active: true, + screens: { + create_middle: { + Agent: { + null: false, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => false, - :nulloption => false, + edit: { + Agent: { + null: false, + nulloption: false, }, }, }, - :pending_migration => false, - :position => 80, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 80, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'tags', - :display => 'Tags', - :data_type => 'tag', - :data_option => { - :type => 'text', - :null => true, - :translate => false, + object: 'Ticket', + name: 'tags', + display: 'Tags', + data_type: 'tag', + data_option: { + type: 'text', + null: true, + translate: false, }, - :editable => false, - :active => true, - :screens => { - :create_bottom => { - :Agent => { - :null => true, + editable: false, + active: true, + screens: { + create_bottom: { + Agent: { + null: true, }, }, - :edit => {}, + edit: {}, }, - :pending_migration => false, - :position => 900, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 900, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'title', - :display => 'Title', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 200, - :null => false, - :translate => false, + object: 'Ticket', + name: 'title', + display: 'Title', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 200, + null: false, + translate: false, }, - :editable => false, - :active => true, - :screens => { - :create_top => { + editable: false, + active: true, + screens: { + create_top: { '-all-' => { - :null => false, + null: false, }, }, - :edit => {}, + edit: {}, }, - :pending_migration => false, - :position => 15, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 15, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'TicketArticle', - :name => 'type_id', - :display => 'Type', - :data_type => 'select', - :data_option => { - :relation => 'TicketArticleType', - :nulloption => false, - :multiple => false, - :null => false, - :default => 9, - :translate => true, + object: 'TicketArticle', + name: 'type_id', + display: 'Type', + data_type: 'select', + data_option: { + relation: 'TicketArticleType', + nulloption: false, + multiple: false, + null: false, + default: 9, + translate: true, }, - :editable => false, - :active => true, - :screens => { - :create_middle => {}, - :edit => { - :Agent => { - :null => false, + editable: false, + active: true, + screens: { + create_middle: {}, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 100, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 100, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'TicketArticle', - :name => 'internal', - :display => 'Visibility', - :data_type => 'select', - :data_option => { - :options => { :true => 'internal', :false => 'public' }, - :nulloption => false, - :multiple => false, - :null => true, - :default => false, - :translate => true, + object: 'TicketArticle', + name: 'internal', + display: 'Visibility', + data_type: 'select', + data_option: { + options: { true: 'internal', false: 'public' }, + nulloption: false, + multiple: false, + null: true, + default: false, + translate: true, }, - :editable => false, - :active => true, - :screens => { - :create_middle => {}, - :edit => { - :Agent => { - :null => false, + editable: false, + active: true, + screens: { + create_middle: {}, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 200, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 200, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'TicketArticle', - :name => 'to', - :display => 'To', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 1000, - :null => true, + object: 'TicketArticle', + name: 'to', + display: 'To', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 1000, + null: true, }, - :editable => false, - :active => true, - :screens => { - :create_middle => {}, - :edit => { - :Agent => { - :null => true, + editable: false, + active: true, + screens: { + create_middle: {}, + edit: { + Agent: { + null: true, }, }, }, - :pending_migration => false, - :position => 300, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 300, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'TicketArticle', - :name => 'cc', - :display => 'Cc', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 1000, - :null => true, + object: 'TicketArticle', + name: 'cc', + display: 'Cc', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 1000, + null: true, }, - :editable => false, - :active => true, - :screens => { - :create_phone_in => {}, - :create_phone_out => {}, - :create_email_out => { + editable: false, + active: true, + screens: { + create_phone_in: {}, + create_phone_out: {}, + create_email_out: { '-all-' => { - :null => true, + null: true, } }, - :create_middle => {}, - :edit => { - :Agent => { - :null => true, + create_middle: {}, + edit: { + Agent: { + null: true, }, }, }, - :pending_migration => false, - :position => 400, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 400, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'TicketArticle', - :name => 'body', - :display => 'Text', - :data_type => 'richtext', - :data_option => { - :type => 'richtext', - :maxlength => 20_000, - :upload => true, - :rows => 8, - :null => true, + object: 'TicketArticle', + name: 'body', + display: 'Text', + data_type: 'richtext', + data_option: { + type: 'richtext', + maxlength: 20_000, + upload: true, + rows: 8, + null: true, }, - :editable => false, - :active => true, - :screens => { - :create_top => { + editable: false, + active: true, + screens: { + create_top: { '-all-' => { - :null => false, + null: false, }, }, - :edit => { - :Agent => { - :null => true, + edit: { + Agent: { + null: true, }, - :Customer => { - :null => false, + Customer: { + null: false, }, }, }, - :pending_migration => false, - :position => 600, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 600, + created_by_id: 1, + updated_by_id: 1, ) end diff --git a/db/migrate/20140911000001_update_ticket_article_size.rb b/db/migrate/20140911000001_update_ticket_article_size.rb index 0e8b3f6c9..372491f58 100644 --- a/db/migrate/20140911000001_update_ticket_article_size.rb +++ b/db/migrate/20140911000001_update_ticket_article_size.rb @@ -1,6 +1,6 @@ class UpdateTicketArticleSize < ActiveRecord::Migration def up - change_column :ticket_articles, :body, :text, :limit => 4.megabytes + 1 + change_column :ticket_articles, :body, :text, limit: 4.megabytes + 1 end def down diff --git a/db/migrate/20141119000001_update_setting2.rb b/db/migrate/20141119000001_update_setting2.rb index 2ddb41eb3..7d9de0cec 100644 --- a/db/migrate/20141119000001_update_setting2.rb +++ b/db/migrate/20141119000001_update_setting2.rb @@ -1,22 +1,22 @@ class UpdateSetting2 < ActiveRecord::Migration def up Setting.create_if_not_exists( - :title => 'Logo', - :name => 'product_logo', - :area => 'System::CI', - :description => 'Defines the logo of the application, shown in the web interface.', - :options => { - :form => [ + title: 'Logo', + name: 'product_logo', + area: 'System::CI', + description: 'Defines the logo of the application, shown in the web interface.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'product_logo', - :tag => 'input', + display: '', + null: false, + name: 'product_logo', + tag: 'input', }, ], }, - :state => 'logo.svg', - :frontend => true + state: 'logo.svg', + frontend: true ) end diff --git a/db/migrate/20141120000001_update_setting3.rb b/db/migrate/20141120000001_update_setting3.rb index 4c0a2414f..e2e6cb4dd 100644 --- a/db/migrate/20141120000001_update_setting3.rb +++ b/db/migrate/20141120000001_update_setting3.rb @@ -1,13 +1,13 @@ class UpdateSetting3 < ActiveRecord::Migration def up Setting.create_if_not_exists( - :title => 'Online Service', - :name => 'system_online_service', - :area => 'Core', - :description => 'Defines if application is used as online service.', - :options => {}, - :state => false, - :frontend => true + title: 'Online Service', + name: 'system_online_service', + area: 'Core', + description: 'Defines if application is used as online service.', + options: {}, + state: false, + frontend: true ) end diff --git a/db/migrate/20141126000001_create_avatar.rb b/db/migrate/20141126000001_create_avatar.rb index f518df5c3..adb15706a 100644 --- a/db/migrate/20141126000001_create_avatar.rb +++ b/db/migrate/20141126000001_create_avatar.rb @@ -1,18 +1,18 @@ class CreateAvatar < ActiveRecord::Migration def up create_table :avatars do |t| - t.column :o_id, :integer, :null => false - t.column :object_lookup_id, :integer, :null => false - t.column :default, :boolean, :null => false, :default => false - t.column :deletable, :boolean, :null => false, :default => true - t.column :inital, :boolean, :null => false, :default => false - t.column :store_full_id, :integer, :null => true - t.column :store_resize_id, :integer, :null => true - t.column :store_hash, :string, :limit => 32, :null => true - t.column :source, :string, :limit => 100, :null => false - t.column :source_url, :string, :limit => 512, :null => true - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :o_id, :integer, null: false + t.column :object_lookup_id, :integer, null: false + t.column :default, :boolean, null: false, default: false + t.column :deletable, :boolean, null: false, default: true + t.column :inital, :boolean, null: false, default: false + t.column :store_full_id, :integer, null: true + t.column :store_resize_id, :integer, null: true + t.column :store_hash, :string, limit: 32, null: true + t.column :source, :string, limit: 100, null: false + t.column :source_url, :string, limit: 512, null: true + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end add_index :avatars, [:o_id, :object_lookup_id] diff --git a/db/migrate/20141217000001_update_object_manager2.rb b/db/migrate/20141217000001_update_object_manager2.rb index b0c2be88f..7cda354ca 100644 --- a/db/migrate/20141217000001_update_object_manager2.rb +++ b/db/migrate/20141217000001_update_object_manager2.rb @@ -4,747 +4,747 @@ class UpdateObjectManager2 < ActiveRecord::Migration #remove_index :object_manager_attributes, [:name] ObjectManager::Attribute.add( - :object => 'User', - :name => 'login', - :display => 'Login', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 100, - :null => true, - :autocapitalize => false, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'login', + display: 'Login', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 100, + null: true, + autocapitalize: false, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => {}, - :view => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: {}, + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 100, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 100, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'firstname', - :display => 'Firstname', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 150, - :null => false, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'firstname', + display: 'Firstname', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 150, + null: false, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => { + editable: false, + active: true, + screens: { + signup: { '-all-' => { - :null => false, + null: false, }, }, - :invite_agent => { + invite_agent: { '-all-' => { - :null => false, + null: false, }, }, - :edit => { + edit: { '-all-' => { - :null => false, + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 200, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 200, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'lastname', - :display => 'Lastname', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 150, - :null => false, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'lastname', + display: 'Lastname', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 150, + null: false, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => { + editable: false, + active: true, + screens: { + signup: { '-all-' => { - :null => false, + null: false, }, }, - :invite_agent => { + invite_agent: { '-all-' => { - :null => false, + null: false, }, }, - :edit => { + edit: { '-all-' => { - :null => false, + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 300, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 300, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'email', - :display => 'Email', - :data_type => 'input', - :data_option => { - :type => 'email', - :maxlength => 150, - :null => false, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'email', + display: 'Email', + data_type: 'input', + data_option: { + type: 'email', + maxlength: 150, + null: false, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => { + editable: false, + active: true, + screens: { + signup: { '-all-' => { - :null => false, + null: false, }, }, - :invite_agent => { + invite_agent: { '-all-' => { - :null => false, + null: false, }, }, - :edit => { + edit: { '-all-' => { - :null => false, + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 400, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 400, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'web', - :display => 'Web', - :data_type => 'input', - :data_option => { - :type => 'url', - :maxlength => 250, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'web', + display: 'Web', + data_type: 'input', + data_option: { + type: 'url', + maxlength: 250, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 500, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 500, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'phone', - :display => 'Phone', - :data_type => 'input', - :data_option => { - :type => 'phone', - :maxlength => 100, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'phone', + display: 'Phone', + data_type: 'input', + data_option: { + type: 'phone', + maxlength: 100, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 600, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 600, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'mobile', - :display => 'Mobile', - :data_type => 'input', - :data_option => { - :type => 'phone', - :maxlength => 100, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'mobile', + display: 'Mobile', + data_type: 'input', + data_option: { + type: 'phone', + maxlength: 100, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 700, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 700, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'fax', - :display => 'Fax', - :data_type => 'input', - :data_option => { - :type => 'phone', - :maxlength => 100, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'fax', + display: 'Fax', + data_type: 'input', + data_option: { + type: 'phone', + maxlength: 100, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 800, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 800, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'organization_id', - :display => 'Organization', - :data_type => 'select', - :data_option => { - :multiple => false, - :nulloption => true, - :null => true, - :relation => 'Organization', - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'organization_id', + display: 'Organization', + data_type: 'select', + data_option: { + multiple: false, + nulloption: true, + null: true, + relation: 'Organization', + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 900, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 900, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'department', - :display => 'Department', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 200, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'department', + display: 'Department', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 200, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1000, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1000, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'street', - :display => 'Street', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 100, - :null => true, + object: 'User', + name: 'street', + display: 'Street', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 100, + null: true, }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1100, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1100, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'zip', - :display => 'Zip', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 100, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'zip', + display: 'Zip', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 100, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1200, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1200, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'city', - :display => 'City', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 100, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'city', + display: 'City', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 100, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1300, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1300, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'password', - :display => 'Password', - :data_type => 'input', - :data_option => { - :type => 'password', - :maxlength => 100, - :null => true, - :autocomplete => 'off', - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'password', + display: 'Password', + data_type: 'input', + data_option: { + type: 'password', + maxlength: 100, + null: true, + autocomplete: 'off', + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => { + editable: false, + active: true, + screens: { + signup: { '-all-' => { - :null => false, + null: false, }, }, - :invite_agent => {}, - :edit => { - :Admin => { - :null => true, + invite_agent: {}, + edit: { + Admin: { + null: true, }, }, - :view => {} + view: {} }, - :pending_migration => false, - :position => 1400, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1400, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'note', - :display => 'Note', - :data_type => 'richtext', - :data_option => { - :type => 'text', - :maxlength => 250, - :null => true, - :note => 'Notes are visible to agents only, never to customers.', + object: 'User', + name: 'note', + display: 'Note', + data_type: 'richtext', + data_option: { + type: 'text', + maxlength: 250, + null: true, + note: 'Notes are visible to agents only, never to customers.', # :item_class => 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1500, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1500, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'role_ids', - :display => 'Roles', - :data_type => 'checkbox', - :data_option => { - :multiple => true, - :null => false, - :relation => 'Role', + object: 'User', + name: 'role_ids', + display: 'Roles', + data_type: 'checkbox', + data_option: { + multiple: true, + null: false, + relation: 'Role', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1600, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1600, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'group_ids', - :display => 'Groups', - :data_type => 'checkbox', - :data_option => { - :multiple => true, - :null => true, - :relation => 'Group', + object: 'User', + name: 'group_ids', + display: 'Groups', + data_type: 'checkbox', + data_option: { + multiple: true, + null: true, + relation: 'Group', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: { '-all-' => { - :null => false, + null: false, }, }, - :edit => { - :Admin => { - :null => true, + edit: { + Admin: { + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1700, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1700, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'active', - :display => 'Active', - :data_type => 'active', - :data_option => { - :null => true, - :default => true, + object: 'User', + name: 'active', + display: 'Active', + data_type: 'active', + data_option: { + null: true, + default: true, }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1800, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1800, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Organization', - :name => 'name', - :display => 'Name', - :data_type => 'input', - :data_option => { - :type => 'text', - :maxlength => 150, - :null => false, - :item_class => 'formGroup--halfSize', + object: 'Organization', + name: 'name', + display: 'Name', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 150, + null: false, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :edit => { + editable: false, + active: true, + screens: { + edit: { '-all-' => { - :null => false, + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 200, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 200, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Organization', - :name => 'shared', - :display => 'Shared organization', - :data_type => 'boolean', - :data_option => { - :maxlength => 250, - :null => true, - :default => true, - :note => 'Customers in the organization can view each other items.', - :item_class => 'formGroup--halfSize', - :options => { - :true => 'Yes', - :false => 'No', + object: 'Organization', + name: 'shared', + display: 'Shared organization', + data_type: 'boolean', + data_option: { + maxlength: 250, + null: true, + default: true, + note: 'Customers in the organization can view each other items.', + item_class: 'formGroup--halfSize', + options: { + true: 'Yes', + false: 'No', } }, - :editable => false, - :active => true, - :screens => { - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1400, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1400, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Organization', - :name => 'note', - :display => 'Note', - :data_type => 'richtext', - :data_option => { - :type => 'text', - :maxlength => 250, - :null => true, - :note => 'Notes are visible to agents only, never to customers.', + object: 'Organization', + name: 'note', + display: 'Note', + data_type: 'richtext', + data_option: { + type: 'text', + maxlength: 250, + null: true, + note: 'Notes are visible to agents only, never to customers.', }, - :editable => false, - :active => true, - :screens => { - :edit => { + editable: false, + active: true, + screens: { + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1500, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1500, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Organization', - :name => 'active', - :display => 'Active', - :data_type => 'active', - :data_option => { - :default => true, + object: 'Organization', + name: 'active', + display: 'Active', + data_type: 'active', + data_option: { + default: true, }, - :editable => false, - :active => true, - :screens => { - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1800, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1800, + created_by_id: 1, + updated_by_id: 1, ) end diff --git a/db/migrate/20141221000001_create_job.rb b/db/migrate/20141221000001_create_job.rb index e869967ec..a1898d184 100644 --- a/db/migrate/20141221000001_create_job.rb +++ b/db/migrate/20141221000001_create_job.rb @@ -1,22 +1,22 @@ class CreateJob < ActiveRecord::Migration def up create_table :jobs do |t| - t.column :name, :string, :limit => 250, :null => false - t.column :timeplan, :string, :limit => 500, :null => false - t.column :condition, :string, :limit => 2500, :null => false - t.column :execute, :string, :limit => 2500, :null => false - t.column :last_run_at, :timestamp, :null => true - t.column :running, :boolean, :null => false, :default => false - t.column :processed, :integer, :null => false, :default => 0 - t.column :matching, :integer, :null => false - t.column :pid, :string, :limit => 250, :null => true - t.column :note, :string, :limit => 250, :null => true - t.column :active, :boolean, :null => false, :default => false - t.column :updated_by_id, :integer, :null => false - t.column :created_by_id, :integer, :null => false + t.column :name, :string, limit: 250, null: false + t.column :timeplan, :string, limit: 500, null: false + t.column :condition, :string, limit: 2500, null: false + t.column :execute, :string, limit: 2500, null: false + t.column :last_run_at, :timestamp, null: true + t.column :running, :boolean, null: false, default: false + t.column :processed, :integer, null: false, default: 0 + t.column :matching, :integer, null: false + t.column :pid, :string, limit: 250, null: true + t.column :note, :string, limit: 250, null: true + t.column :active, :boolean, null: false, default: false + t.column :updated_by_id, :integer, null: false + t.column :created_by_id, :integer, null: false t.timestamps end - add_index :jobs, [:name], :unique => true + add_index :jobs, [:name], unique: true end def down diff --git a/db/migrate/20141227000001_update_ticket_article.rb b/db/migrate/20141227000001_update_ticket_article.rb index 069411d58..35e60c89c 100644 --- a/db/migrate/20141227000001_update_ticket_article.rb +++ b/db/migrate/20141227000001_update_ticket_article.rb @@ -1,6 +1,6 @@ class UpdateTicketArticle < ActiveRecord::Migration def up - add_column :ticket_articles, :content_type, :string, :limit => 20, :null => false, :default => 'text/plain' + add_column :ticket_articles, :content_type, :string, limit: 20, null: false, default: 'text/plain' end def down diff --git a/db/migrate/20141231000001_add_develop_mode.rb b/db/migrate/20141231000001_add_develop_mode.rb index fa2cf165b..e2855ecdc 100644 --- a/db/migrate/20141231000001_add_develop_mode.rb +++ b/db/migrate/20141231000001_add_develop_mode.rb @@ -1,13 +1,13 @@ class AddDevelopMode < ActiveRecord::Migration def up Setting.create_if_not_exists( - :title => 'Develop System', - :name => 'developer_mode', - :area => 'Core::Develop', - :description => 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).', - :options => {}, - :state => false, - :frontend => true + title: 'Develop System', + name: 'developer_mode', + area: 'Core::Develop', + description: 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).', + options: {}, + state: false, + frontend: true ) end diff --git a/db/migrate/20150112000001_update_overview_and_ticket_state.rb b/db/migrate/20150112000001_update_overview_and_ticket_state.rb index 7d62fd38f..e68228751 100644 --- a/db/migrate/20150112000001_update_overview_and_ticket_state.rb +++ b/db/migrate/20150112000001_update_overview_and_ticket_state.rb @@ -2,122 +2,122 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration def up # if we are on upgrade mode - overview_role = Role.where( :name => 'Agent' ).first - add_column :ticket_states, :next_state_id, :integer, :null => true + overview_role = Role.where( name: 'Agent' ).first + add_column :ticket_states, :next_state_id, :integer, null: true UserInfo.current_user_id = 1 if overview_role Overview.create_or_update( - :name => 'My pending reached Tickets', - :link => 'my_pending_reached', - :prio => 1010, - :role_id => overview_role.id, - :condition => { + name: 'My pending reached Tickets', + link: 'my_pending_reached', + prio: 1010, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [3], 'tickets.owner_id' => 'current_user.id', 'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'created_at' ], + s: [ 'title', 'customer', 'group', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'created_at' ], + view_mode_default: 's', }, ) - Ticket::State.create_or_update( :id => 3, :name => 'pending reminder', :state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id ) - Ticket::State.create_or_update( :id => 6, :name => 'removed', :state_type_id => Ticket::StateType.where(:name => 'removed').first.id, :active => false ) - Ticket::State.create_or_update( :id => 7, :name => 'pending close', :state_type_id => Ticket::StateType.where(:name => 'pending action').first.id ) + Ticket::State.create_or_update( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.where(name: 'pending reminder').first.id ) + Ticket::State.create_or_update( id: 6, name: 'removed', state_type_id: Ticket::StateType.where(name: 'removed').first.id, active: false ) + Ticket::State.create_or_update( id: 7, name: 'pending close', state_type_id: Ticket::StateType.where(name: 'pending action').first.id ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'state_id', - :display => 'State', - :data_type => 'select', - :data_option => { - :relation => 'TicketState', - :nulloption => true, - :multiple => false, - :null => false, - :default => 2, - :translate => true, - :filter => [1,2,3,4,7], + object: 'Ticket', + name: 'state_id', + display: 'State', + data_type: 'select', + data_option: { + relation: 'TicketState', + nulloption: true, + multiple: false, + null: false, + default: 2, + translate: true, + filter: [1,2,3,4,7], }, - :editable => false, - :active => true, - :screens => { - :create_middle => { - :Agent => { - :null => false, - :item_class => 'column', + editable: false, + active: true, + screens: { + create_middle: { + Agent: { + null: false, + item_class: 'column', }, - :Customer => { - :item_class => 'column', - :nulloption => false, - :null => true, - :filter => [1,4], - :default => 1, + Customer: { + item_class: 'column', + nulloption: false, + null: true, + filter: [1,4], + default: 1, }, }, - :edit => { - :Agent => { - :nulloption => false, - :null => false, - :filter => [2,3,4,7], + edit: { + Agent: { + nulloption: false, + null: false, + filter: [2,3,4,7], }, - :Customer => { - :nulloption => false, - :null => true, - :filter => [2,4], - :default => 2, + Customer: { + nulloption: false, + null: true, + filter: [2,4], + default: 2, }, }, }, - :pending_migration => false, - :position => 40, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 40, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Ticket', - :name => 'pending_time', - :display => 'Pending till', - :data_type => 'datetime', - :data_option => { - :future => true, - :past => false, - :diff => 24, - :null => true, - :translate => true, - :required_if => { - :state_id => [3,7] + object: 'Ticket', + name: 'pending_time', + display: 'Pending till', + data_type: 'datetime', + data_option: { + future: true, + past: false, + diff: 24, + null: true, + translate: true, + required_if: { + state_id: [3,7] }, - :shown_if => { - :state_id => [3,7] + shown_if: { + state_id: [3,7] }, }, - :editable => false, - :active => true, - :screens => { - :create_middle => { + editable: false, + active: true, + screens: { + create_middle: { '-all-' => { - :null => false, - :item_class => 'column', + null: false, + item_class: 'column', }, }, - :edit => { - :Agent => { - :null => false, + edit: { + Agent: { + null: false, }, }, }, - :pending_migration => false, - :position => 41, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 41, + created_by_id: 1, + updated_by_id: 1, ) end end diff --git a/db/migrate/20150206000001_create_vip.rb b/db/migrate/20150206000001_create_vip.rb index ec3cd4c24..fd48bee4b 100644 --- a/db/migrate/20150206000001_create_vip.rb +++ b/db/migrate/20150206000001_create_vip.rb @@ -1,43 +1,43 @@ class CreateVip < ActiveRecord::Migration def up - add_column :users, :vip, :boolean, :default => false + add_column :users, :vip, :boolean, default: false ObjectManager::Attribute.add( - :object => 'User', - :name => 'vip', - :display => 'VIP', - :data_type => 'boolean', - :data_option => { - :null => true, - :default => false, - :item_class => 'formGroup--halfSize', - :options => { - :false => 'no', - :true => 'yes', + object: 'User', + name: 'vip', + display: 'VIP', + data_type: 'boolean', + data_option: { + null: true, + default: false, + item_class: 'formGroup--halfSize', + options: { + false: 'no', + true: 'yes', }, - :translate => true, + translate: true, }, - :editable => false, - :active => true, - :screens => { - :edit => { - :Admin => { - :null => true, + editable: false, + active: true, + screens: { + edit: { + Admin: { + null: true, }, - :Agent => { - :null => true, + Agent: { + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1490, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1490, + created_by_id: 1, + updated_by_id: 1, ) end diff --git a/db/migrate/20150206000002_create_address.rb b/db/migrate/20150206000002_create_address.rb index 3cdabbd18..0e2466b29 100644 --- a/db/migrate/20150206000002_create_address.rb +++ b/db/migrate/20150206000002_create_address.rb @@ -1,6 +1,6 @@ class CreateAddress < ActiveRecord::Migration def up - add_column :users, :address, :string, :limit => 500, :null => true + add_column :users, :address, :string, limit: 500, null: true User.all.each {|user| address = '' @@ -21,8 +21,8 @@ class CreateAddress < ActiveRecord::Migration ['street', 'zip', 'city', 'department'].each {|attribute_name| attribute = ObjectManager::Attribute.get( - :object => 'User', - :name => attribute_name, + object: 'User', + name: attribute_name, ) if attribute attribute.active = false @@ -31,36 +31,36 @@ class CreateAddress < ActiveRecord::Migration } ObjectManager::Attribute.add( - :object => 'User', - :name => 'address', - :display => 'Address', - :data_type => 'textarea', - :data_option => { - :type => 'text', - :maxlength => 500, - :null => true, - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'address', + display: 'Address', + data_type: 'textarea', + data_option: { + type: 'text', + maxlength: 500, + null: true, + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { '-all-' => { - :null => true, + null: true, }, }, - :view => { + view: { '-all-' => { - :shown => true, + shown: true, }, }, }, - :pending_migration => false, - :position => 1350, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1350, + created_by_id: 1, + updated_by_id: 1, ) end diff --git a/db/migrate/20150208000001_update_object_manager3.rb b/db/migrate/20150208000001_update_object_manager3.rb index cee532577..6ff3b8b88 100644 --- a/db/migrate/20150208000001_update_object_manager3.rb +++ b/db/migrate/20150208000001_update_object_manager3.rb @@ -2,95 +2,95 @@ class UpdateObjectManager3 < ActiveRecord::Migration def up ObjectManager::Attribute.add( - :object => 'User', - :name => 'active', - :display => 'Active', - :data_type => 'active', - :data_option => { - :default => true, + object: 'User', + name: 'active', + display: 'Active', + data_type: 'active', + data_option: { + default: true, }, - :editable => false, - :active => true, - :screens => { - :signup => {}, - :invite_agent => {}, - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1800, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1800, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'Organization', - :name => 'active', - :display => 'Active', - :data_type => 'active', - :data_option => { - :default => true, + object: 'Organization', + name: 'active', + display: 'Active', + data_type: 'active', + data_option: { + default: true, }, - :editable => false, - :active => true, - :screens => { - :edit => { - :Admin => { - :null => false, + editable: false, + active: true, + screens: { + edit: { + Admin: { + null: false, }, }, - :view => { + view: { '-all-' => { - :shown => false, + shown: false, }, }, }, - :pending_migration => false, - :position => 1800, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1800, + created_by_id: 1, + updated_by_id: 1, ) ObjectManager::Attribute.add( - :object => 'User', - :name => 'password', - :display => 'Password', - :data_type => 'input', - :data_option => { - :type => 'password', - :maxlength => 100, - :null => true, - :autocomplete => 'off', - :item_class => 'formGroup--halfSize', + object: 'User', + name: 'password', + display: 'Password', + data_type: 'input', + data_option: { + type: 'password', + maxlength: 100, + null: true, + autocomplete: 'off', + item_class: 'formGroup--halfSize', }, - :editable => false, - :active => true, - :screens => { - :signup => { + editable: false, + active: true, + screens: { + signup: { '-all-' => { - :null => false, + null: false, }, }, - :invite_agent => {}, - :edit => { - :Admin => { - :null => true, + invite_agent: {}, + edit: { + Admin: { + null: true, }, }, - :view => {} + view: {} }, - :pending_migration => false, - :position => 1400, - :created_by_id => 1, - :updated_by_id => 1, + pending_migration: false, + position: 1400, + created_by_id: 1, + updated_by_id: 1, ) end diff --git a/db/migrate/20150223000001_update_overview2.rb b/db/migrate/20150223000001_update_overview2.rb index adddcc9fe..9af6d1d92 100644 --- a/db/migrate/20150223000001_update_overview2.rb +++ b/db/migrate/20150223000001_update_overview2.rb @@ -1,27 +1,27 @@ class UpdateOverview2 < ActiveRecord::Migration def up - overview_role = Role.where( :name => 'Agent' ).first + overview_role = Role.where( name: 'Agent' ).first if overview_role UserInfo.current_user_id = 1 Overview.create_or_update( - :name => 'My assigned Tickets', - :link => 'my_assigned', - :prio => 1000, - :role_id => overview_role.id, - :condition => { + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 1000, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [ 1,2,3,7 ], 'tickets.owner_id' => 'current_user.id', }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'created_at' ], + s: [ 'title', 'customer', 'group', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'created_at' ], + view_mode_default: 's', }, ) end diff --git a/db/migrate/20150322000001_update_geo_ip_config.rb b/db/migrate/20150322000001_update_geo_ip_config.rb index 0a036d2b7..35ddd8bfb 100644 --- a/db/migrate/20150322000001_update_geo_ip_config.rb +++ b/db/migrate/20150322000001_update_geo_ip_config.rb @@ -1,26 +1,26 @@ class UpdateGeoIpConfig < ActiveRecord::Migration def up Setting.create_or_update( - :title => 'Geo IP Backend', - :name => 'geo_ip_backend', - :area => 'System::Geo', - :description => 'Defines the backend for geo ip lookups.', - :options => { - :form => [ + title: 'Geo IP Backend', + name: 'geo_ip_backend', + area: 'System::Geo', + description: 'Defines the backend for geo ip lookups.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'geo_ip_backend', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'geo_ip_backend', + tag: 'select', + options: { '' => '-', 'GeoIp::ZammadGeoIp' => 'Zammad GeoIP Service', }, }, ], }, - :state => 'GeoIp::ZammadGeoIp', - :frontend => false + state: 'GeoIp::ZammadGeoIp', + frontend: false ) end diff --git a/db/migrate/20150421000000_create_locale.rb b/db/migrate/20150421000000_create_locale.rb index 768f7049c..53e00e4b0 100644 --- a/db/migrate/20150421000000_create_locale.rb +++ b/db/migrate/20150421000000_create_locale.rb @@ -1,21 +1,21 @@ class CreateLocale < ActiveRecord::Migration def up create_table :locales do |t| - t.string :locale, :limit => 20, :null => false - t.string :alias, :limit => 20, :null => true - t.string :name, :limit => 255, :null => false - t.boolean :active, :null => false, :default => true + t.string :locale, limit: 20, null: false + t.string :alias, limit: 20, null: true + t.string :name, limit: 255, null: false + t.boolean :active, null: false, default: true t.timestamps null: false end - add_index :locales, [:locale], :unique => true - add_index :locales, [:name], :unique => true + add_index :locales, [:locale], unique: true + add_index :locales, [:name], unique: true Locale.create( - :locale => 'en-us', - :alias => 'en', - :name => 'English (United States)', + locale: 'en-us', + alias: 'en', + name: 'English (United States)', ) end diff --git a/db/migrate/20150421000001_update_translation.rb b/db/migrate/20150421000001_update_translation.rb index 3a1c8ea0f..14b050e09 100644 --- a/db/migrate/20150421000001_update_translation.rb +++ b/db/migrate/20150421000001_update_translation.rb @@ -1,6 +1,6 @@ class UpdateTranslation < ActiveRecord::Migration def up - add_column :translations, :format, :string, :limit => 20, :null => false, :default => 'string' + add_column :translations, :format, :string, limit: 20, null: false, default: 'string' end def down diff --git a/db/seeds.rb b/db/seeds.rb index aa2d90572..e4e22b95b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,101 +7,101 @@ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name => 'Emanuel', :city => cities.first) Setting.create_if_not_exists( - :title => 'System Init Done', - :name => 'system_init_done', - :area => 'Core', - :description => 'Defines if application is in init mode.', - :options => {}, - :state => false, - :frontend => true + title: 'System Init Done', + name: 'system_init_done', + area: 'Core', + description: 'Defines if application is in init mode.', + options: {}, + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Developer System', - :name => 'developer_mode', - :area => 'Core::Develop', - :description => 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).', - :options => {}, - :state => false, - :frontend => true + title: 'Developer System', + name: 'developer_mode', + area: 'Core::Develop', + description: 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).', + options: {}, + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Online Service', - :name => 'system_online_service', - :area => 'Core', - :description => 'Defines if application is used as online service.', - :options => {}, - :state => false, - :frontend => true + title: 'Online Service', + name: 'system_online_service', + area: 'Core', + description: 'Defines if application is used as online service.', + options: {}, + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Product Name', - :name => 'product_name', - :area => 'System::Base', - :description => 'Defines the name of the application, shown in the web interface, tabs and title bar of the web browser.', - :options => { - :form => [ + title: 'Product Name', + name: 'product_name', + area: 'System::Base', + description: 'Defines the name of the application, shown in the web interface, tabs and title bar of the web browser.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'product_name', - :tag => 'input', + display: '', + null: false, + name: 'product_name', + tag: 'input', }, ], }, - :state => 'Zammad', - :frontend => true + state: 'Zammad', + frontend: true ) Setting.create_if_not_exists( - :title => 'Logo', - :name => 'product_logo', - :area => 'System::CI', - :description => 'Defines the logo of the application, shown in the web interface.', - :options => { - :form => [ + title: 'Logo', + name: 'product_logo', + area: 'System::CI', + description: 'Defines the logo of the application, shown in the web interface.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'product_logo', - :tag => 'input', + display: '', + null: false, + name: 'product_logo', + tag: 'input', }, ], }, - :state => 'logo.svg', - :frontend => true + state: 'logo.svg', + frontend: true ) Setting.create_if_not_exists( - :title => 'Organization', - :name => 'organization', - :area => 'System::Base', - :description => 'Will also be included in emails as an X-Header.', - :options => { - :form => [ + title: 'Organization', + name: 'organization', + area: 'System::Base', + description: 'Will also be included in emails as an X-Header.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'organization', - :tag => 'input', + display: '', + null: false, + name: 'organization', + tag: 'input', }, ], }, - :state => '', - :frontend => true + state: '', + frontend: true ) Setting.create_if_not_exists( - :title => 'SystemID', - :name => 'system_id', - :area => 'System::Base', - :description => 'Defines the system identifier. Every ticket number contains this ID. This ensures that only tickets which belong to your system will be processed as follow-ups (useful when communicating between two instances of Zammad).', - :options => { - :form => [ + title: 'SystemID', + name: 'system_id', + area: 'System::Base', + description: 'Defines the system identifier. Every ticket number contains this ID. This ensures that only tickets which belong to your system will be processed as follow-ups (useful when communicating between two instances of Zammad).', + options: { + form: [ { - :display => '', - :null => true, - :name => 'system_id', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'system_id', + tag: 'select', + options: { '10' => '10', '11' => '11', '12' => '12', @@ -110,455 +110,455 @@ Setting.create_if_not_exists( }, ], }, - :state => '10', - :frontend => true + state: '10', + frontend: true ) Setting.create_if_not_exists( - :title => 'Fully Qualified Domain Name', - :name => 'fqdn', - :area => 'System::Base', - :description => 'Defines the fully qualified domain name of the system. This setting is used as a variable, #{setting.fqdn} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', - :options => { - :form => [ + title: 'Fully Qualified Domain Name', + name: 'fqdn', + area: 'System::Base', + description: 'Defines the fully qualified domain name of the system. This setting is used as a variable, #{setting.fqdn} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'fqdn', - :tag => 'input', + display: '', + null: false, + name: 'fqdn', + tag: 'input', }, ], }, - :state => 'zammad.example.com', - :frontend => true + state: 'zammad.example.com', + frontend: true ) Setting.create_if_not_exists( - :title => 'http type', - :name => 'http_type', - :area => 'System::Base', - :description => 'Defines the type of protocol, used by the web server, to serve the application. If https protocol will be used instead of plain http, it must be specified in here. Since this has no affect on the web server\'s settings or behavior, it will not change the method of access to the application and, if it is wrong, it will not prevent you from logging into the application. This setting is used as a variable, #{setting.http_type} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', - :options => { - :form => [ + title: 'http type', + name: 'http_type', + area: 'System::Base', + description: 'Defines the type of protocol, used by the web server, to serve the application. If https protocol will be used instead of plain http, it must be specified in here. Since this has no affect on the web server\'s settings or behavior, it will not change the method of access to the application and, if it is wrong, it will not prevent you from logging into the application. This setting is used as a variable, #{setting.http_type} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'http_type', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'http_type', + tag: 'select', + options: { 'https' => 'https', 'http' => 'http', }, }, ], }, - :state => 'http', - :frontend => true + state: 'http', + frontend: true ) Setting.create_if_not_exists( - :title => 'Storage Mechanism', - :name => 'storage', - :area => 'System::Storage', - :description => '"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data on the filesystem. You can switch between the modules even on a system that is already in production without any loss of data.', - :options => { - :form => [ + title: 'Storage Mechanism', + name: 'storage', + area: 'System::Storage', + description: '"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data on the filesystem. You can switch between the modules even on a system that is already in production without any loss of data.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'storage', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'storage', + tag: 'select', + options: { 'DB' => 'Database', 'FS' => 'Filesystem', }, }, ], }, - :state => 'DB', - :frontend => false + state: 'DB', + frontend: false ) Setting.create_if_not_exists( - :title => 'Geo Location Backend', - :name => 'geo_location_backend', - :area => 'System::Geo', - :description => 'Defines the backend for geo location lookups.', - :options => { - :form => [ + title: 'Geo Location Backend', + name: 'geo_location_backend', + area: 'System::Geo', + description: 'Defines the backend for geo location lookups.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'geo_location_backend', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'geo_location_backend', + tag: 'select', + options: { '' => '-', 'GeoLocation::Gmaps' => 'Google Maps', }, }, ], }, - :state => 'GeoLocation::Gmaps', - :frontend => false + state: 'GeoLocation::Gmaps', + frontend: false ) Setting.create_if_not_exists( - :title => 'Geo IP Backend', - :name => 'geo_ip_backend', - :area => 'System::Geo', - :description => 'Defines the backend for geo ip lookups.', - :options => { - :form => [ + title: 'Geo IP Backend', + name: 'geo_ip_backend', + area: 'System::Geo', + description: 'Defines the backend for geo ip lookups.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'geo_ip_backend', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'geo_ip_backend', + tag: 'select', + options: { '' => '-', 'GeoIp::ZammadGeoIp' => 'Zammad GeoIP Service', }, }, ], }, - :state => 'GeoIp::ZammadGeoIp', - :frontend => false + state: 'GeoIp::ZammadGeoIp', + frontend: false ) Setting.create_if_not_exists( - :title => 'Send client stats', - :name => 'ui_send_client_stats', - :area => 'System::UI', - :description => 'Send client stats to central server.', - :options => { - :form => [ + title: 'Send client stats', + name: 'ui_send_client_stats', + area: 'System::UI', + description: 'Send client stats to central server.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ui_send_client_stats', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'ui_send_client_stats', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Client storage', - :name => 'ui_client_storage', - :area => 'System::UI', - :description => 'Use client storage to cache data to perform speed of application.', - :options => { - :form => [ + title: 'Client storage', + name: 'ui_client_storage', + area: 'System::UI', + description: 'Use client storage to cache data to perform speed of application.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ui_client_storage', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'ui_client_storage', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'New User Accounts', - :name => 'user_create_account', - :area => 'Security::Base', - :description => 'Enables users to create their own account via web interface.', - :options => { - :form => [ + title: 'New User Accounts', + name: 'user_create_account', + area: 'Security::Base', + description: 'Enables users to create their own account via web interface.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'user_create_account', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'user_create_account', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Lost Password', - :name => 'user_lost_password', - :area => 'Security::Base', - :description => 'Activates lost password feature for agents, in the agent interface.', - :options => { - :form => [ + title: 'Lost Password', + name: 'user_lost_password', + area: 'Security::Base', + description: 'Activates lost password feature for agents, in the agent interface.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'user_lost_password', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'user_lost_password', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Authentication via OTRS', - :name => 'auth_otrs', - :area => 'Security::Authentication', - :description => 'Enables user authentication via OTRS.', - :state => { - :adapter => 'Auth::Otrs', - :required_group_ro => 'stats', - :group_rw_role_map => { + title: 'Authentication via OTRS', + name: 'auth_otrs', + area: 'Security::Authentication', + description: 'Enables user authentication via OTRS.', + state: { + adapter: 'Auth::Otrs', + required_group_ro: 'stats', + group_rw_role_map: { 'admin' => 'Admin', 'stats' => 'Report', }, - :group_ro_role_map => { + group_ro_role_map: { 'stats' => 'Report', }, - :always_role => { + always_role: { 'Agent' => true, }, }, - :frontend => false + frontend: false ) Setting.create_if_not_exists( - :title => 'Authentication via LDAP', - :name => 'auth_ldap', - :area => 'Security::Authentication', - :description => 'Enables user authentication via LDAP.', - :state => { - :adapter => 'Auth::Ldap', - :host => 'localhost', - :port => 389, - :bind_dn => 'cn=Manager,dc=example,dc=org', - :bind_pw => 'example', - :uid => 'mail', - :base => 'dc=example,dc=org', - :always_filter => '', - :always_roles => ['Admin', 'Agent'], - :always_groups => ['Users'], - :sync_params => { - :firstname => 'sn', - :lastname => 'givenName', - :email => 'mail', - :login => 'mail', + title: 'Authentication via LDAP', + name: 'auth_ldap', + area: 'Security::Authentication', + description: 'Enables user authentication via LDAP.', + state: { + adapter: 'Auth::Ldap', + host: 'localhost', + port: 389, + bind_dn: 'cn=Manager,dc=example,dc=org', + bind_pw: 'example', + uid: 'mail', + base: 'dc=example,dc=org', + always_filter: '', + always_roles: ['Admin', 'Agent'], + always_groups: ['Users'], + sync_params: { + firstname: 'sn', + lastname: 'givenName', + email: 'mail', + login: 'mail', }, }, - :frontend => false + frontend: false ) Setting.create_if_not_exists( - :title => 'Authentication via Twitter', - :name => 'auth_twitter', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via twitter. Register your app first at https://dev.twitter.com/apps', - :options => { - :form => [ + title: 'Authentication via Twitter', + name: 'auth_twitter', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via twitter. Register your app first at https://dev.twitter.com/apps', + options: { + form: [ { - :display => '', - :null => true, - :name => 'auth_twitter', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'auth_twitter', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Twitter App Credentials', - :name => 'auth_twitter_credentials', - :area => 'Security::ThirdPartyAuthentication', - :description => 'App credentials for Twitter.', - :options => { - :form => [ + title: 'Twitter App Credentials', + name: 'auth_twitter_credentials', + area: 'Security::ThirdPartyAuthentication', + description: 'App credentials for Twitter.', + options: { + form: [ { - :display => 'Twitter Key', - :null => true, - :name => 'key', - :tag => 'input', + display: 'Twitter Key', + null: true, + name: 'key', + tag: 'input', }, { - :display => 'Twitter Secret', - :null => true, - :name => 'secret', - :tag => 'input', + display: 'Twitter Secret', + null: true, + name: 'secret', + tag: 'input', }, ], }, - :state => {}, - :frontend => false + state: {}, + frontend: false ) Setting.create_if_not_exists( - :title => 'Authentication via Facebook', - :name => 'auth_facebook', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via Facebook. Register your app first at https://developers.facebook.com/apps/', - :options => { - :form => [ + title: 'Authentication via Facebook', + name: 'auth_facebook', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via Facebook. Register your app first at https://developers.facebook.com/apps/', + options: { + form: [ { - :display => '', - :null => true, - :name => 'auth_facebook', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'auth_facebook', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Facebook App Credentials', - :name => 'auth_facebook_credentials', - :area => 'Security::ThirdPartyAuthentication', - :description => 'App credentials for Facebook.', - :options => { - :form => [ + title: 'Facebook App Credentials', + name: 'auth_facebook_credentials', + area: 'Security::ThirdPartyAuthentication', + description: 'App credentials for Facebook.', + options: { + form: [ { - :display => 'App ID', - :null => true, - :name => 'app_id', - :tag => 'input', + display: 'App ID', + null: true, + name: 'app_id', + tag: 'input', }, { - :display => 'App Secret', - :null => true, - :name => 'app_secret', - :tag => 'input', + display: 'App Secret', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - :state => {}, - :frontend => false + state: {}, + frontend: false ) Setting.create_if_not_exists( - :title => 'Authentication via Google', - :name => 'auth_google_oauth2', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via Google.', - :options => { - :form => [ + title: 'Authentication via Google', + name: 'auth_google_oauth2', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via Google.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'auth_google_oauth2', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'auth_google_oauth2', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Google App Credentials', - :name => 'auth_google_oauth2_credentials', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via Google.', - :options => { - :form => [ + title: 'Google App Credentials', + name: 'auth_google_oauth2_credentials', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via Google.', + options: { + form: [ { - :display => 'Client ID', - :null => true, - :name => 'client_id', - :tag => 'input', + display: 'Client ID', + null: true, + name: 'client_id', + tag: 'input', }, { - :display => 'Client Secret', - :null => true, - :name => 'client_secret', - :tag => 'input', + display: 'Client Secret', + null: true, + name: 'client_secret', + tag: 'input', }, ], }, - :state => {}, - :frontend => false + state: {}, + frontend: false ) Setting.create_if_not_exists( - :title => 'Authentication via LinkedIn', - :name => 'auth_linkedin', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via LinkedIn.', - :options => { - :form => [ + title: 'Authentication via LinkedIn', + name: 'auth_linkedin', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via LinkedIn.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'auth_linkedin', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'auth_linkedin', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'LinkedIn App Credentials', - :name => 'auth_linkedin_credentials', - :area => 'Security::ThirdPartyAuthentication', - :description => 'Enables user authentication via LinkedIn.', - :options => { - :form => [ + title: 'LinkedIn App Credentials', + name: 'auth_linkedin_credentials', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via LinkedIn.', + options: { + form: [ { - :display => 'App ID', - :null => true, - :name => 'app_id', - :tag => 'input', + display: 'App ID', + null: true, + name: 'app_id', + tag: 'input', }, { - :display => 'App Secret', - :null => true, - :name => 'app_secret', - :tag => 'input', + display: 'App Secret', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - :state => {}, - :frontend => false + state: {}, + frontend: false ) Setting.create_if_not_exists( - :title => 'Minimal size', - :name => 'password_min_size', - :area => 'Security::Password', - :description => 'Password need to have at least minimal size of characters.', - :options => { - :form => [ + title: 'Minimal size', + name: 'password_min_size', + area: 'Security::Password', + description: 'Password need to have at least minimal size of characters.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'password_min_size', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'password_min_size', + tag: 'select', + options: { 4 => 4, 5 => 5, 6 => 6, @@ -572,66 +572,66 @@ Setting.create_if_not_exists( }, ], }, - :state => 6, - :frontend => true + state: 6, + frontend: true ) Setting.create_if_not_exists( - :title => '2 lower and 2 upper characters', - :name => 'password_min_2_lower_2_upper_characters', - :area => 'Security::Password', - :description => 'Password need to contain 2 lower and 2 upper characters.', - :options => { - :form => [ + title: '2 lower and 2 upper characters', + name: 'password_min_2_lower_2_upper_characters', + area: 'Security::Password', + description: 'Password need to contain 2 lower and 2 upper characters.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'password_min_2_lower_2_upper_characters', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'password_min_2_lower_2_upper_characters', + tag: 'select', + options: { 1 => 'yes', 0 => 'no', }, }, ], }, - :state => 0, - :frontend => true + state: 0, + frontend: true ) Setting.create_if_not_exists( - :title => 'Digit required', - :name => 'password_need_digit', - :area => 'Security::Password', - :description => 'Password need to have at least one digit.', - :options => { - :form => [ + title: 'Digit required', + name: 'password_need_digit', + area: 'Security::Password', + description: 'Password need to have at least one digit.', + options: { + form: [ { - :display => 'Needed', - :null => true, - :name => 'password_need_digit', - :tag => 'select', - :options => { + display: 'Needed', + null: true, + name: 'password_need_digit', + tag: 'select', + options: { 1 => 'yes', 0 => 'no', }, }, ], }, - :state => 1, - :frontend => true + state: 1, + frontend: true ) Setting.create_if_not_exists( - :title => 'Maximal failed logins', - :name => 'password_max_login_failed', - :area => 'Security::Password', - :description => 'Maximal failed logins after account is inactive.', - :options => { - :form => [ + title: 'Maximal failed logins', + name: 'password_max_login_failed', + area: 'Security::Password', + description: 'Maximal failed logins after account is inactive.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'password_max_login_failed', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'password_max_login_failed', + tag: 'select', + options: { 4 => 4, 5 => 5, 6 => 6, @@ -652,59 +652,59 @@ Setting.create_if_not_exists( }, ], }, - :state => 10, - :frontend => true + state: 10, + frontend: true ) Setting.create_if_not_exists( - :title => 'Ticket Hook', - :name => 'ticket_hook', - :area => 'Ticket::Base', - :description => 'The identifier for a ticket, e.g. Ticket#, Call#, MyTicket#. The default is Ticket#.', - :options => { - :form => [ + title: 'Ticket Hook', + name: 'ticket_hook', + area: 'Ticket::Base', + description: 'The identifier for a ticket, e.g. Ticket#, Call#, MyTicket#. The default is Ticket#.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'ticket_hook', - :tag => 'input', + display: '', + null: false, + name: 'ticket_hook', + tag: 'input', }, ], }, - :state => 'Ticket#', - :frontend => true + state: 'Ticket#', + frontend: true ) Setting.create_if_not_exists( - :title => 'Ticket Hook Divider', - :name => 'ticket_hook_divider', - :area => 'Ticket::Base::Shadow', - :description => 'The divider between TicketHook and ticket number. E.g \': \'.', - :options => { - :form => [ + title: 'Ticket Hook Divider', + name: 'ticket_hook_divider', + area: 'Ticket::Base::Shadow', + description: 'The divider between TicketHook and ticket number. E.g \': \'.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_hook_divider', - :tag => 'input', + display: '', + null: true, + name: 'ticket_hook_divider', + tag: 'input', }, ], }, - :state => '', - :frontend => false + state: '', + frontend: false ) Setting.create_if_not_exists( - :title => 'Ticket Hook Position', - :name => 'ticket_hook_position', - :area => 'Ticket::Base', - :description => 'The format of the subject. "Left" means "[Ticket#12345] Some Subject", "Right" means "Some Subject [Ticket#12345]", "None" means "Some Subject" and no ticket number. In the last case you should enable PostmasterFollowupSearchInRaw or PostmasterFollowUpSearchInReferences to recognize followups based on email headers and/or body.', - :options => { - :form => [ + title: 'Ticket Hook Position', + name: 'ticket_hook_position', + area: 'Ticket::Base', + description: 'The format of the subject. "Left" means "[Ticket#12345] Some Subject", "Right" means "Some Subject [Ticket#12345]", "None" means "Some Subject" and no ticket number. In the last case you should enable PostmasterFollowupSearchInRaw or PostmasterFollowUpSearchInReferences to recognize followups based on email headers and/or body.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_hook_position', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'ticket_hook_position', + tag: 'select', + options: { 'left' => 'Left', 'right' => 'Right', 'none' => 'None', @@ -712,44 +712,44 @@ Setting.create_if_not_exists( }, ], }, - :state => 'right', - :frontend => false + state: 'right', + frontend: false ) Setting.create_if_not_exists( - :title => 'Ticket Subject Size', - :name => 'ticket_subject_size', - :area => 'Ticket::Base', - :description => 'Max size of the subjects in an email reply.', - :options => { - :form => [ + title: 'Ticket Subject Size', + name: 'ticket_subject_size', + area: 'Ticket::Base', + description: 'Max size of the subjects in an email reply.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'ticket_subject_size', - :tag => 'input', + display: '', + null: false, + name: 'ticket_subject_size', + tag: 'input', }, ], }, - :state => '110', - :frontend => false + state: '110', + frontend: false ) Setting.create_if_not_exists( - :title => 'Ticket Subject Reply', - :name => 'ticket_subject_re', - :area => 'Ticket::Base', - :description => 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.', - :options => { - :form => [ + title: 'Ticket Subject Reply', + name: 'ticket_subject_re', + area: 'Ticket::Base', + description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_subject_re', - :tag => 'input', + display: '', + null: true, + name: 'ticket_subject_re', + tag: 'input', }, ], }, - :state => 'RE', - :frontend => false + state: 'RE', + frontend: false ) #Setting.create( # :title => 'Ticket Subject Forward', @@ -763,55 +763,55 @@ Setting.create_if_not_exists( #) Setting.create_if_not_exists( - :title => 'Ticket Number Format', - :name => 'ticket_number', - :area => 'Ticket::Number', - :description => 'Selects the ticket number generator module. "Increment" increments the ticket + title: 'Ticket Number Format', + name: 'ticket_number', + area: 'Ticket::Number', + description: 'Selects the ticket number generator module. "Increment" increments the ticket number, the SystemID and the counter are used with SystemID.Counter format (e.g. 1010138, 1010139). With "Date" the ticket numbers will be generated by the current date, the SystemID and the counter. The format looks like Year.Month.Day.SystemID.counter (e.g. 201206231010138, 201206231010139). With param "Checksum => true" the counter will be appended as checksum to the string. The format looks like SystemID.Counter.CheckSum (e. g. 10101384, 10101392) or Year.Month.Day.SystemID.Counter.CheckSum (e.g. 2012070110101520, 2012070110101535).', - :options => { - :form => [ + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_number', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'ticket_number', + tag: 'select', + options: { 'Ticket::Number::Increment' => 'Increment (SystemID.Counter)', 'Ticket::Number::Date' => 'Date (Year.Month.Day.SystemID.Counter)', }, }, ], }, - :state => 'Ticket::Number::Increment', - :frontend => false + state: 'Ticket::Number::Increment', + frontend: false ) Setting.create_if_not_exists( - :title => 'Ticket Number Increment', - :name => 'ticket_number_increment', - :area => 'Ticket::Number', - :description => '-', - :options => { - :form => [ + title: 'Ticket Number Increment', + name: 'ticket_number_increment', + area: 'Ticket::Number', + description: '-', + options: { + form: [ { - :display => 'Checksum', - :null => true, - :name => 'checksum', - :tag => 'boolean', - :options => { + display: 'Checksum', + null: true, + name: 'checksum', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, { - :display => 'Min. size of number', - :null => true, - :name => 'min_size', - :tag => 'select', - :options => { + display: 'Min. size of number', + null: true, + name: 'min_size', + tag: 'select', + options: { 1 => 1, 2 => 2, 3 => 3, @@ -836,161 +836,161 @@ Setting.create_if_not_exists( }, ], }, - :state => { - :checksum => false, - :min_size => 5, + state: { + checksum: false, + min_size: 5, }, - :frontend => false + frontend: false ) Setting.create_if_not_exists( - :title => 'Ticket Number Increment Date', - :name => 'ticket_number_date', - :area => 'Ticket::Number', - :description => '-', - :options => { - :form => [ + title: 'Ticket Number Increment Date', + name: 'ticket_number_date', + area: 'Ticket::Number', + description: '-', + options: { + form: [ { - :display => 'Checksum', - :null => true, - :name => 'checksum', - :tag => 'boolean', - :options => { + display: 'Checksum', + null: true, + name: 'checksum', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => { - :checksum => false, + state: { + checksum: false, }, - :frontend => false + frontend: false ) Setting.create_if_not_exists( - :title => 'Enable Ticket creation', - :name => 'customer_ticket_create', - :area => 'CustomerWeb::Base', - :description => 'Defines if a customer can create tickets via the web interface.', - :options => { - :form => [ + title: 'Enable Ticket creation', + name: 'customer_ticket_create', + area: 'CustomerWeb::Base', + description: 'Defines if a customer can create tickets via the web interface.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'customer_ticket_create', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'customer_ticket_create', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Group selection for Ticket creation', - :name => 'customer_ticket_create_group_ids', - :area => 'CustomerWeb::Base', - :description => 'Defines groups where customer can create tickets via web interface. "-" means all groups are available.', - :options => { - :form => [ + title: 'Group selection for Ticket creation', + name: 'customer_ticket_create_group_ids', + area: 'CustomerWeb::Base', + description: 'Defines groups where customer can create tickets via web interface. "-" means all groups are available.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'group_ids', - :tag => 'select', - :multiple => true, - :nulloption => true, - :relation => 'Group', + display: '', + null: true, + name: 'group_ids', + tag: 'select', + multiple: true, + nulloption: true, + relation: 'Group', }, ], }, - :state => '', - :frontend => true + state: '', + frontend: true ) Setting.create_if_not_exists( - :title => 'Enable Ticket View/Update', - :name => 'customer_ticket_view', - :area => 'CustomerWeb::Base', - :description => 'Defines if a customer view and update his own tickets.', - :options => { - :form => [ + title: 'Enable Ticket View/Update', + name: 'customer_ticket_view', + area: 'CustomerWeb::Base', + description: 'Defines if a customer view and update his own tickets.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'customer_ticket_view', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'customer_ticket_view', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => true, - :frontend => true + state: true, + frontend: true ) Setting.create_if_not_exists( - :title => 'Sender Format', - :name => 'ticket_define_email_from', - :area => 'Email::Base', - :description => 'Defines how the From field from the emails (sent from answers and email tickets) should look like.', - :options => { - :form => [ + title: 'Sender Format', + name: 'ticket_define_email_from', + area: 'Email::Base', + description: 'Defines how the From field from the emails (sent from answers and email tickets) should look like.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'ticket_define_email_from', - :tag => 'select', - :options => { - :SystemAddressName => 'System Address Display Name', - :AgentNameSystemAddressName => 'Agent Name + FromSeparator + System Address Display Name', + display: '', + null: true, + name: 'ticket_define_email_from', + tag: 'select', + options: { + SystemAddressName: 'System Address Display Name', + AgentNameSystemAddressName: 'Agent Name + FromSeparator + System Address Display Name', }, }, ], }, - :state => 'SystemAddressName', - :frontend => false + state: 'SystemAddressName', + frontend: false ) Setting.create_if_not_exists( - :title => 'Sender Format Seperator', - :name => 'ticket_define_email_from_seperator', - :area => 'Email::Base', - :description => 'Defines the separator between the agents real name and the given group email address.', - :options => { - :form => [ + title: 'Sender Format Seperator', + name: 'ticket_define_email_from_seperator', + area: 'Email::Base', + description: 'Defines the separator between the agents real name and the given group email address.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'ticket_define_email_from_seperator', - :tag => 'input', + display: '', + null: false, + name: 'ticket_define_email_from_seperator', + tag: 'input', }, ], }, - :state => 'via', - :frontend => false + state: 'via', + frontend: false ) Setting.create_if_not_exists( - :title => 'Max. Email Size', - :name => 'postmaster_max_size', - :area => 'Email::Base', - :description => 'Maximal size in MB of emails.', - :options => { - :form => [ + title: 'Max. Email Size', + name: 'postmaster_max_size', + area: 'Email::Base', + description: 'Maximal size in MB of emails.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'postmaster_max_size', - :tag => 'select', - :options => { + display: '', + null: true, + name: 'postmaster_max_size', + tag: 'select', + options: { 1 => 1, 2 => 2, 3 => 3, @@ -1015,23 +1015,23 @@ Setting.create_if_not_exists( }, ], }, - :state => 10, - :frontend => false + state: 10, + frontend: false ) Setting.create_if_not_exists( - :title => 'Additional follow up detection', - :name => 'postmaster_follow_up_search_in', - :area => 'Email::Base', - :description => '"References" - Executes follow up checks on In-Reply-To or References headers for mails that don\'t have a ticket number in the subject. "Body" - Executes follow up mail body checks in mails that don\'t have a ticket number in the subject. "Attachment" - Executes follow up mail attachments checks in mails that don\'t have a ticket number in the subject. "Raw" - Executes follow up plain/raw mail checks in mails that don\'t have a ticket number in the subject.', - :options => { - :form => [ + title: 'Additional follow up detection', + name: 'postmaster_follow_up_search_in', + area: 'Email::Base', + description: '"References" - Executes follow up checks on In-Reply-To or References headers for mails that don\'t have a ticket number in the subject. "Body" - Executes follow up mail body checks in mails that don\'t have a ticket number in the subject. "Attachment" - Executes follow up mail attachments checks in mails that don\'t have a ticket number in the subject. "Raw" - Executes follow up plain/raw mail checks in mails that don\'t have a ticket number in the subject.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'postmaster_follow_up_search_in', - :tag => 'checkbox', - :options => { + display: '', + null: true, + name: 'postmaster_follow_up_search_in', + tag: 'checkbox', + options: { 'references' => 'References', 'body' => 'Body', 'attachment' => 'Attachment', @@ -1040,222 +1040,222 @@ Setting.create_if_not_exists( }, ], }, - :state => ['subject'], - :frontend => false + state: ['subject'], + frontend: false ) Setting.create_if_not_exists( - :title => 'Notification Sender', - :name => 'notification_sender', - :area => 'Email::Base', - :description => 'Defines the sender of email notifications.', - :options => { - :form => [ + title: 'Notification Sender', + name: 'notification_sender', + area: 'Email::Base', + description: 'Defines the sender of email notifications.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'notification_sender', - :tag => 'input', + display: '', + null: false, + name: 'notification_sender', + tag: 'input', }, ], }, - :state => 'Notification Master ', - :frontend => false + state: 'Notification Master ', + frontend: false ) Setting.create_if_not_exists( - :title => 'Block Notifications', - :name => 'send_no_auto_response_reg_exp', - :area => 'Email::Base', - :description => 'If this regex matches, no notification will be send by the sender.', - :options => { - :form => [ + title: 'Block Notifications', + name: 'send_no_auto_response_reg_exp', + area: 'Email::Base', + description: 'If this regex matches, no notification will be send by the sender.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'send_no_auto_response_reg_exp', - :tag => 'input', + display: '', + null: false, + name: 'send_no_auto_response_reg_exp', + tag: 'input', }, ], }, - :state => '(MAILER-DAEMON|postmaster|abuse)@.+?\..+?', - :frontend => false + state: '(MAILER-DAEMON|postmaster|abuse)@.+?\..+?', + frontend: false ) Setting.create_if_not_exists( - :title => 'Enable Chat', - :name => 'chat', - :area => 'Chat::Base', - :description => 'Enable/Disable online chat.', - :options => { - :form => [ + title: 'Enable Chat', + name: 'chat', + area: 'Chat::Base', + description: 'Enable/Disable online chat.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'chat', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'chat', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Default Screen', - :name => 'default_controller', - :area => 'Core', - :description => 'Defines the default controller.', - :options => {}, - :state => '#dashboard', - :frontend => true + title: 'Default Screen', + name: 'default_controller', + area: 'Core', + description: 'Defines the default controller.', + options: {}, + state: '#dashboard', + frontend: true ) Setting.create_if_not_exists( - :title => 'Import Mode', - :name => 'import_mode', - :area => 'Import::Base', - :description => 'Set system in import mode (disable some triggers).', - :options => { - :form => [ + title: 'Import Mode', + name: 'import_mode', + area: 'Import::Base', + description: 'Set system in import mode (disable some triggers).', + options: { + form: [ { - :display => '', - :null => true, - :name => 'import_mode', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'import_mode', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Import Backend', - :name => 'import_backend', - :area => 'Import::Base::Internal', - :description => 'Set backend which is used for import.', - :options => {}, - :state => '', - :frontend => true + title: 'Import Backend', + name: 'import_backend', + area: 'Import::Base::Internal', + description: 'Set backend which is used for import.', + options: {}, + state: '', + frontend: true ) Setting.create_if_not_exists( - :title => 'Ignore Escalation/SLA Information', - :name => 'import_ignore_sla', - :area => 'Import::Base', - :description => 'Ignore Escalation/SLA Information form import system.', - :options => { - :form => [ + title: 'Ignore Escalation/SLA Information', + name: 'import_ignore_sla', + area: 'Import::Base', + description: 'Ignore Escalation/SLA Information form import system.', + options: { + form: [ { - :display => '', - :null => true, - :name => 'import_ignore_sla', - :tag => 'boolean', - :options => { + display: '', + null: true, + name: 'import_ignore_sla', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, }, ], }, - :state => false, - :frontend => true + state: false, + frontend: true ) Setting.create_if_not_exists( - :title => 'Import Endpoint', - :name => 'import_otrs_endpoint', - :area => 'Import::OTRS', - :description => 'Defines OTRS endpoint to import users, ticket, states and articles.', - :options => { - :form => [ + title: 'Import Endpoint', + name: 'import_otrs_endpoint', + area: 'Import::OTRS', + description: 'Defines OTRS endpoint to import users, ticket, states and articles.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'import_otrs_endpoint', - :tag => 'input', + display: '', + null: false, + name: 'import_otrs_endpoint', + tag: 'input', }, ], }, - :state => 'http://otrs_host/otrs', - :frontend => false + state: 'http://otrs_host/otrs', + frontend: false ) Setting.create_if_not_exists( - :title => 'Import Key', - :name => 'import_otrs_endpoint_key', - :area => 'Import::OTRS', - :description => 'Defines OTRS endpoint auth key.', - :options => { - :form => [ + title: 'Import Key', + name: 'import_otrs_endpoint_key', + area: 'Import::OTRS', + description: 'Defines OTRS endpoint auth key.', + options: { + form: [ { - :display => '', - :null => false, - :name => 'import_otrs_endpoint_key', - :tag => 'input', + display: '', + null: false, + name: 'import_otrs_endpoint_key', + tag: 'input', }, ], }, - :state => '', - :frontend => false + state: '', + frontend: false ) Setting.create_if_not_exists( - :title => 'Import User for http basic authentiation', - :name => 'import_otrs_user', - :area => 'Import::OTRS', - :description => 'Defines http basic authentiation user (only if OTRS is protected via http basic auth).', - :options => { - :form => [ + title: 'Import User for http basic authentiation', + name: 'import_otrs_user', + area: 'Import::OTRS', + description: 'Defines http basic authentiation user (only if OTRS is protected via http basic auth).', + options: { + form: [ { - :display => '', - :null => true, - :name => 'import_otrs_user', - :tag => 'input', + display: '', + null: true, + name: 'import_otrs_user', + tag: 'input', }, ], }, - :state => '', - :frontend => false + state: '', + frontend: false ) Setting.create_if_not_exists( - :title => 'Import Password for http basic authentiation', - :name => 'import_otrs_password', - :area => 'Import::OTRS', - :description => 'Defines http basic authentiation password (only if OTRS is protected via http basic auth).', - :options => { - :form => [ + title: 'Import Password for http basic authentiation', + name: 'import_otrs_password', + area: 'Import::OTRS', + description: 'Defines http basic authentiation password (only if OTRS is protected via http basic auth).', + options: { + form: [ { - :display => '', - :null => true, - :name => 'import_otrs_password', - :tag => 'input', + display: '', + null: true, + name: 'import_otrs_password', + tag: 'input', }, ], }, - :state => '', - :frontend => false + state: '', + frontend: false ) email_address = EmailAddress.create_if_not_exists( - :id => 1, - :realname => 'Zammad', - :email => 'zammad@localhost', - :updated_by_id => 1, - :created_by_id => 1 + id: 1, + realname: 'Zammad', + email: 'zammad@localhost', + updated_by_id: 1, + created_by_id: 1 ) signature = Signature.create_if_not_exists( - :id => 1, - :name => 'default', - :body => ' + id: 1, + name: 'default', + body: ' #{user.firstname} #{user.lastname} -- @@ -1263,131 +1263,131 @@ signature = Signature.create_if_not_exists( 5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA Email: hot@example.com - Web: http://www.example.com/ --', - :updated_by_id => 1, - :created_by_id => 1 + updated_by_id: 1, + created_by_id: 1 ) Role.create_if_not_exists( - :id => 1, - :name => 'Admin', - :note => 'To configure your system.', - :updated_by_id => 1, - :created_by_id => 1 + id: 1, + name: 'Admin', + note: 'To configure your system.', + updated_by_id: 1, + created_by_id: 1 ) Role.create_if_not_exists( - :id => 2, - :name => 'Agent', - :note => 'To work on Tickets.', - :updated_by_id => 1, - :created_by_id => 1 + id: 2, + name: 'Agent', + note: 'To work on Tickets.', + updated_by_id: 1, + created_by_id: 1 ) Role.create_if_not_exists( - :id => 3, - :name => 'Customer', - :note => 'People who create Tickets ask for help.', - :updated_by_id => 1, - :created_by_id => 1 + id: 3, + name: 'Customer', + note: 'People who create Tickets ask for help.', + updated_by_id: 1, + created_by_id: 1 ) Group.create_if_not_exists( - :id => 1, - :name => 'Users', - :email_address_id => email_address.id, - :signature_id => signature.id, - :note => 'Standard Group/Pool for Tickets.', - :updated_by_id => 1, - :created_by_id => 1 + id: 1, + name: 'Users', + email_address_id: email_address.id, + signature_id: signature.id, + note: 'Standard Group/Pool for Tickets.', + updated_by_id: 1, + created_by_id: 1 ) user = User.create_if_not_exists( - :id => 1, - :login => '-', - :firstname => '-', - :lastname => '', - :email => '', - :password => 'root', - :active => false, - :updated_by_id => 1, - :created_by_id => 1 + id: 1, + login: '-', + firstname: '-', + lastname: '', + email: '', + password: 'root', + active: false, + updated_by_id: 1, + created_by_id: 1 ) UserInfo.current_user_id = 1 -roles = Role.where( :name => 'Customer' ) +roles = Role.where( name: 'Customer' ) organizations = Organization.all groups = Group.all org_community = Organization.create_if_not_exists( - :id => 1, - :name => 'Zammad Foundation', + id: 1, + name: 'Zammad Foundation', ) user_community = User.create_or_update( - :id => 2, - :login => 'nicole.braun@zammad.org', - :firstname => 'Nicole', - :lastname => 'Braun', - :email => 'nicole.braun@zammad.org', - :password => '', - :active => true, - :roles => roles, - :organization_id => org_community.id, + id: 2, + login: 'nicole.braun@zammad.org', + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', + password: '', + active: true, + roles: roles, + organization_id: org_community.id, ) -Link::Type.create_if_not_exists( :id => 1, :name => 'normal' ) -Link::Object.create_if_not_exists( :id => 1, :name => 'Ticket' ) -Link::Object.create_if_not_exists( :id => 2, :name => 'Announcement' ) -Link::Object.create_if_not_exists( :id => 3, :name => 'Question/Answer' ) -Link::Object.create_if_not_exists( :id => 4, :name => 'Idea' ) -Link::Object.create_if_not_exists( :id => 5, :name => 'Bug' ) +Link::Type.create_if_not_exists( id: 1, name: 'normal' ) +Link::Object.create_if_not_exists( id: 1, name: 'Ticket' ) +Link::Object.create_if_not_exists( id: 2, name: 'Announcement' ) +Link::Object.create_if_not_exists( id: 3, name: 'Question/Answer' ) +Link::Object.create_if_not_exists( id: 4, name: 'Idea' ) +Link::Object.create_if_not_exists( id: 5, name: 'Bug' ) -Ticket::StateType.create_if_not_exists( :id => 1, :name => 'new' ) -Ticket::StateType.create_if_not_exists( :id => 2, :name => 'open' ) -Ticket::StateType.create_if_not_exists( :id => 3, :name => 'pending reminder' ) -Ticket::StateType.create_if_not_exists( :id => 4, :name => 'pending action' ) -Ticket::StateType.create_if_not_exists( :id => 5, :name => 'closed' ) -Ticket::StateType.create_if_not_exists( :id => 6, :name => 'merged' ) -Ticket::StateType.create_if_not_exists( :id => 7, :name => 'removed' ) +Ticket::StateType.create_if_not_exists( id: 1, name: 'new' ) +Ticket::StateType.create_if_not_exists( id: 2, name: 'open' ) +Ticket::StateType.create_if_not_exists( id: 3, name: 'pending reminder' ) +Ticket::StateType.create_if_not_exists( id: 4, name: 'pending action' ) +Ticket::StateType.create_if_not_exists( id: 5, name: 'closed' ) +Ticket::StateType.create_if_not_exists( id: 6, name: 'merged' ) +Ticket::StateType.create_if_not_exists( id: 7, name: 'removed' ) -Ticket::State.create_if_not_exists( :id => 1, :name => 'new', :state_type_id => Ticket::StateType.where(:name => 'new').first.id ) -Ticket::State.create_if_not_exists( :id => 2, :name => 'open', :state_type_id => Ticket::StateType.where(:name => 'open').first.id ) -Ticket::State.create_if_not_exists( :id => 3, :name => 'pending reminder', :state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id ) -Ticket::State.create_if_not_exists( :id => 4, :name => 'closed', :state_type_id => Ticket::StateType.where(:name => 'closed').first.id ) -Ticket::State.create_if_not_exists( :id => 5, :name => 'merged', :state_type_id => Ticket::StateType.where(:name => 'merged').first.id ) -Ticket::State.create_if_not_exists( :id => 6, :name => 'removed', :state_type_id => Ticket::StateType.where(:name => 'removed').first.id, :active => false ) -Ticket::State.create_if_not_exists( :id => 7, :name => 'pending close', :state_type_id => Ticket::StateType.where(:name => 'pending action').first.id, :next_state_id => 5 ) +Ticket::State.create_if_not_exists( id: 1, name: 'new', state_type_id: Ticket::StateType.where(name: 'new').first.id ) +Ticket::State.create_if_not_exists( id: 2, name: 'open', state_type_id: Ticket::StateType.where(name: 'open').first.id ) +Ticket::State.create_if_not_exists( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.where(name: 'pending reminder').first.id ) +Ticket::State.create_if_not_exists( id: 4, name: 'closed', state_type_id: Ticket::StateType.where(name: 'closed').first.id ) +Ticket::State.create_if_not_exists( id: 5, name: 'merged', state_type_id: Ticket::StateType.where(name: 'merged').first.id ) +Ticket::State.create_if_not_exists( id: 6, name: 'removed', state_type_id: Ticket::StateType.where(name: 'removed').first.id, active: false ) +Ticket::State.create_if_not_exists( id: 7, name: 'pending close', state_type_id: Ticket::StateType.where(name: 'pending action').first.id, next_state_id: 5 ) -Ticket::Priority.create_if_not_exists( :id => 1, :name => '1 low' ) -Ticket::Priority.create_if_not_exists( :id => 2, :name => '2 normal' ) -Ticket::Priority.create_if_not_exists( :id => 3, :name => '3 high' ) +Ticket::Priority.create_if_not_exists( id: 1, name: '1 low' ) +Ticket::Priority.create_if_not_exists( id: 2, name: '2 normal' ) +Ticket::Priority.create_if_not_exists( id: 3, name: '3 high' ) -Ticket::Article::Type.create_if_not_exists( :id => 1, :name => 'email', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 2, :name => 'sms', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 3, :name => 'chat', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 4, :name => 'fax', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 5, :name => 'phone', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 6, :name => 'twitter status', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 7, :name => 'twitter direct-message', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 8, :name => 'facebook', :communication => true ) -Ticket::Article::Type.create_if_not_exists( :id => 9, :name => 'note', :communication => false ) -Ticket::Article::Type.create_if_not_exists( :id => 10, :name => 'web', :communication => true ) +Ticket::Article::Type.create_if_not_exists( id: 1, name: 'email', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 2, name: 'sms', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 3, name: 'chat', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 4, name: 'fax', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 5, name: 'phone', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 6, name: 'twitter status', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 7, name: 'twitter direct-message', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 8, name: 'facebook', communication: true ) +Ticket::Article::Type.create_if_not_exists( id: 9, name: 'note', communication: false ) +Ticket::Article::Type.create_if_not_exists( id: 10, name: 'web', communication: true ) -Ticket::Article::Sender.create_if_not_exists( :id => 1, :name => 'Agent' ) -Ticket::Article::Sender.create_if_not_exists( :id => 2, :name => 'Customer' ) -Ticket::Article::Sender.create_if_not_exists( :id => 3, :name => 'System' ) +Ticket::Article::Sender.create_if_not_exists( id: 1, name: 'Agent' ) +Ticket::Article::Sender.create_if_not_exists( id: 2, name: 'Customer' ) +Ticket::Article::Sender.create_if_not_exists( id: 3, name: 'System' ) UserInfo.current_user_id = user_community.id ticket = Ticket.create( - :group_id => Group.where( :name => 'Users' ).first.id, - :customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id, - :owner_id => User.where( :login => '-' ).first.id, - :title => 'Welcome to Zammad!', - :state_id => Ticket::State.where( :name => 'new' ).first.id, - :priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id, + group_id: Group.where( name: 'Users' ).first.id, + customer_id: User.where( login: 'nicole.braun@zammad.org' ).first.id, + owner_id: User.where( login: '-' ).first.id, + title: 'Welcome to Zammad!', + state_id: Ticket::State.where( name: 'new' ).first.id, + priority_id: Ticket::Priority.where( name: '2 normal' ).first.id, ) Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id, - :sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id, - :from => 'Zammad Feedback ', - :body => 'Welcome! + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where(name: 'phone' ).first.id, + sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id, + from: 'Zammad Feedback ', + body: 'Welcome! Thank you for installing Zammad. @@ -1399,298 +1399,298 @@ Regards, The Zammad.org Project ', - :internal => false, + internal: false, ) UserInfo.current_user_id = 1 -overview_role = Role.where( :name => 'Agent' ).first +overview_role = Role.where( name: 'Agent' ).first Overview.create_if_not_exists( - :name => 'My assigned Tickets', - :link => 'my_assigned', - :prio => 1000, - :role_id => overview_role.id, - :condition => { + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 1000, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [ 1,2,3,7 ], 'tickets.owner_id' => 'current_user.id', }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'created_at' ], + s: [ 'title', 'customer', 'group', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'My pending reached Tickets', - :link => 'my_pending_reached', - :prio => 1010, - :role_id => overview_role.id, - :condition => { + name: 'My pending reached Tickets', + link: 'my_pending_reached', + prio: 1010, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [3], 'tickets.owner_id' => 'current_user.id', 'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'created_at' ], + s: [ 'title', 'customer', 'group', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'Unassigned & Open Tickets', - :link => 'all_unassigned', - :prio => 1020, - :role_id => overview_role.id, - :condition => { + name: 'Unassigned & Open Tickets', + link: 'all_unassigned', + prio: 1020, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [1,2,3], 'tickets.owner_id' => 1, }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'created_at' ], + s: [ 'title', 'customer', 'group', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'All Open Tickets', - :link => 'all_open', - :prio => 1030, - :role_id => overview_role.id, - :condition => { + name: 'All Open Tickets', + link: 'all_open', + prio: 1030, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [1,2,3], }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'state', 'owner','created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'state', 'owner', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ], + s: [ 'title', 'customer', 'group', 'state', 'owner','created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'state', 'owner', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'All pending reached Tickets', - :link => 'all_pending_reached', - :prio => 1035, - :role_id => overview_role.id, - :condition => { + name: 'All pending reached Tickets', + link: 'all_pending_reached', + prio: 1035, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [3], 'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' }, }, - :order => { - :by => 'created_at', - :direction => 'ASC', + order: { + by: 'created_at', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'owner', 'created_at' ], - :s => [ 'title', 'customer', 'group', 'owner', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'group', 'owner', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'owner', 'created_at' ], + s: [ 'title', 'customer', 'group', 'owner', 'created_at' ], + m: [ 'number', 'title', 'customer', 'group', 'owner', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'Escalated Tickets', - :link => 'all_escalated', - :prio => 1040, - :role_id => overview_role.id, - :condition => { + name: 'Escalated Tickets', + link: 'all_escalated', + prio: 1040, + role_id: overview_role.id, + condition: { 'tickets.escalation_time' => { 'direction' => 'before', 'count'=> 5, 'area' => 'minute' }, }, - :order => { - :by => 'escalation_time', - :direction => 'ASC', + order: { + by: 'escalation_time', + direction: 'ASC', }, - :view => { - :d => [ 'title', 'customer', 'group', 'owner', 'escalation_time' ], - :s => [ 'title', 'customer', 'group', 'owner', 'escalation_time' ], - :m => [ 'number', 'title', 'customer', 'group', 'owner', 'escalation_time' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'group', 'owner', 'escalation_time' ], + s: [ 'title', 'customer', 'group', 'owner', 'escalation_time' ], + m: [ 'number', 'title', 'customer', 'group', 'owner', 'escalation_time' ], + view_mode_default: 's', }, ) -overview_role = Role.where( :name => 'Customer' ).first +overview_role = Role.where( name: 'Customer' ).first Overview.create_if_not_exists( - :name => 'My Tickets', - :link => 'my_tickets', - :prio => 1000, - :role_id => overview_role.id, - :condition => { + name: 'My Tickets', + link: 'my_tickets', + prio: 1000, + role_id: overview_role.id, + condition: { 'tickets.state_id' => [ 1,2,3,4,6 ], 'tickets.customer_id' => 'current_user.id', }, - :order => { - :by => 'created_at', - :direction => 'DESC', + order: { + by: 'created_at', + direction: 'DESC', }, - :view => { - :d => [ 'title', 'customer', 'state', 'created_at' ], - :s => [ 'number', 'title', 'state', 'created_at' ], - :m => [ 'number', 'title', 'state', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'state', 'created_at' ], + s: [ 'number', 'title', 'state', 'created_at' ], + m: [ 'number', 'title', 'state', 'created_at' ], + view_mode_default: 's', }, ) Overview.create_if_not_exists( - :name => 'My Organization Tickets', - :link => 'my_organization_tickets', - :prio => 1100, - :role_id => overview_role.id, - :organization_shared => true, - :condition => { + name: 'My Organization Tickets', + link: 'my_organization_tickets', + prio: 1100, + role_id: overview_role.id, + organization_shared: true, + condition: { 'tickets.state_id' => [ 1,2,3,4,6 ], 'tickets.organization_id' => 'current_user.organization_id', }, - :order => { - :by => 'created_at', - :direction => 'DESC', + order: { + by: 'created_at', + direction: 'DESC', }, - :view => { - :d => [ 'title', 'customer', 'state', 'created_at' ], - :s => [ 'number', 'title', 'customer', 'state', 'created_at' ], - :m => [ 'number', 'title', 'customer', 'state', 'created_at' ], - :view_mode_default => 's', + view: { + d: [ 'title', 'customer', 'state', 'created_at' ], + s: [ 'number', 'title', 'customer', 'state', 'created_at' ], + m: [ 'number', 'title', 'customer', 'state', 'created_at' ], + view_mode_default: 's', }, ) Channel.create_if_not_exists( - :adapter => 'SMTP', - :area => 'Email::Outbound', - :options => { - :host => 'host.example.com', - :user => '', - :password => '', - :ssl => true, + adapter: 'SMTP', + area: 'Email::Outbound', + options: { + host: 'host.example.com', + user: '', + password: '', + ssl: true, }, - :group_id => 1, - :active => false, + group_id: 1, + active: false, ) Channel.create_if_not_exists( - :adapter => 'Sendmail', - :area => 'Email::Outbound', - :options => {}, - :active => true, + adapter: 'Sendmail', + area: 'Email::Outbound', + options: {}, + active: true, ) network = Network.create_if_not_exists( - :id => 1, - :name => 'base', + id: 1, + name: 'base', ) Network::Category::Type.create_if_not_exists( - :id => 1, - :name => 'Announcement', + id: 1, + name: 'Announcement', ) Network::Category::Type.create_if_not_exists( - :id => 2, - :name => 'Idea', + id: 2, + name: 'Idea', ) Network::Category::Type.create_if_not_exists( - :id => 3, - :name => 'Question', + id: 3, + name: 'Question', ) Network::Category::Type.create_if_not_exists( - :id => 4, - :name => 'Bug Report', + id: 4, + name: 'Bug Report', ) Network::Privacy.create_if_not_exists( - :id => 1, - :name => 'logged in', - :key => 'loggedIn', + id: 1, + name: 'logged in', + key: 'loggedIn', ) Network::Privacy.create_if_not_exists( - :id => 2, - :name => 'logged in and moderator', - :key => 'loggedInModerator', + id: 2, + name: 'logged in and moderator', + key: 'loggedInModerator', ) Network::Category.create_if_not_exists( - :id => 1, - :name => 'Announcements', - :network_id => network.id, - :network_category_type_id => Network::Category::Type.where(:name => 'Announcement').first.id, - :network_privacy_id => Network::Privacy.where(:name => 'logged in and moderator').first.id, - :allow_comments => true, + id: 1, + name: 'Announcements', + network_id: network.id, + network_category_type_id: Network::Category::Type.where(name: 'Announcement').first.id, + network_privacy_id: Network::Privacy.where(name: 'logged in and moderator').first.id, + allow_comments: true, ) Network::Category.create_if_not_exists( - :id => 2, - :name => 'Questions', - :network_id => network.id, - :allow_comments => true, - :network_category_type_id => Network::Category::Type.where(:name => 'Question').first.id, - :network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id, + id: 2, + name: 'Questions', + network_id: network.id, + allow_comments: true, + network_category_type_id: Network::Category::Type.where(name: 'Question').first.id, + network_privacy_id: Network::Privacy.where(name: 'logged in').first.id, # :network_categories_moderator_user_ids => User.where(:login => '-').first.id, ) Network::Category.create_if_not_exists( - :id => 3, - :name => 'Ideas', - :network_id => network.id, - :network_category_type_id => Network::Category::Type.where(:name => 'Idea').first.id, - :network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id, - :allow_comments => true, + id: 3, + name: 'Ideas', + network_id: network.id, + network_category_type_id: Network::Category::Type.where(name: 'Idea').first.id, + network_privacy_id: Network::Privacy.where(name: 'logged in').first.id, + allow_comments: true, ) Network::Category.create_if_not_exists( - :id => 4, - :name => 'Bug Reports', - :network_id => network.id, - :network_category_type_id => Network::Category::Type.where(:name => 'Bug Report').first.id, - :network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id, - :allow_comments => true, + id: 4, + name: 'Bug Reports', + network_id: network.id, + network_category_type_id: Network::Category::Type.where(name: 'Bug Report').first.id, + network_privacy_id: Network::Privacy.where(name: 'logged in').first.id, + allow_comments: true, ) item = Network::Item.create( - :title => 'Example Announcement', - :body => 'Some announcement....', - :network_category_id => Network::Category.where(:name => 'Announcements').first.id, + title: 'Example Announcement', + body: 'Some announcement....', + network_category_id: Network::Category.where(name: 'Announcements').first.id, ) Network::Item::Comment.create( - :network_item_id => item.id, - :body => 'Some comment....', + network_item_id: item.id, + body: 'Some comment....', ) item = Network::Item.create( - :title => 'Example Question?', - :body => 'Some questions....', - :network_category_id => Network::Category.where(:name => 'Questions').first.id, + title: 'Example Question?', + body: 'Some questions....', + network_category_id: Network::Category.where(name: 'Questions').first.id, ) Network::Item::Comment.create( - :network_item_id => item.id, - :body => 'Some comment....', + network_item_id: item.id, + body: 'Some comment....', ) item = Network::Item.create( - :title => 'Example Idea', - :body => 'Some idea....', - :network_category_id => Network::Category.where(:name => 'Ideas').first.id, + title: 'Example Idea', + body: 'Some idea....', + network_category_id: Network::Category.where(name: 'Ideas').first.id, ) Network::Item::Comment.create( - :network_item_id => item.id, - :body => 'Some comment....', + network_item_id: item.id, + body: 'Some comment....', ) item = Network::Item.create( - :title => 'Example Bug Report', - :body => 'Some bug....', - :network_category_id => Network::Category.where(:name => 'Bug Reports').first.id, + title: 'Example Bug Report', + body: 'Some bug....', + network_category_id: Network::Category.where(name: 'Bug Reports').first.id, ) Network::Item::Comment.create( - :network_item_id => item.id, - :body => 'Some comment....', + network_item_id: item.id, + body: 'Some comment....', ) # install locales and translations diff --git a/lib/auth.rb b/lib/auth.rb index 03f2bdd46..abb70af83 100644 --- a/lib/auth.rb +++ b/lib/auth.rb @@ -20,15 +20,15 @@ returns # use std. auth backends config = [ { - :adapter => 'Auth::Internal', + adapter: 'Auth::Internal', }, { - :adapter => 'Auth::Developer', + adapter: 'Auth::Developer', }, ] # added configured backends - Setting.where( :area => 'Security::Authentication' ).each {|setting| + Setting.where( area: 'Security::Authentication' ).each {|setting| if setting.state[:value] config.push setting.state[:value] end diff --git a/lib/auth/ldap.rb b/lib/auth/ldap.rb index f72426973..0d11e6c8c 100644 --- a/lib/auth/ldap.rb +++ b/lib/auth/ldap.rb @@ -8,7 +8,7 @@ module Auth::Ldap scope = Net::LDAP::SearchScope_WholeSubtree # ldap connect - ldap = Net::LDAP.new( :host => config[:host], :port => config[:port] ) + ldap = Net::LDAP.new( host: config[:host], port: config[:port] ) # set auth data if needed if config[:bind_dn] && config[:bind_pw] @@ -33,7 +33,7 @@ module Auth::Ldap end user_dn = nil user_data = {} - ldap.search( :base => config[:base], :filter => filter, :scope => scope ) do |entry| + ldap.search( base: config[:base], filter: filter, scope: scope ) do |entry| user_data = {} user_dn = entry.dn @@ -61,8 +61,8 @@ module Auth::Ldap # create/update user if config[:sync_params] user_attributes = { - :source => 'ldap', - :updated_by_id => 1, + source: 'ldap', + updated_by_id: 1, } config[:sync_params].each {| local_data, ldap_data | if user_data[ ldap_data.downcase.to_sym ] @@ -92,7 +92,7 @@ module Auth::Ldap if config[:always_roles] role_ids = user.role_ids config[:always_roles].each {|role_name| - role = Role.where( :name => role_name ).first + role = Role.where( name: role_name ).first next if !role if !role_ids.include?( role.id ) role_ids.push role.id @@ -106,7 +106,7 @@ module Auth::Ldap if config[:always_groups] group_ids = user.group_ids config[:always_groups].each {|group_name| - group = Group.where( :name => group_name ).first + group = Group.where( name: group_name ).first next if !group if !group_ids.include?( group.id ) group_ids.push group.id diff --git a/lib/auth/otrs.rb b/lib/auth/otrs.rb index f9952dbb3..726038f05 100644 --- a/lib/auth/otrs.rb +++ b/lib/auth/otrs.rb @@ -17,7 +17,7 @@ module Auth::Otrs return false if !result['groups_rw'] return false if !result['user'] - user = User.where( :login => result['user']['UserLogin'], :active => true ).first + user = User.where( login: result['user']['UserLogin'], active: true ).first return false if !user # sync / check permissions diff --git a/lib/auto_wizard.rb b/lib/auto_wizard.rb index 8e8cb583c..2362db250 100644 --- a/lib/auto_wizard.rb +++ b/lib/auto_wizard.rb @@ -34,7 +34,7 @@ returns # create Users if auto_wizard_hash['Users'] - roles = Role.where( :name => ['Agent', 'Admin'] ) + roles = Role.where( name: ['Agent', 'Admin'] ) groups = Group.all auto_wizard_hash['Users'].each { |user_data| @@ -43,11 +43,11 @@ returns user_data_symbolized = user_data_symbolized.merge( { - :active => true, - :roles => roles, - :groups => groups, - :updated_by_id => admin_user.id, - :created_by_id => admin_user.id + active: true, + roles: roles, + groups: groups, + updated_by_id: admin_user.id, + created_by_id: admin_user.id } ) @@ -79,8 +79,8 @@ returns email_address_data_symbolized = email_address_data_symbolized.merge( { - :updated_by_id => admin_user.id, - :created_by_id => admin_user.id + updated_by_id: admin_user.id, + created_by_id: admin_user.id } ) diff --git a/lib/auto_wizzard.rb b/lib/auto_wizzard.rb index 8e8cb583c..2362db250 100644 --- a/lib/auto_wizzard.rb +++ b/lib/auto_wizzard.rb @@ -34,7 +34,7 @@ returns # create Users if auto_wizard_hash['Users'] - roles = Role.where( :name => ['Agent', 'Admin'] ) + roles = Role.where( name: ['Agent', 'Admin'] ) groups = Group.all auto_wizard_hash['Users'].each { |user_data| @@ -43,11 +43,11 @@ returns user_data_symbolized = user_data_symbolized.merge( { - :active => true, - :roles => roles, - :groups => groups, - :updated_by_id => admin_user.id, - :created_by_id => admin_user.id + active: true, + roles: roles, + groups: groups, + updated_by_id: admin_user.id, + created_by_id: admin_user.id } ) @@ -79,8 +79,8 @@ returns email_address_data_symbolized = email_address_data_symbolized.merge( { - :updated_by_id => admin_user.id, - :created_by_id => admin_user.id + updated_by_id: admin_user.id, + created_by_id: admin_user.id } ) diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index 4190f8463..bf31012ae 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -12,7 +12,7 @@ class String unless args.blank? options[:line_width] = args[0] || 82 end - options.reverse_merge!(:line_width => 82) + options.reverse_merge!(line_width: 82) lines = self lines.split("\n").collect do |line| diff --git a/lib/fill_db.rb b/lib/fill_db.rb index f6453ff93..65a67d4e9 100644 --- a/lib/fill_db.rb +++ b/lib/fill_db.rb @@ -14,41 +14,41 @@ module FillDB organization_pool = [] if organizations && !organizations.zero? (1..organizations).each {|count| - organization = Organization.create( :name => 'FillOrganization::' + rand(999_999).to_s, :active => true ) + organization = Organization.create( name: 'FillOrganization::' + rand(999_999).to_s, active: true ) organization_pool.push organization } else - organization_pool = Organization.where(:active => true) + organization_pool = Organization.where(active: true) end # create agents agent_pool = [] if agents && !agents.zero? - roles = Role.where( :name => [ 'Agent'] ) + roles = Role.where( name: [ 'Agent'] ) groups_all = Group.all (1..agents).each {|count| suffix = rand(99_999).to_s user = User.create_or_update( - :login => "filldb-agent-#{suffix}", - :firstname => "agent #{suffix}", - :lastname => "agent #{suffix}", - :email => "filldb-agent-#{suffix}@example.com", - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups_all, + login: "filldb-agent-#{suffix}", + firstname: "agent #{suffix}", + lastname: "agent #{suffix}", + email: "filldb-agent-#{suffix}@example.com", + password: 'agentpw', + active: true, + roles: roles, + groups: groups_all, ) agent_pool.push user } else - agent_pool = Role.where(:name => 'Agent').first.users.where(:active => true) + agent_pool = Role.where(name: 'Agent').first.users.where(active: true) puts " take #{agent_pool.length} agents" end # create customer customer_pool = [] if customers && !customers.zero? - roles = Role.where( :name => [ 'Customer'] ) + roles = Role.where( name: [ 'Customer'] ) groups_all = Group.all (1..customers).each {|count| suffix = rand(99_999).to_s @@ -57,19 +57,19 @@ module FillDB organization = organization_pool[ organization_pool.length-1 ] end user = User.create_or_update( - :login => "filldb-customer-#{suffix}", - :firstname => "customer #{suffix}", - :lastname => "customer #{suffix}", - :email => "filldb-customer-#{suffix}@example.com", - :password => 'customerpw', - :active => true, - :organization => organization, - :roles => roles, + login: "filldb-customer-#{suffix}", + firstname: "customer #{suffix}", + lastname: "customer #{suffix}", + email: "filldb-customer-#{suffix}@example.com", + password: 'customerpw', + active: true, + organization: organization, + roles: roles, ) customer_pool.push user } else - customer_pool = Role.where(:name => 'Customer').first.users.where(:active => true) + customer_pool = Role.where(name: 'Customer').first.users.where(active: true) end # create groups @@ -77,9 +77,9 @@ module FillDB if groups && !groups.zero? puts "1..#{groups}" (1..groups).each {|count| - group = Group.create( :name => 'FillGroup::' + rand(999_999).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| + Role.where(name: 'Agent').first.users.where(active: true).each {|user| user_groups = user.groups user_groups.push group user.groups = user_groups @@ -87,7 +87,7 @@ module FillDB } } else - group_pool = Group.where(:active => true) + group_pool = Group.where(active: true) end # create tickets @@ -98,28 +98,28 @@ 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(999_999).to_s, - :group => group_pool[ rand(group_pool.length-1) ], - :customer => customer, - :owner => agent, - :state => state_pool[ rand(state_pool.length-1) ], - :priority => priority_pool[ rand(priority_pool.length-1) ], - :updated_by_id => agent.id, - :created_by_id => agent.id, + title: 'some title äöüß' + rand(999_999).to_s, + group: group_pool[ rand(group_pool.length-1) ], + customer: customer, + owner: agent, + state: state_pool[ rand(state_pool.length-1) ], + priority: priority_pool[ rand(priority_pool.length-1) ], + updated_by_id: agent.id, + created_by_id: agent.id, ) # create article article = Ticket::Article.create( - :ticket_id => ticket.id, - :from => customer.email, - :to => 'some_recipient@example.com', - :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, - :type => Ticket::Article::Type.where(:name => 'phone').first, - :updated_by_id => agent.id, - :created_by_id => agent.id, + ticket_id: ticket.id, + from: customer.email, + to: 'some_recipient@example.com', + 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, + type: Ticket::Article::Type.where(name: 'phone').first, + updated_by_id: agent.id, + created_by_id: agent.id, ) } end diff --git a/lib/geo_ip/zammad_geo_ip.rb b/lib/geo_ip/zammad_geo_ip.rb index 8b65d7ecd..d31422724 100644 --- a/lib/geo_ip/zammad_geo_ip.rb +++ b/lib/geo_ip/zammad_geo_ip.rb @@ -19,9 +19,9 @@ class GeoIp::ZammadGeoIp "#{host}#{url}", {}, { - :json => true, - :open_timeout => 2, - :read_timeout => 4, + json: true, + open_timeout: 2, + read_timeout: 4, }, ) if !response.success? && response.code.to_s !~ /^40.$/ @@ -35,10 +35,10 @@ class GeoIp::ZammadGeoIp data['country_code'] = data['country_code2'] end - Cache.write( cache_key, data, { :expires_in => 90.days } ) + Cache.write( cache_key, data, { expires_in: 90.days } ) rescue => e puts "ERROR: #{host}#{url}: " + e.inspect - Cache.write( cache_key, data, { :expires_in => 60.minutes } ) + Cache.write( cache_key, data, { expires_in: 60.minutes } ) end data end diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index 661ac04a1..3824d098a 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -7,8 +7,8 @@ module Import::OTRS response = UserAgent.request( url, { - :user => Setting.get('import_otrs_user'), - :password => Setting.get('import_otrs_password'), + user: Setting.get('import_otrs_user'), + password: Setting.get('import_otrs_password'), }, ) if !response.success? @@ -24,10 +24,10 @@ module Import::OTRS response = UserAgent.request( url, { - :method => 'post', - :data => data, - :user => Setting.get('import_otrs_user'), - :password => Setting.get('import_otrs_password'), + method: 'post', + data: data, + user: Setting.get('import_otrs_user'), + password: Setting.get('import_otrs_password'), }, ) if !response.success? @@ -43,7 +43,7 @@ module Import::OTRS end def self.auth(username, password) - response = post( 'public.pl', { :Action => 'Export', :Type => 'Auth', :User => username, :Pw => password } ) + response = post( 'public.pl', { Action: 'Export', Type: 'Auth', User: username, Pw: password } ) return if !response return if !response.success? @@ -52,7 +52,7 @@ module Import::OTRS end def self.session(session_id) - response = post( 'public.pl', { :Action => 'Export', :Type => 'SessionCheck', :SessionID => session_id } ) + response = post( 'public.pl', { Action: 'Export', Type: 'SessionCheck', SessionID: session_id } ) return if !response return if !response.success? @@ -64,8 +64,8 @@ module Import::OTRS # check if required OTRS group exists types = { - :required_group_ro => 'groups_ro', - :required_group_rw => 'groups_rw', + required_group_ro: 'groups_ro', + required_group_rw: 'groups_rw', } types.each {|config_key,result_key| if config[config_key] @@ -79,15 +79,15 @@ module Import::OTRS user.save end types = { - :group_ro_role_map => 'groups_ro', - :group_rw_role_map => 'groups_rw', + group_ro_role_map: 'groups_ro', + group_rw_role_map: 'groups_rw', } types.each {|config_key,result_key| next if !config[config_key] config[config_key].each {|otrs_group, role| next if !result[result_key].has_value?( otrs_group ) role_ids = user.role_ids - role = Role.where( :name => role ).first + role = Role.where( name: role ).first next if !role role_ids.push role.id user.role_ids = role_ids @@ -99,7 +99,7 @@ module Import::OTRS config[:always_role].each {|role, active| next if !active role_ids = user.role_ids - role = Role.where( :name => role ).first + role = Role.where( name: role ).first next if !role role_ids.push role.id user.role_ids = role_ids @@ -227,45 +227,45 @@ module Import::OTRS def self._ticket_result(result) # puts result.inspect map = { - :Ticket => { - :Changed => :updated_at, - :Created => :created_at, - :CreateBy => :created_by_id, - :TicketNumber => :number, - :QueueID => :group_id, - :StateID => :state_id, - :PriorityID => :priority_id, - :Owner => :owner, - :CustomerUserID => :customer, - :Title => :title, - :TicketID => :id, - :FirstResponse => :first_response, + Ticket: { + Changed: :updated_at, + Created: :created_at, + CreateBy: :created_by_id, + TicketNumber: :number, + QueueID: :group_id, + StateID: :state_id, + PriorityID: :priority_id, + Owner: :owner, + CustomerUserID: :customer, + Title: :title, + TicketID: :id, + FirstResponse: :first_response, # :FirstResponseTimeDestinationDate => :first_response_escal_date, # :FirstResponseInMin => :first_response_in_min, # :FirstResponseDiffInMin => :first_response_diff_in_min, - :Closed => :close_time, + Closed: :close_time, # :SoltutionTimeDestinationDate => :close_time_escal_date, # :CloseTimeInMin => :close_time_in_min, # :CloseTimeDiffInMin => :close_time_diff_in_min, }, - :Article => { - :SenderType => :sender, - :ArticleType => :type, - :TicketID => :ticket_id, - :ArticleID => :id, - :Body => :body, - :From => :from, - :To => :to, - :Cc => :cc, - :Subject => :subject, - :InReplyTo => :in_reply_to, - :MessageID => :message_id, + Article: { + SenderType: :sender, + ArticleType: :type, + TicketID: :ticket_id, + ArticleID: :id, + Body: :body, + From: :from, + To: :to, + Cc: :cc, + Subject: :subject, + InReplyTo: :in_reply_to, + MessageID: :message_id, # :ReplyTo => :reply_to, - :References => :references, - :Changed => :updated_at, - :Created => :created_at, - :ChangedBy => :updated_by_id, - :CreatedBy => :created_by_id, + References: :references, + Changed: :updated_at, + Created: :created_at, + ChangedBy: :updated_by_id, + CreatedBy: :created_by_id, }, } @@ -275,9 +275,9 @@ module Import::OTRS ActiveRecord::Base.transaction do ticket_new = { - :title => '', - :created_by_id => 1, - :updated_by_id => 1, + title: '', + created_by_id: 1, + updated_by_id: 1, } map[:Ticket].each { |key,value| if record['Ticket'][key.to_s] && record['Ticket'][key.to_s].class == String @@ -290,11 +290,11 @@ module Import::OTRS # puts value.to_s #puts 'new ticket data ' + ticket_new.inspect # check if state already exists - ticket_old = Ticket.where( :id => ticket_new[:id] ).first + ticket_old = Ticket.where( id: ticket_new[:id] ).first #puts 'TICKET OLD ' + ticket_old.inspect # find user if ticket_new[:owner] - user = User.lookup( :login => ticket_new[:owner] ) + user = User.lookup( login: ticket_new[:owner] ) if user ticket_new[:owner_id] = user.id else @@ -303,7 +303,7 @@ module Import::OTRS ticket_new.delete(:owner) end if ticket_new[:customer] - user = User.lookup( :login => ticket_new[:customer] ) + user = User.lookup( login: ticket_new[:customer] ) if user ticket_new[:customer_id] = user.id else @@ -329,8 +329,8 @@ module Import::OTRS # get article values article_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map[:Article].each { |key,value| if article[key.to_s] @@ -348,9 +348,9 @@ module Import::OTRS email = $1 end end - user = User.where( :email => email ).first + user = User.where( email: email ).first if !user - user = User.where( :login => email ).first + user = User.where( login: email ).first end if !user begin @@ -363,58 +363,58 @@ module Import::OTRS # do extra decoding because we needed to use field.value display_name = Mail::Field.new( 'X-From', display_name ).to_s - roles = Role.lookup( :name => 'Customer' ) + roles = Role.lookup( name: 'Customer' ) user = User.create( - :login => email, - :firstname => display_name, - :lastname => '', - :email => email, - :password => '', - :active => true, - :role_ids => [roles.id], - :updated_by_id => 1, - :created_by_id => 1, + login: email, + firstname: display_name, + lastname: '', + email: email, + password: '', + active: true, + role_ids: [roles.id], + updated_by_id: 1, + created_by_id: 1, ) end article_new[:created_by_id] = user.id end if article_new[:sender] == 'customer' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'Customer' ).id article_new.delete( :sender ) end if article_new[:sender] == 'agent' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'Agent' ).id article_new.delete( :sender ) end if article_new[:sender] == 'system' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'System' ).id article_new.delete( :sender ) end if article_new[:type] == 'email-external' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'email' ).id article_new[:internal] = false elsif article_new[:type] == 'email-internal' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'email' ).id article_new[:internal] = true elsif article_new[:type] == 'note-external' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'note' ).id article_new[:internal] = false elsif article_new[:type] == 'note-internal' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'note' ).id article_new[:internal] = true elsif article_new[:type] == 'phone' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'phone' ).id article_new[:internal] = false elsif article_new[:type] == 'webrequest' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'web' ).id article_new[:internal] = false else article_new[:type_id] = 9 end article_new.delete( :type ) - article_old = Ticket::Article.where( :id => article_new[:id] ).first + article_old = Ticket::Article.where( id: article_new[:id] ).first #puts 'ARTICLE OLD ' + article_old.inspect # set state types if article_old @@ -435,12 +435,12 @@ module Import::OTRS # puts history.inspect if history['HistoryType'] == 'NewTicket' History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'created', - :history_object => 'Ticket', - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'created', + history_object: 'Ticket', + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['HistoryType'] == 'StateUpdate' @@ -451,8 +451,8 @@ module Import::OTRS if data =~ /%%(.+?)%%(.+?)%%/ from = $1 to = $2 - state_from = Ticket::State.lookup( :name => from ) - state_to = Ticket::State.lookup( :name => to ) + state_from = Ticket::State.lookup( name: from ) + state_to = Ticket::State.lookup( name: to ) if state_from from_id = state_from.id end @@ -462,17 +462,17 @@ module Import::OTRS end # puts "STATE UPDATE (#{history['HistoryID']}): -> #{from}->#{to}" History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :value_from => from, - :id_from => from_id, - :value_to => to, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + value_from: from, + id_from: from_id, + value_to: to, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['HistoryType'] == 'Move' @@ -487,17 +487,17 @@ module Import::OTRS to_id = $4 end History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'group', - :value_from => from, - :value_to => to, - :id_from => from_id, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'group', + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['HistoryType'] == 'PriorityUpdate' @@ -512,29 +512,29 @@ module Import::OTRS to_id = $4 end History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'priority', - :value_from => from, - :value_to => to, - :id_from => from_id, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'priority', + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['ArticleID'] && history['ArticleID'] != 0 History.add( - :id => history['HistoryID'], - :o_id => history['ArticleID'], - :history_type => 'created', - :history_object => 'Ticket::Article', - :related_o_id => history['TicketID'], - :related_history_object => 'Ticket', - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['ArticleID'], + history_type: 'created', + history_object: 'Ticket::Article', + related_o_id: history['TicketID'], + related_history_object: 'Ticket', + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end } @@ -550,14 +550,14 @@ module Import::OTRS result = json(response) # puts result.inspect map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :ID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + ID: :id, + ValidID: :active, + Comment: :note, }; Ticket::State.all.each {|state| @@ -570,8 +570,8 @@ module Import::OTRS # get new attributes state_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if state[key.to_s] @@ -580,14 +580,14 @@ module Import::OTRS } # check if state already exists - state_old = Ticket::State.where( :id => state_new[:id] ).first + state_old = Ticket::State.where( id: state_new[:id] ).first # puts 'st: ' + state['TypeName'] # set state types if state['TypeName'] == 'pending auto' state['TypeName'] = 'pending action' end - state_type = Ticket::StateType.where( :name => state['TypeName'] ).first + state_type = Ticket::StateType.where( name: state['TypeName'] ).first state_new[:state_type_id] = state_type.id if state_old # puts 'TS: ' + state_new.inspect @@ -606,14 +606,14 @@ module Import::OTRS result = json(response) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :ID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + ID: :id, + ValidID: :active, + Comment: :note, }; result.each { |priority| @@ -621,8 +621,8 @@ module Import::OTRS # get new attributes priority_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if priority[key.to_s] @@ -631,7 +631,7 @@ module Import::OTRS } # check if state already exists - priority_old = Ticket::Priority.where( :id => priority_new[:id] ).first + priority_old = Ticket::Priority.where( id: priority_new[:id] ).first # set state types if priority_old @@ -650,14 +650,14 @@ module Import::OTRS result = json(response) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :QueueID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + QueueID: :id, + ValidID: :active, + Comment: :note, }; result.each { |group| @@ -665,8 +665,8 @@ module Import::OTRS # get new attributes group_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if group[key.to_s] @@ -675,7 +675,7 @@ module Import::OTRS } # check if state already exists - group_old = Group.where( :id => group_new[:id] ).first + group_old = Group.where( id: group_new[:id] ).first # set state types if group_old @@ -693,32 +693,32 @@ module Import::OTRS return if !response.success? result = json(response) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :UserID => :id, - :ValidID => :active, - :Comment => :note, - :UserEmail => :email, - :UserFirstname => :firstname, - :UserLastname => :lastname, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + UserID: :id, + ValidID: :active, + Comment: :note, + UserEmail: :email, + UserFirstname: :firstname, + UserLastname: :lastname, # :UserTitle => - :UserLogin => :login, - :UserPw => :password, + UserLogin: :login, + UserPw: :password, }; result.each { |user| # puts 'USER: ' + user.inspect _set_valid(user) - role = Role.lookup( :name => 'Agent' ) + role = Role.lookup( name: 'Agent' ) # get new attributes user_new = { - :created_by_id => 1, - :updated_by_id => 1, - :source => 'OTRS Import', - :role_ids => [ role.id ], + created_by_id: 1, + updated_by_id: 1, + source: 'OTRS Import', + role_ids: [ role.id ], } map.each { |key,value| if user[key.to_s] @@ -728,7 +728,7 @@ module Import::OTRS # check if state already exists # user_old = User.where( :login => user_new[:login] ).first - user_old = User.where( :id => user_new[:id] ).first + user_old = User.where( id: user_new[:id] ).first # set state types if user_old @@ -759,25 +759,25 @@ module Import::OTRS return if !response.success? result = json(response) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :ValidID => :active, - :UserComment => :note, - :UserEmail => :email, - :UserFirstname => :firstname, - :UserLastname => :lastname, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + ValidID: :active, + UserComment: :note, + UserEmail: :email, + UserFirstname: :firstname, + UserLastname: :lastname, # :UserTitle => - :UserLogin => :login, - :UserPassword => :password, - :UserPhone => :phone, - :UserFax => :fax, - :UserMobile => :mobile, - :UserStreet => :street, - :UserZip => :zip, - :UserCity => :city, - :UserCountry => :country, + UserLogin: :login, + UserPassword: :password, + UserPhone: :phone, + UserFax: :fax, + UserMobile: :mobile, + UserStreet: :street, + UserZip: :zip, + UserCity: :city, + UserCountry: :country, }; done = true @@ -785,14 +785,14 @@ module Import::OTRS done = false _set_valid(user) - role = Role.lookup( :name => 'Customer' ) + role = Role.lookup( name: 'Customer' ) # get new attributes user_new = { - :created_by_id => 1, - :updated_by_id => 1, - :source => 'OTRS Import', - :role_ids => [role.id], + created_by_id: 1, + updated_by_id: 1, + source: 'OTRS Import', + role_ids: [role.id], } map.each { |key,value| if user[key.to_s] @@ -802,7 +802,7 @@ module Import::OTRS # check if state already exists # user_old = User.where( :login => user_new[:login] ).first - user_old = User.where( :login => user_new[:login] ).first + user_old = User.where( login: user_new[:login] ).first # set state types if user_old diff --git a/lib/import/otrs2.rb b/lib/import/otrs2.rb index 248ce93a5..593d6008c 100644 --- a/lib/import/otrs2.rb +++ b/lib/import/otrs2.rb @@ -57,10 +57,10 @@ module Import::OTRS2 url, {}, { - :open_timeout => 10, - :read_timeout => 60, - :user => Setting.get('import_otrs_user'), - :password => Setting.get('import_otrs_password'), + open_timeout: 10, + read_timeout: 60, + user: Setting.get('import_otrs_user'), + password: Setting.get('import_otrs_password'), }, ) if !response.success? @@ -94,10 +94,10 @@ module Import::OTRS2 url, data, { - :open_timeout => 6, - :read_timeout => 60, - :user => Setting.get('import_otrs_user'), - :password => Setting.get('import_otrs_password'), + open_timeout: 6, + read_timeout: 60, + user: Setting.get('import_otrs_user'), + password: Setting.get('import_otrs_password'), }, ) if !response.success? @@ -139,7 +139,7 @@ module Import::OTRS2 def self.auth(username, password) url = Setting.get('import_otrs_endpoint') url.gsub!('ZammadMigrator', 'ZammadSSO') - response = post( { :Action => 'ZammadSSO', :Subaction => 'Auth', :User => username, :Pw => password }, url ) + response = post( { Action: 'ZammadSSO', Subaction: 'Auth', User: username, Pw: password }, url ) return if !response return if !response.success? @@ -162,7 +162,7 @@ module Import::OTRS2 def self.session(session_id) url = Setting.get('import_otrs_endpoint') url.gsub!('ZammadMigrator', 'ZammadSSO') - response = post( { :Action => 'ZammadSSO', :Subaction => 'SessionCheck', :SessionID => session_id }, url ) + response = post( { Action: 'ZammadSSO', Subaction: 'SessionCheck', SessionID: session_id }, url ) return if !response return if !response.success? result = json(response) @@ -186,7 +186,7 @@ module Import::OTRS2 =end def self.load( object, limit = '', offset = '', diff = 0 ) - request_json( { :Subaction => 'Export', :Object => object, :Limit => limit, :Offset => offset, :Diff => diff }, 1 ) + request_json( { Subaction: 'Export', Object: object, Limit: limit, Offset: offset, Diff: diff }, 1 ) end =begin @@ -230,7 +230,7 @@ module Import::OTRS2 end # retrive statistic - statistic = self.request_json( { :Subaction => 'List' }, 1) + statistic = self.request_json( { Subaction: 'List' }, 1) if statistic Cache.write('import_otrs_stats', statistic) end @@ -265,17 +265,17 @@ module Import::OTRS2 user = User.count user_total = data['User'] + data['CustomerUser'] data = { - :Base => { - :done => base, - :total => base_total || 0, + Base: { + done: base, + total: base_total || 0, }, - :User => { - :done => user, - :total => user_total || 0, + User: { + done: user, + total: user_total || 0, }, - :Ticket => { - :done => Ticket.count, - :total => data['Ticket'] || 0, + Ticket: { + done: Ticket.count, + total: data['Ticket'] || 0, }, } data @@ -361,7 +361,7 @@ module Import::OTRS2 thread_count = 8 threads = {} count = 0 - locks = { :User => {} } + locks = { User: {} } (1..thread_count).each {|thread| threads[thread] = Thread.new { Thread.current[:thread_no] = thread @@ -447,7 +447,7 @@ module Import::OTRS2 count = 0 run = true steps = 20 - locks = { :User => {} } + locks = { User: {} } while run count += steps log 'loading... diff ...' @@ -469,45 +469,45 @@ module Import::OTRS2 def self._ticket_result(result, locks, thread = '-') # puts result.inspect map = { - :Ticket => { - :Changed => :updated_at, - :Created => :created_at, - :CreateBy => :created_by_id, - :TicketNumber => :number, - :QueueID => :group_id, - :StateID => :state_id, - :PriorityID => :priority_id, - :Owner => :owner, - :CustomerUserID => :customer, - :Title => :title, - :TicketID => :id, - :FirstResponse => :first_response, + Ticket: { + Changed: :updated_at, + Created: :created_at, + CreateBy: :created_by_id, + TicketNumber: :number, + QueueID: :group_id, + StateID: :state_id, + PriorityID: :priority_id, + Owner: :owner, + CustomerUserID: :customer, + Title: :title, + TicketID: :id, + FirstResponse: :first_response, # :FirstResponseTimeDestinationDate => :first_response_escal_date, # :FirstResponseInMin => :first_response_in_min, # :FirstResponseDiffInMin => :first_response_diff_in_min, - :Closed => :close_time, + Closed: :close_time, # :SoltutionTimeDestinationDate => :close_time_escal_date, # :CloseTimeInMin => :close_time_in_min, # :CloseTimeDiffInMin => :close_time_diff_in_min, }, - :Article => { - :SenderType => :sender, - :ArticleType => :type, - :TicketID => :ticket_id, - :ArticleID => :id, - :Body => :body, - :From => :from, - :To => :to, - :Cc => :cc, - :Subject => :subject, - :InReplyTo => :in_reply_to, - :MessageID => :message_id, + Article: { + SenderType: :sender, + ArticleType: :type, + TicketID: :ticket_id, + ArticleID: :id, + Body: :body, + From: :from, + To: :to, + Cc: :cc, + Subject: :subject, + InReplyTo: :in_reply_to, + MessageID: :message_id, # :ReplyTo => :reply_to, - :References => :references, - :Changed => :updated_at, - :Created => :created_at, - :ChangedBy => :updated_by_id, - :CreatedBy => :created_by_id, + References: :references, + Changed: :updated_at, + Created: :created_at, + ChangedBy: :updated_by_id, + CreatedBy: :created_by_id, }, } @@ -517,9 +517,9 @@ module Import::OTRS2 _cleanup(record) ticket_new = { - :title => '', - :created_by_id => 1, - :updated_by_id => 1, + title: '', + created_by_id: 1, + updated_by_id: 1, } map[:Ticket].each { |key,value| if record[key.to_s] && record[key.to_s].class == String @@ -528,11 +528,11 @@ module Import::OTRS2 ticket_new[value] = record[key.to_s] end } - ticket_old = Ticket.where( :id => ticket_new[:id] ).first + ticket_old = Ticket.where( id: ticket_new[:id] ).first # find owner if ticket_new[:owner] - user = User.lookup( :login => ticket_new[:owner].downcase ) + user = User.lookup( login: ticket_new[:owner].downcase ) if user ticket_new[:owner_id] = user.id else @@ -543,7 +543,7 @@ module Import::OTRS2 # find customer if ticket_new[:customer] - user = User.lookup( :login => ticket_new[:customer].downcase ) + user = User.lookup( login: ticket_new[:customer].downcase ) if user ticket_new[:customer_id] = user.id else @@ -569,8 +569,8 @@ module Import::OTRS2 # get article values article_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map[:Article].each { |key,value| if article[key.to_s] @@ -600,9 +600,9 @@ module Import::OTRS2 # lock user locks[:User][ email ] = true - user = User.where( :email => email ).first + user = User.where( email: email ).first if !user - user = User.where( :login => email ).first + user = User.where( login: email ).first end if !user begin @@ -615,17 +615,17 @@ module Import::OTRS2 # do extra decoding because we needed to use field.value display_name = Mail::Field.new( 'X-From', display_name ).to_s - roles = Role.lookup( :name => 'Customer' ) + roles = Role.lookup( name: 'Customer' ) user = User.create( - :login => email, - :firstname => display_name, - :lastname => '', - :email => email, - :password => '', - :active => true, - :role_ids => [roles.id], - :updated_by_id => 1, - :created_by_id => 1, + login: email, + firstname: display_name, + lastname: '', + email: email, + password: '', + active: true, + role_ids: [roles.id], + updated_by_id: 1, + created_by_id: 1, ) end article_new[:created_by_id] = user.id @@ -635,41 +635,41 @@ module Import::OTRS2 end if article_new[:sender] == 'customer' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'Customer' ).id article_new.delete( :sender ) end if article_new[:sender] == 'agent' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'Agent' ).id article_new.delete( :sender ) end if article_new[:sender] == 'system' - article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id + article_new[:sender_id] = Ticket::Article::Sender.lookup( name: 'System' ).id article_new.delete( :sender ) end if article_new[:type] == 'email-external' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'email' ).id article_new[:internal] = false elsif article_new[:type] == 'email-internal' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'email' ).id article_new[:internal] = true elsif article_new[:type] == 'note-external' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'note' ).id article_new[:internal] = false elsif article_new[:type] == 'note-internal' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'note' ).id article_new[:internal] = true elsif article_new[:type] == 'phone' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'phone' ).id article_new[:internal] = false elsif article_new[:type] == 'webrequest' - article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id + article_new[:type_id] = Ticket::Article::Type.lookup( name: 'web' ).id article_new[:internal] = false else article_new[:type_id] = 9 end article_new.delete( :type ) - article_old = Ticket::Article.where( :id => article_new[:id] ).first + article_old = Ticket::Article.where( id: article_new[:id] ).first # set state types if article_old @@ -688,12 +688,12 @@ module Import::OTRS2 if history['HistoryType'] == 'NewTicket' #puts "HS.add( #{history.inspect} )" res = History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'created', - :history_object => 'Ticket', - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'created', + history_object: 'Ticket', + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) #puts "res #{res.inspect}" end @@ -705,8 +705,8 @@ module Import::OTRS2 if data =~ /%%(.+?)%%(.+?)%%/ from = $1 to = $2 - state_from = Ticket::State.lookup( :name => from ) - state_to = Ticket::State.lookup( :name => to ) + state_from = Ticket::State.lookup( name: from ) + state_to = Ticket::State.lookup( name: to ) if state_from from_id = state_from.id end @@ -715,17 +715,17 @@ module Import::OTRS2 end end History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :value_from => from, - :id_from => from_id, - :value_to => to, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + value_from: from, + id_from: from_id, + value_to: to, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['HistoryType'] == 'Move' @@ -740,17 +740,17 @@ module Import::OTRS2 to_id = $4 end History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'group', - :value_from => from, - :value_to => to, - :id_from => from_id, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'group', + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['HistoryType'] == 'PriorityUpdate' @@ -765,29 +765,29 @@ module Import::OTRS2 to_id = $4 end History.add( - :id => history['HistoryID'], - :o_id => history['TicketID'], - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'priority', - :value_from => from, - :value_to => to, - :id_from => from_id, - :id_to => to_id, - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'priority', + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end if history['ArticleID'] && history['ArticleID'] != 0 History.add( - :id => history['HistoryID'], - :o_id => history['ArticleID'], - :history_type => 'created', - :history_object => 'Ticket::Article', - :related_o_id => history['TicketID'], - :related_history_object => 'Ticket', - :created_at => history['CreateTime'], - :created_by_id => history['CreateBy'] + id: history['HistoryID'], + o_id: history['ArticleID'], + history_type: 'created', + history_object: 'Ticket::Article', + related_o_id: history['TicketID'], + related_history_object: 'Ticket', + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] ) end } @@ -797,14 +797,14 @@ module Import::OTRS2 # sync ticket states def self.state(records) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :ID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + ID: :id, + ValidID: :active, + Comment: :note, }; # rename states to handle not uniq issues @@ -818,8 +818,8 @@ module Import::OTRS2 # get new attributes state_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if state.has_key?(key.to_s) @@ -828,14 +828,14 @@ module Import::OTRS2 } # check if state already exists - state_old = Ticket::State.where( :id => state_new[:id] ).first + state_old = Ticket::State.where( id: state_new[:id] ).first # puts 'st: ' + state['TypeName'] # set state types if state['TypeName'] == 'pending auto' state['TypeName'] = 'pending action' end - state_type = Ticket::StateType.where( :name => state['TypeName'] ).first + state_type = Ticket::StateType.where( name: state['TypeName'] ).first state_new[:state_type_id] = state_type.id if state_old # puts 'TS: ' + state_new.inspect @@ -852,14 +852,14 @@ module Import::OTRS2 def self.priority(records) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :ID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + ID: :id, + ValidID: :active, + Comment: :note, }; records.each { |priority| @@ -867,8 +867,8 @@ module Import::OTRS2 # get new attributes priority_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if priority.has_key?(key.to_s) @@ -877,7 +877,7 @@ module Import::OTRS2 } # check if state already exists - priority_old = Ticket::Priority.where( :id => priority_new[:id] ).first + priority_old = Ticket::Priority.where( id: priority_new[:id] ).first # set state types if priority_old @@ -893,14 +893,14 @@ module Import::OTRS2 # sync ticket groups / queues def self.ticket_group(records) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :Name => :name, - :QueueID => :id, - :ValidID => :active, - :Comment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + Name: :name, + QueueID: :id, + ValidID: :active, + Comment: :note, }; records.each { |group| @@ -908,8 +908,8 @@ module Import::OTRS2 # get new attributes group_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if group.has_key?(key.to_s) @@ -918,7 +918,7 @@ module Import::OTRS2 } # check if state already exists - group_old = Group.where( :id => group_new[:id] ).first + group_old = Group.where( id: group_new[:id] ).first # set state types if group_old @@ -935,19 +935,19 @@ module Import::OTRS2 def self.user(records, groups, roles, queues) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :UserID => :id, - :ValidID => :active, - :Comment => :note, - :UserEmail => :email, - :UserFirstname => :firstname, - :UserLastname => :lastname, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + UserID: :id, + ValidID: :active, + Comment: :note, + UserEmail: :email, + UserFirstname: :firstname, + UserLastname: :lastname, # :UserTitle => - :UserLogin => :login, - :UserPw => :password, + UserLogin: :login, + UserPw: :password, }; @@ -962,11 +962,11 @@ module Import::OTRS2 # get new attributes user_new = { - :created_by_id => 1, - :updated_by_id => 1, - :source => 'OTRS Import', - :role_ids => role_ids, - :group_ids => group_ids, + created_by_id: 1, + updated_by_id: 1, + source: 'OTRS Import', + role_ids: role_ids, + group_ids: group_ids, } map.each { |key,value| if user.has_key?(key.to_s) @@ -980,7 +980,7 @@ module Import::OTRS2 end # check if agent already exists - user_old = User.where( :id => user_new[:id] ).first + user_old = User.where( id: user_new[:id] ).first # check if login is already used login_in_use = User.where( "login = ? AND id != #{user_new[:id]}", user_new[:login].downcase ).count @@ -1046,7 +1046,7 @@ module Import::OTRS2 } } roles.each {|role| - role_lookup = Role.lookup( :name => role ) + role_lookup = Role.lookup( name: role ) if role_lookup role_ids.push role_lookup.id end @@ -1058,40 +1058,40 @@ module Import::OTRS2 def self.customer(records, organizations) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :ValidID => :active, - :UserComment => :note, - :UserEmail => :email, - :UserFirstname => :firstname, - :UserLastname => :lastname, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + ValidID: :active, + UserComment: :note, + UserEmail: :email, + UserFirstname: :firstname, + UserLastname: :lastname, # :UserTitle => - :UserLogin => :login, - :UserPassword => :password, - :UserPhone => :phone, - :UserFax => :fax, - :UserMobile => :mobile, - :UserStreet => :street, - :UserZip => :zip, - :UserCity => :city, - :UserCountry => :country, + UserLogin: :login, + UserPassword: :password, + UserPhone: :phone, + UserFax: :fax, + UserMobile: :mobile, + UserStreet: :street, + UserZip: :zip, + UserCity: :city, + UserCountry: :country, }; - role_agent = Role.lookup( :name => 'Agent' ) - role_customer = Role.lookup( :name => 'Customer' ) + role_agent = Role.lookup( name: 'Agent' ) + role_customer = Role.lookup( name: 'Customer' ) records.each { |user| _set_valid(user) # get new attributes user_new = { - :created_by_id => 1, - :updated_by_id => 1, - :source => 'OTRS Import', - :organization_id => get_organization_id(user, organizations), - :role_ids => [ role_customer.id ], + created_by_id: 1, + updated_by_id: 1, + source: 'OTRS Import', + organization_id: get_organization_id(user, organizations), + role_ids: [ role_customer.id ], } map.each { |key,value| if user.has_key?(key.to_s) @@ -1100,7 +1100,7 @@ module Import::OTRS2 } # check if customer already exists - user_old = User.where( :login => user_new[:login] ).first + user_old = User.where( login: user_new[:login] ).first # create / update agent if user_old @@ -1128,7 +1128,7 @@ module Import::OTRS2 if user['UserCustomerID'] organizations.each {|organization| if user['UserCustomerID'] == organization['CustomerID'] - organization = Organization.where(:name => organization['CustomerCompanyName'] ).first + organization = Organization.where(name: organization['CustomerCompanyName'] ).first organization_id = organization.id end } @@ -1140,13 +1140,13 @@ module Import::OTRS2 def self.organization(records) map = { - :ChangeTime => :updated_at, - :CreateTime => :created_at, - :CreateBy => :created_by_id, - :ChangeBy => :updated_by_id, - :CustomerCompanyName => :name, - :ValidID => :active, - :CustomerCompanyComment => :note, + ChangeTime: :updated_at, + CreateTime: :created_at, + CreateBy: :created_by_id, + ChangeBy: :updated_by_id, + CustomerCompanyName: :name, + ValidID: :active, + CustomerCompanyComment: :note, }; records.each { |organization| @@ -1154,8 +1154,8 @@ module Import::OTRS2 # get new attributes organization_new = { - :created_by_id => 1, - :updated_by_id => 1, + created_by_id: 1, + updated_by_id: 1, } map.each { |key,value| if organization.has_key?(key.to_s) @@ -1164,7 +1164,7 @@ module Import::OTRS2 } # check if state already exists - organization_old = Organization.where( :name => organization_new[:name] ).first + organization_old = Organization.where( name: organization_new[:name] ).first # set state types if organization_old @@ -1214,10 +1214,10 @@ module Import::OTRS2 if setting['Key'] == 'Ticket::NumberGenerator' if setting['Value'] == 'Kernel::System::Ticket::Number::DateChecksum' Setting.set( 'ticket_number', 'Ticket::Number::Date' ) - Setting.set( 'ticket_number_date', { :checksum => true } ) + Setting.set( 'ticket_number_date', { checksum: true } ) elsif setting['Value'] == 'Kernel::System::Ticket::Number::Date' Setting.set( 'ticket_number', 'Ticket::Number::Date' ) - Setting.set( 'ticket_number_date', { :checksum => false } ) + Setting.set( 'ticket_number_date', { checksum: false } ) end end diff --git a/lib/notification_factory.rb b/lib/notification_factory.rb index 54c9edefb..72fc02e43 100644 --- a/lib/notification_factory.rb +++ b/lib/notification_factory.rb @@ -112,11 +112,11 @@ module NotificationFactory Channel::EmailSend.send( { # :in_reply_to => self.in_reply_to, - :from => sender, - :to => data[:recipient][:email], - :subject => data[:subject], - :body => data[:body], - :content_type => content_type, + from: sender, + to: data[:recipient][:email], + subject: data[:subject], + body: data[:body], + content_type: content_type, }, true ) diff --git a/lib/rss.rb b/lib/rss.rb index 081773b6b..5a2d0524c 100644 --- a/lib/rss.rb +++ b/lib/rss.rb @@ -17,17 +17,17 @@ module Rss fetched = 0 rss.items.each { |item| record = { - :id => item.id, - :title => Encode.conv( 'utf8', item.title ), - :summary => Encode.conv( 'utf8', item.summary ), - :link => item.link, - :published => item.published + id: item.id, + title: Encode.conv( 'utf8', item.title ), + summary: Encode.conv( 'utf8', item.summary ), + link: item.link, + published: item.published } items.push record fetched += 1 break item if fetched == limit.to_i } - Cache.write( cache_key, items, :expires_in => 4.hours ) + Cache.write( cache_key, items, expires_in: 4.hours ) rescue Exception => e puts "can't fetch #{url}" puts e.inspect diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index f9cb6daba..fa9864bba 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -50,11 +50,11 @@ create/update/delete index url, data[:data], { - :json => true, - :open_timeout => 5, - :read_timeout => 20, - :user => Setting.get('es_user'), - :password => Setting.get('es_password'), + json: true, + open_timeout: 5, + read_timeout: 20, + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) puts "# #{response.code.to_s}" @@ -82,11 +82,11 @@ add new object to search index url, data, { - :json => true, - :open_timeout => 5, - :read_timeout => 20, - :user => Setting.get('es_user'), - :password => Setting.get('es_password'), + json: true, + open_timeout: 5, + read_timeout: 20, + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) puts "# #{response.code.to_s}" @@ -113,10 +113,10 @@ remove whole data from index response = UserAgent.delete( url, { - :open_timeout => 5, - :read_timeout => 14, - :user => Setting.get('es_user'), - :password => Setting.get('es_password'), + open_timeout: 5, + read_timeout: 14, + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) #puts "# #{response.code.to_s}" @@ -170,8 +170,8 @@ return search result data['sort'] = [ { - :updated_at => { - :order => 'desc' + updated_at: { + order: 'desc' } }, '_score' @@ -200,11 +200,11 @@ return search result url, data, { - :json => true, - :open_timeout => 5, - :read_timeout => 14, - :user => Setting.get('es_user'), - :password => Setting.get('es_password'), + json: true, + open_timeout: 5, + read_timeout: 14, + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) @@ -222,8 +222,8 @@ return search result data['hits']['hits'].each { |item| puts "... #{item['_type'].to_s} #{item['_id'].to_s}" data = { - :id => item['_id'], - :type => item['_type'], + id: item['_id'], + type: item['_type'], } ids.push data } diff --git a/lib/session_helper.rb b/lib/session_helper.rb index 876b9dae8..602f142c3 100644 --- a/lib/session_helper.rb +++ b/lib/session_helper.rb @@ -36,7 +36,7 @@ module SessionHelper end def self.get(id) - ActiveRecord::SessionStore::Session.where( :id => id ).first + ActiveRecord::SessionStore::Session.where( id: id ).first end def self.list(limit = 10_000) @@ -44,7 +44,7 @@ module SessionHelper end def self.destroy(id) - session = ActiveRecord::SessionStore::Session.where( :id => id ).first + session = ActiveRecord::SessionStore::Session.where( id: id ).first return if !session session.destroy end diff --git a/lib/sessions.rb b/lib/sessions.rb index c72cdbf92..1f125806d 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -34,8 +34,8 @@ returns meta[:last_ping] = Time.new.to_i.to_s File.open( path + '/session', 'wb' ) { |file| data = { - :user => session, - :meta => meta, + user: session, + meta: meta, } file.write data.to_json } @@ -43,8 +43,8 @@ returns # send update to browser if session && session['id'] self.send( client_id, { - :event => 'ws:login', - :data => { :success => true }, + event: 'ws:login', + data: { success: true }, }) end end @@ -397,8 +397,8 @@ returns file = Time.new.to_f.to_s + '-' + rand(99_999).to_s File.open( path + '/' + file , 'wb' ) { |file| data = { - :msg => msg, - :timestamp => Time.now.to_i, + msg: msg, + timestamp: Time.now.to_i, } file.write data.to_json } @@ -444,8 +444,8 @@ returns message_parsed['recipient']['user_id'].each { |user_id| if current_user_id == user_id item = { - :type => 'direct', - :message => message_parsed, + type: 'direct', + message: message_parsed, } data.push item end @@ -454,8 +454,8 @@ returns # spool to every client else item = { - :type => 'broadcast', - :message => message_parsed, + type: 'broadcast', + message: message_parsed, } data.push item end @@ -488,7 +488,7 @@ returns next if !session_data next if !session_data[:user] next if !session_data[:user]['id'] - user = User.lookup( :id => session_data[:user]['id'] ) + user = User.lookup( id: session_data[:user]['id'] ) next if !user # start client thread diff --git a/lib/sessions/backend/activity_stream.rb b/lib/sessions/backend/activity_stream.rb index a1ec77cb3..2665c5ab1 100644 --- a/lib/sessions/backend/activity_stream.rb +++ b/lib/sessions/backend/activity_stream.rb @@ -39,7 +39,7 @@ class Sessions::Backend::ActivityStream return if timeout # set new timeout - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) data = self.load @@ -47,17 +47,17 @@ class Sessions::Backend::ActivityStream if !@client return { - :event => 'activity_stream_rebuild', - :collection => 'activity_stream', - :data => data, + event: 'activity_stream_rebuild', + collection: 'activity_stream', + data: data, } end @client.log 'notify', "push activity_stream #{ data.first.class.to_s } for user #{ @user.id }" @client.send({ - :event => 'activity_stream_rebuild', - :collection => 'activity_stream', - :data => data, + event: 'activity_stream_rebuild', + collection: 'activity_stream', + data: data, }) end diff --git a/lib/sessions/backend/collections/base.rb b/lib/sessions/backend/collections/base.rb index c5526dd07..0f4b5f26d 100644 --- a/lib/sessions/backend/collections/base.rb +++ b/lib/sessions/backend/collections/base.rb @@ -42,7 +42,7 @@ class Sessions::Backend::Collections::Base return if timeout # set new timeout - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) # check if update has been done last_change = self.class.model.constantize.latest_change @@ -67,22 +67,22 @@ class Sessions::Backend::Collections::Base } if !@client return { - :collection => { + collection: { items.first.class.to_app_model => all, }, - :assets => assets, + assets: assets, } end @client.log 'notify', "push assets for push_collection #{ items.first.class.to_s } for user #{ @user.id }" @client.send({ - :data => assets, - :event => [ 'loadAssets' ], + data: assets, + event: [ 'loadAssets' ], }) @client.log 'notify', "push push_collection #{ items.first.class.to_s } for user #{ @user.id }" @client.send({ - :event => 'resetCollection', - :data => { + event: 'resetCollection', + data: { items.first.class.to_app_model => all, }, }) diff --git a/lib/sessions/backend/collections/organization.rb b/lib/sessions/backend/collections/organization.rb index 7d9666059..daa0898b6 100644 --- a/lib/sessions/backend/collections/organization.rb +++ b/lib/sessions/backend/collections/organization.rb @@ -9,7 +9,7 @@ class Sessions::Backend::Collections::Organization < Sessions::Backend::Collecti all = Organization.all else if @user.organization_id - all = Organization.where( :id => @user.organization_id ) + all = Organization.where( id: @user.organization_id ) end end diff --git a/lib/sessions/backend/rss.rb b/lib/sessions/backend/rss.rb index 224d899c9..db787c4bf 100644 --- a/lib/sessions/backend/rss.rb +++ b/lib/sessions/backend/rss.rb @@ -23,7 +23,7 @@ class Sessions::Backend::Rss rss_items = Rss.fetch( url, 8 ) # set new timeout - Sessions::CacheIn.set( self.collection_key, rss_items, { :expires_in => 1.hours } ) + Sessions::CacheIn.set( self.collection_key, rss_items, { expires_in: 1.hours } ) rss_items end @@ -39,7 +39,7 @@ class Sessions::Backend::Rss return if timeout # set new timeout - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) data = self.load @@ -47,17 +47,17 @@ class Sessions::Backend::Rss if !@client return { - :event => 'rss_rebuild', - :collection => 'dashboard_rss', - :data => data, + event: 'rss_rebuild', + collection: 'dashboard_rss', + data: data, } end @client.log 'notify', "push rss for user #{@user.id}" @client.send({ - :event => 'rss_rebuild', - :collection => 'dashboard_rss', - :data => data, + event: 'rss_rebuild', + collection: 'dashboard_rss', + data: data, }) end diff --git a/lib/sessions/backend/ticket_create.rb b/lib/sessions/backend/ticket_create.rb index c984333af..22592251d 100644 --- a/lib/sessions/backend/ticket_create.rb +++ b/lib/sessions/backend/ticket_create.rb @@ -11,7 +11,7 @@ class Sessions::Backend::TicketCreate # get attributes to update ticket_create_attributes = Ticket::ScreenOptions.attributes_to_change( - :user => @user.id, + user: @user.id, ) # no data exists @@ -37,7 +37,7 @@ class Sessions::Backend::TicketCreate return if timeout # set new timeout - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) ticket_create_attributes = self.load @@ -45,25 +45,25 @@ class Sessions::Backend::TicketCreate data = { - :assets => ticket_create_attributes[:assets], - :form_meta => { - :filter => ticket_create_attributes[:filter], - :dependencies => ticket_create_attributes[:dependencies], + assets: ticket_create_attributes[:assets], + form_meta: { + filter: ticket_create_attributes[:filter], + dependencies: ticket_create_attributes[:dependencies], } } if !@client return { - :collection => 'ticket_create_attributes', - :data => data, + collection: 'ticket_create_attributes', + data: data, } end @client.log 'notify', "push ticket_create for user #{ @user.id }" @client.send({ - :collection => 'ticket_create_attributes', - :data => data, + collection: 'ticket_create_attributes', + data: data, }) end diff --git a/lib/sessions/backend/ticket_overview_index.rb b/lib/sessions/backend/ticket_overview_index.rb index aaa5761f1..f41302bcc 100644 --- a/lib/sessions/backend/ticket_overview_index.rb +++ b/lib/sessions/backend/ticket_overview_index.rb @@ -12,7 +12,7 @@ class Sessions::Backend::TicketOverviewIndex # get whole collection overview = Ticket::Overviews.list( - :current_user => @user, + current_user: @user, ) # no data exists @@ -37,7 +37,7 @@ class Sessions::Backend::TicketOverviewIndex return if Sessions::CacheIn.get( self.client_key ) # reset check interval - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) # check if min one ticket has changed last_ticket_change = Ticket.latest_change @@ -51,15 +51,15 @@ class Sessions::Backend::TicketOverviewIndex if !@client return { - :event => 'ticket_overview_index', - :data => data, + event: 'ticket_overview_index', + data: data, } end @client.log 'notify', "push overview_index for user #{ @user.id }" @client.send({ - :event => ['ticket_overview_index'], - :data => data, + event: ['ticket_overview_index'], + data: data, }) end diff --git a/lib/sessions/backend/ticket_overview_list.rb b/lib/sessions/backend/ticket_overview_list.rb index 16791ba29..5c4b04a78 100644 --- a/lib/sessions/backend/ticket_overview_list.rb +++ b/lib/sessions/backend/ticket_overview_list.rb @@ -12,16 +12,16 @@ class Sessions::Backend::TicketOverviewList # get whole collection overviews = Ticket::Overviews.all( - :current_user => @user, + current_user: @user, ) result = [] overviews.each { |overview| overview_data = Ticket::Overviews.list( - :view => overview.link, - :current_user => @user, - :array => true, + view: overview.link, + current_user: @user, + array: true, ) - data = { :list => overview_data, :index => overview } + data = { list: overview_data, index: overview } result.push data } @@ -47,7 +47,7 @@ class Sessions::Backend::TicketOverviewList return if Sessions::CacheIn.get( self.client_key ) # reset check interval - Sessions::CacheIn.set( self.client_key, true, { :expires_in => @ttl.seconds } ) + Sessions::CacheIn.set( self.client_key, true, { expires_in: @ttl.seconds } ) # check if min one ticket has changed last_ticket_change = Ticket.latest_change @@ -73,7 +73,7 @@ class Sessions::Backend::TicketOverviewList # get groups group_ids = [] - Group.where( :active => true ).each { |group| + Group.where( active: true ).each { |group| group_ids.push group.id } agents = {} @@ -97,8 +97,8 @@ class Sessions::Backend::TicketOverviewList if !@client result = { - :event => 'navupdate_ticket_overview', - :data => item[:index], + event: 'navupdate_ticket_overview', + data: item[:index], } results.push result else @@ -107,21 +107,21 @@ class Sessions::Backend::TicketOverviewList # send update to browser @client.send({ - :data => assets, - :event => [ 'loadAssets' ] + data: assets, + event: [ 'loadAssets' ] }) @client.send({ - :data => { - :view => item[:index].link.to_s, - :overview => overview_data[:overview], - :ticket_ids => overview_data[:ticket_ids], - :tickets_count => overview_data[:tickets_count], - :bulk => { - :group_id__owner_id => groups_users, - :owner_id => [], + data: { + view: item[:index].link.to_s, + overview: overview_data[:overview], + ticket_ids: overview_data[:ticket_ids], + tickets_count: overview_data[:tickets_count], + bulk: { + group_id__owner_id: groups_users, + owner_id: [], }, }, - :event => [ 'ticket_overview_rebuild' ], + event: [ 'ticket_overview_rebuild' ], }) end } diff --git a/lib/sessions/client.rb b/lib/sessions/client.rb index f175e3426..c4899ed92 100644 --- a/lib/sessions/client.rb +++ b/lib/sessions/client.rb @@ -28,7 +28,7 @@ class Sessions::Client return if !session_data return if !session_data[:user] return if !session_data[:user]['id'] - user = User.lookup( :id => session_data[:user]['id'] ) + user = User.lookup( id: session_data[:user]['id'] ) return if !user # init new backends diff --git a/lib/sso.rb b/lib/sso.rb index 67ef0a9f5..f85add86f 100644 --- a/lib/sso.rb +++ b/lib/sso.rb @@ -20,26 +20,26 @@ returns # use std. auth backends config = [ { - :adapter => 'Sso::Env', + adapter: 'Sso::Env', }, { - :adapter => 'Sso::Otrs', - :required_group_ro => 'stats', - :group_rw_role_map => { + adapter: 'Sso::Otrs', + required_group_ro: 'stats', + group_rw_role_map: { 'admin' => 'Admin', 'stats' => 'Report', }, - :group_ro_role_map => { + group_ro_role_map: { 'stats' => 'Report', }, - :always_role => { + always_role: { 'Agent' => true, }, }, ] # added configured backends - Setting.where( :area => 'Security::SSO' ).each {|setting| + Setting.where( area: 'Security::SSO' ).each {|setting| if setting.state[:value] config.push setting.state[:value] end diff --git a/lib/sso/env.rb b/lib/sso/env.rb index 46cd3f915..4f0cb2608 100644 --- a/lib/sso/env.rb +++ b/lib/sso/env.rb @@ -5,12 +5,12 @@ module Sso::Env # try to find user based on login if ENV['REMOTE_USER'] - user = User.where( :login => ENV['REMOTE_USER'], :active => true ).first + user = User.where( login: ENV['REMOTE_USER'], active: true ).first return user if user end if ENV['HTTP_REMOTE_USER'] - user = User.where( :login => ENV['HTTP_REMOTE_USER'], :active => true ).first + user = User.where( login: ENV['HTTP_REMOTE_USER'], active: true ).first return user if user end diff --git a/lib/sso/otrs.rb b/lib/sso/otrs.rb index 068bf83aa..96c5622d5 100644 --- a/lib/sso/otrs.rb +++ b/lib/sso/otrs.rb @@ -17,7 +17,7 @@ module Sso::Otrs return false if !result['groups_rw'] return false if !result['user'] - user = User.where( :login => result['user']['UserLogin'], :active => true ).first + user = User.where( login: result['user']['UserLogin'], active: true ).first if !user Rails.logger.notice "No such user #{result['user']['UserLogin']}, requested for SSO!" diff --git a/lib/static_assets.rb b/lib/static_assets.rb index b580a960b..c5f23f070 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -12,13 +12,13 @@ module StaticAssets # store image 1:1 def self.store_raw( content, content_type ) - Store.remove( :object => 'System::Logo', :o_id => 1 ) + Store.remove( object: 'System::Logo', o_id: 1 ) Store.add( - :object => 'System::Logo', - :o_id => 1, - :data => content, - :filename => 'image', - :preferences => { + object: 'System::Logo', + o_id: 1, + data: content, + filename: 'image', + preferences: { 'Content-Type' => content_type }, ) @@ -27,7 +27,7 @@ module StaticAssets # read raw 1:1 def self.read_raw - list = Store.list( :object => 'System::Logo', :o_id => 1 ) + list = Store.list( object: 'System::Logo', o_id: 1 ) if list && list[0] return Store.find( list[0] ) end @@ -36,13 +36,13 @@ module StaticAssets # store image in right size def self.store( content, content_type ) - Store.remove( :object => 'System::Logo', :o_id => 2 ) + Store.remove( object: 'System::Logo', o_id: 2 ) Store.add( - :object => 'System::Logo', - :o_id => 2, - :data => content, - :filename => 'image', - :preferences => { + object: 'System::Logo', + o_id: 2, + data: content, + filename: 'image', + preferences: { 'Content-Type' => content_type }, ) @@ -54,11 +54,11 @@ module StaticAssets def self.read # use reduced dimensions - list = Store.list( :object => 'System::Logo', :o_id => 2 ) + list = Store.list( object: 'System::Logo', o_id: 2 ) # as fallback use 1:1 if !list || !list[0] - list = Store.list( :object => 'System::Logo', :o_id => 1 ) + list = Store.list( object: 'System::Logo', o_id: 1 ) end # store hash in config diff --git a/lib/tasks/search_index_es.rake b/lib/tasks/search_index_es.rake index 49cfcc620..e05d1bf9e 100644 --- a/lib/tasks/search_index_es.rake +++ b/lib/tasks/search_index_es.rake @@ -7,7 +7,7 @@ namespace :searchindex do # drop indexes puts 'drop indexes...' SearchIndexBackend.index( - :action => 'delete', + action: 'delete', ) end @@ -17,17 +17,17 @@ namespace :searchindex do # create indexes puts 'create indexes...' SearchIndexBackend.index( - :action => 'create', - :data => { - :mappings => { - :Ticket => { - :_source => { :excludes => [ 'articles.attachments' ] }, - :properties => { - :articles => { - :type => 'nested', - :properties => { - :attachments => { - :type => 'attachment', + action: 'create', + data: { + mappings: { + Ticket: { + _source: { excludes: [ 'articles.attachments' ] }, + properties: { + articles: { + type: 'nested', + properties: { + attachments: { + type: 'attachment', } } } diff --git a/lib/time_calculation.rb b/lib/time_calculation.rb index 0f69dc01e..222bebfe3 100644 --- a/lib/time_calculation.rb +++ b/lib/time_calculation.rb @@ -57,13 +57,13 @@ put working hours matrix and timezone in function, returns UTC working hours mat hours_to_shift = (time_diff / 3600 ).round move_items = { - :Mon => [], - :Tue => [], - :Wed => [], - :Thu => [], - :Fri => [], - :Sat => [], - :Sun => [], + Mon: [], + Tue: [], + Wed: [], + Thu: [], + Fri: [], + Sat: [], + Sun: [], } (1..hours_to_shift).each {|count| working_hours.each {|day, value| diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 995322839..475c8a657 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -59,9 +59,9 @@ returns return process(response, uri, count, params, options) rescue Exception => e return Result.new( - :error => e.inspect, - :success => false, - :code => 0, + error: e.inspect, + success: false, + code: 0, ) end end @@ -107,9 +107,9 @@ returns return process(response, uri, count, params, options) rescue Exception => e return Result.new( - :error => e.inspect, - :success => false, - :code => 0, + error: e.inspect, + success: false, + code: 0, ) end end @@ -155,9 +155,9 @@ returns return process(response, uri, count, params, options) rescue Exception => e return Result.new( - :error => e.inspect, - :success => false, - :code => 0, + error: e.inspect, + success: false, + code: 0, ) end end @@ -196,9 +196,9 @@ returns return process(response, uri, count, {}, options) rescue Exception => e return Result.new( - :error => e.inspect, - :success => false, - :code => 0, + error: e.inspect, + success: false, + code: 0, ) end end @@ -282,30 +282,30 @@ returns def self.process(response, uri, count, params, options) if !response return Result.new( - :error => "Can't connect to #{uri.to_s}, got no response!", - :success => false, - :code => 0, + error: "Can't connect to #{uri.to_s}, got no response!", + success: false, + code: 0, ) end case response when Net::HTTPNotFound return Result.new( - :error => "No such file #{uri.to_s}, 404!", - :success => false, - :code => response.code, + error: "No such file #{uri.to_s}, 404!", + success: false, + code: response.code, ) when Net::HTTPClientError return Result.new( - :error => "Client Error: #{response.inspect}!", - :success => false, - :code => response.code, + error: "Client Error: #{response.inspect}!", + success: false, + code: response.code, ) when Net::HTTPInternalServerError return Result.new( - :error => "Server Error: #{response.inspect}!", - :success => false, - :code => response.code, + error: "Server Error: #{response.inspect}!", + success: false, + code: response.code, ) when Net::HTTPRedirection raise 'Too many redirections for the original URL, halting.' if count <= 0 @@ -317,11 +317,11 @@ returns data = JSON.parse( response.body ) end return Result.new( - :data => data, - :body => response.body, - :content_type => response['Content-Type'], - :success => true, - :code => response.code, + data: data, + body: response.body, + content_type: response['Content-Type'], + success: true, + code: response.code, ) when Net::HTTPCreated data = nil @@ -329,11 +329,11 @@ returns data = JSON.parse( response.body ) end return Result.new( - :data => data, - :body => response.body, - :content_type => response['Content-Type'], - :success => true, - :code => response.code, + data: data, + body: response.body, + content_type: response['Content-Type'], + success: true, + code: response.code, ) end @@ -362,26 +362,26 @@ returns ftp.getbinaryfile( filename, temp_file ) rescue => e return Result.new( - :error => e.inspect, - :success => false, - :code => '550', + error: e.inspect, + success: false, + code: '550', ) end end rescue => e return Result.new( - :error => e.inspect, - :success => false, - :code => 0, + error: e.inspect, + success: false, + code: 0, ) end contents = temp_file.read temp_file.close Result.new( - :body => contents, - :success => true, - :code => '200', + body: contents, + success: true, + code: '200', ) end diff --git a/script/scheduler.rb b/script/scheduler.rb index 3fa75a33d..5dc8364d7 100755 --- a/script/scheduler.rb +++ b/script/scheduler.rb @@ -8,10 +8,10 @@ require 'daemons' dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) daemon_options = { - :multiple => true, - :dir_mode => :normal, - :dir => File.join(dir, 'tmp', 'pids'), - :backtrace => true + multiple: true, + dir_mode: :normal, + dir: File.join(dir, 'tmp', 'pids'), + backtrace: true } runner_count = 2 diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 8d011c354..a30f37f6b 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -14,14 +14,14 @@ require 'daemons' # Look for -o with argument, and -I and -D boolean arguments @options = { - :p => 6042, - :b => '0.0.0.0', - :s => false, - :v => false, - :d => false, - :k => '/path/to/server.key', - :c => '/path/to/server.crt', - :i => Dir.pwd.to_s + '/tmp/pids/websocket.pid' + p: 6042, + b: '0.0.0.0', + s: false, + v: false, + d: false, + k: '/path/to/server.key', + c: '/path/to/server.crt', + i: Dir.pwd.to_s + '/tmp/pids/websocket.pid' } tls_options = {} @@ -85,19 +85,19 @@ end @clients = {} EventMachine.run { - EventMachine::WebSocket.start( :host => @options[:b], :port => @options[:p], :secure => @options[:s], :tls_options => tls_options ) do |ws| + EventMachine::WebSocket.start( host: @options[:b], port: @options[:p], secure: @options[:s], tls_options: tls_options ) do |ws| # register client connection ws.onopen { client_id = ws.object_id.to_s log 'notice', 'Client connected.', client_id - Sessions.create( client_id, {}, { :type => 'websocket' } ) + Sessions.create( client_id, {}, { type: 'websocket' } ) if !@clients.include? client_id @clients[client_id] = { - :websocket => ws, - :last_ping => Time.new, - :error_count => 0, + websocket: ws, + last_ping: Time.new, + error_count: 0, } end } @@ -171,7 +171,7 @@ EventMachine.run { # get session if data['action'] == 'login' @clients[client_id][:session] = data['session'] - Sessions.create( client_id, data['session'], { :type => 'websocket' } ) + Sessions.create( client_id, data['session'], { type: 'websocket' } ) # remember ping, send pong back elsif data['action'] == 'ping' diff --git a/test/browser/aaa_getting_started_test.rb b/test/browser/aaa_getting_started_test.rb index f4b60f8c3..6195f7a6a 100644 --- a/test/browser/aaa_getting_started_test.rb +++ b/test/browser/aaa_getting_started_test.rb @@ -13,153 +13,153 @@ class AaaGettingStartedTest < TestCase mailbox_password = ENV['MAILBOX_INIT'].split(':')[1] @browser = browser_instance - location( :url => browser_url ) + location( url: browser_url ) watch_for( - :css => '.setup.wizard', - :value => 'setup new system', + css: '.setup.wizard', + value: 'setup new system', ) - click( :css => '.js-start .btn--primary' ) + click( css: '.js-start .btn--primary' ) set( - :css => '.js-admin input[name="firstname"]', - :value => 'Test Master', + css: '.js-admin input[name="firstname"]', + value: 'Test Master', ) set( - :css => '.js-admin input[name="lastname"]', - :value => 'Agent', + css: '.js-admin input[name="lastname"]', + value: 'Agent', ) set( - :css => '.js-admin input[name="email"]', - :value => 'master@example.com', + css: '.js-admin input[name="email"]', + value: 'master@example.com', ) set( - :css => '.js-admin input[name="firstname"]', - :value => 'Test Master', + css: '.js-admin input[name="firstname"]', + value: 'Test Master', ) set( - :css => '.js-admin input[name="password"]', - :value => 'test1234äöüß', + css: '.js-admin input[name="password"]', + value: 'test1234äöüß', ) set( - :css => '.js-admin input[name="password_confirm"]', - :value => 'test1234äöüß', + css: '.js-admin input[name="password_confirm"]', + value: 'test1234äöüß', ) - click( :css => '.js-admin .btn--success' ) + click( css: '.js-admin .btn--success' ) watch_for( - :css => '.js-base h2', - :value => 'Organization', + css: '.js-base h2', + value: 'Organization', ) # getting started - base match( - :css => '.js-base h2', - :value => 'Organization', + css: '.js-base h2', + value: 'Organization', ) set( - :css => '.js-base input[name="organization"]', - :value => 'Some Organization', + css: '.js-base input[name="organization"]', + value: 'Some Organization', ) set( - :css => '.js-base input[name="url"]', - :value => 'some host', + css: '.js-base input[name="url"]', + value: 'some host', ) click( - :css => '.js-base .btn--primary', + css: '.js-base .btn--primary', ) watch_for( - :css => 'body', - :value => 'A URL looks like', + css: 'body', + value: 'A URL looks like', ) set( - :css => '.js-base input[name="url"]', - :value => 'http://localhost:3333', + css: '.js-base input[name="url"]', + value: 'http://localhost:3333', ) click( - :css => '.js-base .btn--primary', + css: '.js-base .btn--primary', ) watch_for( - :css => 'body', - :value => 'channel', + css: 'body', + value: 'channel', ) location_check( - :url => '#getting_started/channel', + url: '#getting_started/channel', ) # getting started - create email account match( - :css => '.js-channel h2', - :value => 'Connect Channels', + css: '.js-channel h2', + value: 'Connect Channels', ) click( - :css => '.js-channel .email .provider_name', + css: '.js-channel .email .provider_name', ) set( - :css => '.js-intro input[name="realname"]', - :value => 'Some Realname', + css: '.js-intro input[name="realname"]', + value: 'Some Realname', ) set( - :css => '.js-intro input[name="email"]', - :value => mailbox_user, + css: '.js-intro input[name="email"]', + value: mailbox_user, ) set( - :css => '.js-intro input[name="password"]', - :value => mailbox_password, + css: '.js-intro input[name="password"]', + value: mailbox_password, ) click( - :css => '.js-intro .btn--primary', + css: '.js-intro .btn--primary', ) watch_for( - :css => 'body', - :value => 'verify', - :timeout => 20, + css: 'body', + value: 'verify', + timeout: 20, ) watch_for( - :css => 'body', - :value => 'invite', - :timeout => 100, + css: 'body', + value: 'invite', + timeout: 100, ) location_check( - :url => '#getting_started/agents', + url: '#getting_started/agents', ) # invite agent1 match( - :css => 'body', - :value => 'Invite', + css: 'body', + value: 'Invite', ) set( - :css => '.js-agent input[name="firstname"]', - :value => 'Agent 1', + css: '.js-agent input[name="firstname"]', + value: 'Agent 1', ) set( - :css => '.js-agent input[name="lastname"]', - :value => 'Test', + css: '.js-agent input[name="lastname"]', + value: 'Test', ) set( - :css => '.js-agent input[name="email"]', - :value => 'agent1@example.com', + css: '.js-agent input[name="email"]', + value: 'agent1@example.com', ) click( - :css => '.js-agent input[name="group_ids"][value="1"]', + css: '.js-agent input[name="group_ids"][value="1"]', ) click( - :css => '.js-agent .btn--success', + css: '.js-agent .btn--success', ) watch_for( - :css => 'body', - :value => 'Invitation sent', + css: 'body', + value: 'Invitation sent', ) location_check( - :url => '#getting_started/agents', + url: '#getting_started/agents', ) click( - :css => '.js-agent .btn--primary', + css: '.js-agent .btn--primary', ) watch_for( - :css => 'body', - :value => 'My Stats', + css: 'body', + value: 'My Stats', ) location_check( - :url => '#dashboard', + url: '#dashboard', ) end @@ -171,9 +171,9 @@ class AaaGettingStartedTest < TestCase mailbox_user = ENV["MAILBOX_AUTO#{count.to_s}"].split(':')[0] mailbox_password = ENV["MAILBOX_AUTO#{count.to_s}"].split(':')[1] account = { - :realname => 'auto account', - :email => mailbox_user, - :password => mailbox_password, + realname: 'auto account', + email: mailbox_user, + password: mailbox_password, } accounts.push account } @@ -184,44 +184,44 @@ class AaaGettingStartedTest < TestCase end @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) accounts.each {|account| # getting started - auto mail - location( :url => browser_url + '/#getting_started/channel' ) + location( url: browser_url + '/#getting_started/channel' ) click( - :css => '.js-channel .email .provider_name', + css: '.js-channel .email .provider_name', ) set( - :css => '.js-intro input[name="realname"]', - :value => account[:realname], + css: '.js-intro input[name="realname"]', + value: account[:realname], ) set( - :css => '.js-intro input[name="email"]', - :value => account[:email], + css: '.js-intro input[name="email"]', + value: account[:email], ) set( - :css => '.js-intro input[name="password"]', - :value => account[:password], + css: '.js-intro input[name="password"]', + value: account[:password], ) click( - :css => '.js-intro .btn--primary', + css: '.js-intro .btn--primary', ) watch_for( - :css => 'body', - :value => 'verify', - :timeout => 20, + css: 'body', + value: 'verify', + timeout: 20, ) watch_for( - :css => 'body', - :value => 'invite', - :timeout => 100, + css: 'body', + value: 'invite', + timeout: 100, ) location_check( - :url => '#getting_started/agents', + url: '#getting_started/agents', ) } end @@ -236,13 +236,13 @@ class AaaGettingStartedTest < TestCase mailbox_inbound = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[2] mailbox_outbound = ENV["MAILBOX_MANUAL#{count.to_s}"].split(':')[3] account = { - :realname => 'manual account', - :email => mailbox_user, - :password => mailbox_password, - :inbound => { + realname: 'manual account', + email: mailbox_user, + password: mailbox_password, + inbound: { 'options::host' => mailbox_inbound, }, - :outbound => { + outbound: { 'options::host' => mailbox_outbound, }, } @@ -256,75 +256,75 @@ class AaaGettingStartedTest < TestCase @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) accounts.each {|account| # getting started - manual mail - location( :url => browser_url + '/#getting_started/channel' ) + location( url: browser_url + '/#getting_started/channel' ) click( - :css => '.js-channel .email .provider_name', + css: '.js-channel .email .provider_name', ) set( - :css => '.js-intro input[name="realname"]', - :value => account[:realname], + css: '.js-intro input[name="realname"]', + value: account[:realname], ) set( - :css => '.js-intro input[name="email"]', - :value => account[:email], + css: '.js-intro input[name="email"]', + value: account[:email], ) set( - :css => '.js-intro input[name="password"]', - :value => account[:password], + css: '.js-intro input[name="password"]', + value: account[:password], ) click( - :css => '.js-intro .btn--primary', + css: '.js-intro .btn--primary', ) watch_for( - :css => '.js-inbound h2', - :value => 'inbound', - :timeout => 220, + css: '.js-inbound h2', + value: 'inbound', + timeout: 220, ) watch_for( - :css => '.js-inbound', - :value => 'manual', + css: '.js-inbound', + value: 'manual', ) set( - :css => '.js-inbound input[name="options::host"]', - :value => account[:inbound]['options::host'], + css: '.js-inbound input[name="options::host"]', + value: account[:inbound]['options::host'], ) click( - :css => '.js-inbound .btn--primary', + css: '.js-inbound .btn--primary', ) watch_for( - :css => '.js-outbound h2', - :value => 'outbound', + css: '.js-outbound h2', + value: 'outbound', ) select( - :css => '.js-outbound select[name="adapter"]', - :value => 'SMTP - configure your own outgoing SMTP settings', + css: '.js-outbound select[name="adapter"]', + value: 'SMTP - configure your own outgoing SMTP settings', ) set( - :css => '.js-outbound input[name="options::host"]', - :value => account[:outbound]['options::host'], + css: '.js-outbound input[name="options::host"]', + value: account[:outbound]['options::host'], ) click( - :css => '.js-outbound .btn--primary', + css: '.js-outbound .btn--primary', ) watch_for( - :css => 'body', - :value => 'verify', + css: 'body', + value: 'verify', ) watch_for( - :css => 'body', - :value => 'invite', - :timeout => 190, + css: 'body', + value: 'invite', + timeout: 190, ) location_check( - :url => '#getting_started/agents', + url: '#getting_started/agents', ) } end diff --git a/test/browser/aab_unit_test.rb b/test/browser/aab_unit_test.rb index 07d97bdb2..4e915ed6e 100644 --- a/test/browser/aab_unit_test.rb +++ b/test/browser/aab_unit_test.rb @@ -4,73 +4,73 @@ require 'browser_test_helper' class AAbUnitTest < TestCase def test_core @browser = browser_instance - location( :url => browser_url + '/tests-core' ) + location( url: browser_url + '/tests-core' ) sleep 10 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) end def test_ui @browser = browser_instance - location( :url => browser_url + '/tests-ui' ) + location( url: browser_url + '/tests-ui' ) sleep 8 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) - location( :url => browser_url + '/tests-model' ) + location( url: browser_url + '/tests-model' ) sleep 8 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) - location( :url => browser_url + '/tests-model-ui' ) + location( url: browser_url + '/tests-model-ui' ) sleep 8 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) end def test_form @browser = browser_instance - location( :url => browser_url + '/tests-form' ) + location( url: browser_url + '/tests-form' ) sleep 8 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) - location( :url => browser_url + '/tests-form-extended' ) + location( url: browser_url + '/tests-form-extended' ) sleep 8 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) - location( :url => browser_url + '/tests-form-validation' ) + location( url: browser_url + '/tests-form-validation' ) sleep 4 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) end def test_table @browser = browser_instance - location( :url => browser_url + '/tests-table' ) + location( url: browser_url + '/tests-table' ) sleep 4 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) - location( :url => browser_url + '/tests-html-utils' ) + location( url: browser_url + '/tests-html-utils' ) sleep 4 match( - :css => '.result .failed', - :value => '0', + css: '.result .failed', + value: '0', ) end end \ No newline at end of file diff --git a/test/browser/aac_basic_richtext_test.rb b/test/browser/aac_basic_richtext_test.rb index 506832b02..55fecd15f 100644 --- a/test/browser/aac_basic_richtext_test.rb +++ b/test/browser/aac_basic_richtext_test.rb @@ -5,64 +5,64 @@ class AACBasicRichtextTest < TestCase def test_richtext @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) - click( :css => 'a[href="#current_user"]' ) - click( :css => 'a[href="#layout_ref"]' ) - click( :css => 'a[href="#layout_ref/richtext"]' ) - click( :css => 'a[href="#current_user"]' ) + click( css: 'a[href="#current_user"]' ) + click( css: 'a[href="#layout_ref"]' ) + click( css: 'a[href="#layout_ref/richtext"]' ) + click( css: 'a[href="#current_user"]' ) # richtext single line set( - :css => '#content .text-1', - :value => 'some test for browser ', - :slow => true, + css: '#content .text-1', + value: 'some test for browser ', + slow: true, ) sleep 1 - sendkey( :value => :enter ) - sendkey( :value => 'and some other for browser' ) + sendkey( value: :enter ) + sendkey( value: 'and some other for browser' ) sleep 1 match( - :css => '#content .text-1', - :value => 'some test for browser and some other for browser', + css: '#content .text-1', + value: 'some test for browser and some other for browser', ) # text multi line set( - :css => '#content .text-3', - :value => 'some test for browser ', - :slow => true, + css: '#content .text-3', + value: 'some test for browser ', + slow: true, ) sleep 1 - sendkey( :value => :enter ) - sendkey( :value => 'and some other for browser' ) + sendkey( value: :enter ) + sendkey( value: 'and some other for browser' ) sleep 1 match( - :css => '#content .text-3', - :value => "some test for browser\nand some other for browser", - :cleanup => true, + css: '#content .text-3', + value: "some test for browser\nand some other for browser", + cleanup: true, ) # richtext multi line set( - :css => '#content .text-5', - :value => 'some test for browser ', - :slow => true, + css: '#content .text-5', + value: 'some test for browser ', + slow: true, ) sleep 1 - sendkey( :value => :enter ) - sendkey( :value => 'and some other for browser2' ) + sendkey( value: :enter ) + sendkey( value: 'and some other for browser2' ) sleep 1 match( - :css => '#content .text-5', - :value => "some test for browser\nand some other for browser2", - :cleanup => true, + css: '#content .text-5', + value: "some test for browser\nand some other for browser2", + cleanup: true, ) end end \ No newline at end of file diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index 8c3ab3388..d1d92ea19 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -9,75 +9,75 @@ class AgentOrganizationProfileTest < TestCase @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # search and open org organization_open_by_search( - :value => 'Zammad Foundation', + value: 'Zammad Foundation', ) watch_for( - :css => '.active .profile-window', - :value => 'note', + css: '.active .profile-window', + value: 'note', ) watch_for( - :css => '.active .profile-window', - :value => 'member', + css: '.active .profile-window', + value: 'member', ) # update note set( - :css => '.active .profile [data-name="note"]', - :value => note, - :contenteditable => true, + css: '.active .profile [data-name="note"]', + value: note, + contenteditable: true, ) - click( :css => '#global-search' ) + click( css: '#global-search' ) sleep 2 # check and change note again in edit screen - click( :css => '.active .js-action .select-arrow', :fast => true ) - click( :css => '.active .js-action a[data-type="edit"]' ) + click( css: '.active .js-action .select-arrow', fast: true ) + click( css: '.active .js-action a[data-type="edit"]' ) watch_for( - :css => '.active .modal', - :value => 'note', + css: '.active .modal', + value: 'note', ) watch_for( - :css => '.active .modal', - :value => note, + css: '.active .modal', + value: note, ) set( - :css => '.active .modal [data-name="note"]', - :value => 'some note abc', + css: '.active .modal [data-name="note"]', + value: 'some note abc', ) - click( :css => '.active .modal button.js-submit' ) + click( css: '.active .modal button.js-submit' ) watch_for( - :css => '.active .profile-window', - :value => 'some note abc', + css: '.active .profile-window', + value: 'some note abc', ) # create new ticket ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'org profile check ' + message, - :body => 'org profile check ' + message, + data: { + customer: 'nico', + group: 'Users', + title: 'org profile check ' + message, + body: 'org profile check ' + message, }, ) # switch to org tab, verify if ticket is shown organization_open_by_search( - :value => 'Zammad Foundation', + value: 'Zammad Foundation', ) watch_for( - :css => '.active .profile-window', - :value => 'org profile check ' + message, + css: '.active .profile-window', + value: 'org profile check ' + message, ) tasks_close_all() @@ -91,41 +91,41 @@ class AgentOrganizationProfileTest < TestCase browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all( - :browser => browser2, + browser: browser2, ) organization_open_by_search( - :browser => browser1, - :value => 'Zammad Foundation', + browser: browser1, + value: 'Zammad Foundation', ) organization_open_by_search( - :browser => browser2, - :value => 'Zammad Foundation', + browser: browser2, + value: 'Zammad Foundation', ) # update note set( - :browser => browser1, - :css => '.active .profile [data-name="note"]', - :value => message, - :contenteditable => true, + browser: browser1, + css: '.active .profile [data-name="note"]', + value: message, + contenteditable: true, ) click( - :browser => browser1, - :css => '#global-search', + browser: browser1, + css: '#global-search', ) # verify watch_for( - :browser => browser2, - :css => '.active .profile-window', - :value => message, + browser: browser2, + css: '.active .profile-window', + value: message, ) end end \ No newline at end of file diff --git a/test/browser/agent_ticket_actions_level0_test.rb b/test/browser/agent_ticket_actions_level0_test.rb index 5d18800b5..b5e1e22a3 100644 --- a/test/browser/agent_ticket_actions_level0_test.rb +++ b/test/browser/agent_ticket_actions_level0_test.rb @@ -8,51 +8,51 @@ class AgentTicketActionLevel0Test < TestCase @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # create new text modules text_module_create( - :data => { - :name => 'some name' + random, - :keywords => random, - :content => 'some content' + random, + data: { + name: 'some name' + random, + keywords: random, + content: 'some content' + random, }, ) text_module_create( - :data => { - :name => 'some name' + random2, - :keywords => random2, - :content => 'some content' + random2, + data: { + name: 'some name' + random2, + keywords: random2, + content: 'some content' + random2, }, ) # try to use them - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) sleep 2 set( - :css => '.active div[data-name=body]', - :value => 'test ::' + random + css: '.active div[data-name=body]', + value: 'test ::' + random ) watch_for( - :css => '.active .shortcut', - :value => random, + css: '.active .shortcut', + value: random, ) sendkey( - :value => :arrow_down, + value: :arrow_down, ) - click( :css => '.active .shortcut > ul> li > a' ) + click( css: '.active .shortcut > ul> li > a' ) watch_for( - :css => '.active div[data-name=body]', - :value => 'some content' + random, + css: '.active div[data-name=body]', + value: 'some content' + random, ) - tasks_close_all( :discard_changes => true ) + tasks_close_all( discard_changes: true ) @@ -71,220 +71,220 @@ class AgentTicketActionLevel0Test < TestCase browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all( - :browser => browser2, + browser: browser2, ) # create new ticket ticket_create( - :browser => browser2, - :data => { - :title => 'A', + browser: browser2, + data: { + title: 'A', }, - :do_not_submit => true, + do_not_submit: true, ) ticket_create( - :browser => browser2, - :data => { - :title => 'B', + browser: browser2, + data: { + title: 'B', }, - :do_not_submit => true, + do_not_submit: true, ) # create new text module text_module_create( - :browser => browser1, - :data => { - :name => 'some name' + random, - :keywords => random, - :content => 'some content <%= @ticket.customer.lastname %>' + random, + browser: browser1, + data: { + name: 'some name' + random, + keywords: random, + content: 'some content <%= @ticket.customer.lastname %>' + random, }, ) # create user to test placeholder user_create( - :browser => browser1, - :data => { - :login => login, - :firstname => firstname, - :lastname => lastname, - :email => email, - :password => password, + browser: browser1, + data: { + login: login, + firstname: firstname, + lastname: lastname, + email: email, + password: password, }, ) # check if text module exists in instance2, for ready to use set( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'test ::' + random + browser: browser2, + css: '.active div[data-name=body]', + value: 'test ::' + random ) watch_for( - :browser => browser2, - :css => '.active .shortcut', - :value => random, + browser: browser2, + css: '.active .shortcut', + value: random, ) sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.active .shortcut > ul> li > a', + browser: browser2, + css: '.active .shortcut > ul> li > a', ) watch_for( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'some content ' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: 'some content ' + random, ) sleep 2 set( - :browser => browser2, - :css => '.active .newTicket input[name="customer_id_completion"]', - :value => 'nicole', + browser: browser2, + css: '.active .newTicket input[name="customer_id_completion"]', + value: 'nicole', ) sleep 4 sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.active .newTicket .recipientList-entry.js-user.is-active', + browser: browser2, + css: '.active .newTicket .recipientList-entry.js-user.is-active', ) set( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => '::' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: '::' + random, ) sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.active .shortcut > ul> li > a', + browser: browser2, + css: '.active .shortcut > ul> li > a', ) watch_for( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'some content Braun' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: 'some content Braun' + random, ) # verify zoom click( - :browser => browser1, - :css => 'a[href="#manage"]', + browser: browser1, + css: 'a[href="#manage"]', ) # create ticket ticket_create( - :browser => browser2, - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'some subject 123äöü', - :body => 'some body 123äöü', + browser: browser2, + data: { + customer: 'nico', + group: 'Users', + title: 'some subject 123äöü', + body: 'some body 123äöü', }, ) set( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'test', + browser: browser2, + css: '.active div[data-name=body]', + value: 'test', ) set( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => '::' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: '::' + random, ) sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.active .shortcut > ul> li > a', + browser: browser2, + css: '.active .shortcut > ul> li > a', ) watch_for( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'some content Braun' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: 'some content Braun' + random, ) # change customer click( - :browser => browser1, - :css => 'a[href="#manage"]', + browser: browser1, + css: 'a[href="#manage"]', ) click( - :browser => browser2, - :css => '.active div[data-tab="ticket"] .js-actions .select-arrow', + browser: browser2, + css: '.active div[data-tab="ticket"] .js-actions .select-arrow', ) click( - :browser => browser2, - :css => '.active div[data-tab="ticket"] .js-actions a[data-type="customer-change"]', + browser: browser2, + css: '.active div[data-tab="ticket"] .js-actions a[data-type="customer-change"]', ) sleep 1 set( - :browser => browser2, - :css => '.modal [name="customer_id_completion"]', - :value => firstname, + browser: browser2, + css: '.modal [name="customer_id_completion"]', + value: firstname, ) sleep 4 sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.modal .recipientList-entry.js-user.is-active', + browser: browser2, + css: '.modal .recipientList-entry.js-user.is-active', ) click( - :browser => browser2, - :css => '.modal-content .js-submit', + browser: browser2, + css: '.modal-content .js-submit', ) watch_for_disappear( - :browser => browser2, - :css => '.modal', + browser: browser2, + css: '.modal', ) set( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => '::' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: '::' + random, ) sendkey( - :browser => browser2, - :value => :arrow_down, + browser: browser2, + value: :arrow_down, ) click( - :browser => browser2, - :css => '.active .shortcut > ul> li > a', + browser: browser2, + css: '.active .shortcut > ul> li > a', ) watch_for( - :browser => browser2, - :css => '.active div[data-name=body]', - :value => 'some content ' + lastname, + browser: browser2, + css: '.active div[data-name=body]', + value: 'some content ' + lastname, ) end end \ No newline at end of file diff --git a/test/browser/agent_ticket_actions_level1_test.rb b/test/browser/agent_ticket_actions_level1_test.rb index 9d23ea13d..abe0fd62e 100644 --- a/test/browser/agent_ticket_actions_level1_test.rb +++ b/test/browser/agent_ticket_actions_level1_test.rb @@ -7,27 +7,27 @@ class AgentTicketActionLevel1Test < TestCase # merge ticket with closed tab @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # create new ticket ticket1 = ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'some subject 123äöü - with closed tab', - :body => 'some body 123äöü - with closed tab', + data: { + customer: 'nico', + group: 'Users', + title: 'some subject 123äöü - with closed tab', + body: 'some body 123äöü - with closed tab', }, ) sleep 1 # update ticket ticket_update( - :data => { - :body => 'some body 1234 äöüß - with closed tab', + data: { + body: 'some body 1234 äöüß - with closed tab', }, ) @@ -35,59 +35,59 @@ class AgentTicketActionLevel1Test < TestCase # create second ticket to merge ticket2 = ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'test to merge - with closed tab', - :body => 'some body 123äöü 222 - test to merge - with closed tab', + data: { + customer: 'nico', + group: 'Users', + title: 'test to merge - with closed tab', + body: 'some body 123äöü 222 - test to merge - with closed tab', }, ) ticket_update( - :data => { - :body => 'some body 1234 äöüß 333 - with closed tab', + data: { + body: 'some body 1234 äöüß 333 - with closed tab', }, ) # check if task is shown match( - :css => '.tasks', - :value => 'test to merge - with closed tab', + css: '.tasks', + value: 'test to merge - with closed tab', ) # merge tickets - click( :css => '.active div[data-tab="ticket"] .js-actions .select-arrow' ) - click( :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) + click( css: '.active div[data-tab="ticket"] .js-actions .select-arrow' ) + click( css: '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) watch_for( - :css => '.modal', - :value => 'merge', + css: '.modal', + value: 'merge', ) set( - :css => '.modal input[name="master_ticket_number"]', - :value => ticket1[:number], + css: '.modal input[name="master_ticket_number"]', + value: ticket1[:number], ) - click( :css => '.modal button[type="submit"]' ) + click( css: '.modal button[type="submit"]' ) # check if merged to ticket is shown now watch_for( - :css => '.active .page-header .ticket-number', - :value => ticket1[:number], + css: '.active .page-header .ticket-number', + value: ticket1[:number], ) watch_for( - :css => '.active .ticket-article', - :value => 'test to merge - with closed tab', + css: '.active .ticket-article', + value: 'test to merge - with closed tab', ) # check if task is now gone match_not( - :css => '.tasks', - :value => 'test to merge', + css: '.tasks', + value: 'test to merge', ) match( - :css => '.tasks', - :value => 'some subject 123äöü - with closed tab', + css: '.tasks', + value: 'some subject 123äöü - with closed tab', ) # close task/cleanup @@ -97,55 +97,55 @@ class AgentTicketActionLevel1Test < TestCase # merge ticket with open tabs ticket3 = ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'some subject 123äöü - with open tab', - :body => 'some body 123äöü - with open tab', + data: { + customer: 'nico', + group: 'Users', + title: 'some subject 123äöü - with open tab', + body: 'some body 123äöü - with open tab', }, ) ticket4 = ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'test to merge - with open tab', - :body => 'some body 123äöü 222 - test to merge - with open tab', + data: { + customer: 'nico', + group: 'Users', + title: 'test to merge - with open tab', + body: 'some body 123äöü 222 - test to merge - with open tab', }, ) # merge tickets - click( :css => '.active div[data-tab="ticket"] .js-actions .select-arrow' ) - click( :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) + click( css: '.active div[data-tab="ticket"] .js-actions .select-arrow' ) + click( css: '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]' ) watch_for( - :css => '.modal', - :value => 'merge', + css: '.modal', + value: 'merge', ) set( - :css => '.modal input[name="master_ticket_number"]', - :value => ticket3[:number], + css: '.modal input[name="master_ticket_number"]', + value: ticket3[:number], ) - click( :css => '.modal button[type="submit"]' ) + click( css: '.modal button[type="submit"]' ) # check if merged to ticket is shown now watch_for( - :css => '.active .page-header .ticket-number', - :value => ticket3[:number], + css: '.active .page-header .ticket-number', + value: ticket3[:number], ) watch_for( - :css => '.active .ticket-article', - :value => 'test to merge - with open tab', + css: '.active .ticket-article', + value: 'test to merge - with open tab', ) # check if task is now gone match_not( - :css => '.tasks', - :value => 'test to merge', + css: '.tasks', + value: 'test to merge', ) match( - :css => '.tasks', - :value => 'some subject 123äöü - with open tab', + css: '.tasks', + value: 'some subject 123äöü - with open tab', ) end diff --git a/test/browser/agent_ticket_actions_level2_test.rb b/test/browser/agent_ticket_actions_level2_test.rb index 59bc30dd3..7e7ca9359 100644 --- a/test/browser/agent_ticket_actions_level2_test.rb +++ b/test/browser/agent_ticket_actions_level2_test.rb @@ -9,240 +9,240 @@ class AgentTicketActionsLevel2Test < TestCase browser1 = browser_instance login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser1 ) + tasks_close_all( browser: browser1 ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser2 ) + tasks_close_all( browser: browser2 ) # create ticket ticket1 = ticket_create( - :browser => browser1, - :data => { - :group => 'Users', - :customer => 'nicole', - :title => 'some level 2 subject 123äöü', - :body => 'some level 2 body 123äöü', + browser: browser1, + data: { + group: 'Users', + customer: 'nicole', + title: 'some level 2 subject 123äöü', + body: 'some level 2 body 123äöü', } ) # open ticket in second browser ticket_open_by_search( - :browser => browser2, - :number => ticket1[:number], + browser: browser2, + number: ticket1[:number], ) watch_for( - :browser => browser2, - :css => '.active div.ticket-article', - :value => 'some level 2 body 123äöü', + browser: browser2, + css: '.active div.ticket-article', + value: 'some level 2 body 123äöü', ) # set body in edit area in second ticket_update( - :browser => browser2, - :data => { - :body => 'some level 2 body in instance 2', + browser: browser2, + data: { + body: 'some level 2 body in instance 2', }, - :do_not_submit => true, + do_not_submit: true, ) # set body in edit area in first ticket_update( - :browser => browser1, - :data => { - :body => 'some level 2 body in instance 1', + browser: browser1, + data: { + body: 'some level 2 body in instance 1', }, - :do_not_submit => true, + do_not_submit: true, ) # change title in second browser ticket_update( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject 123äöü', + browser: browser2, + data: { + title: 'TTTsome level 2 subject 123äöü', }, - :do_not_submit => true, + do_not_submit: true, ) sleep 2 # verify title in second and first browser verify_title( - :browser => browser2, - :value => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser2, + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser2, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => false, + browser: browser2, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: false, } ) sleep 4 verify_title( - :browser => browser1, - :value => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser1, + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( - :browser => browser1, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser1, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( - :browser => browser1, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => true, + browser: browser1, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: true, } ) # verify text in input body, if still exists ticket_verify( - :browser => browser1, - :data => { - :body => 'some level 2 body in instance 1', + browser: browser1, + data: { + body: 'some level 2 body in instance 1', }, ) ticket_verify( - :browser => browser2, - :data => { - :body => 'some level 2 body in instance 2', + browser: browser2, + data: { + body: 'some level 2 body in instance 2', }, ) # set body in edit area in second ticket_update( - :browser => browser1, - :data => { - :body => 'some update 4711', + browser: browser1, + data: { + body: 'some update 4711', }, ) watch_for( - :browser => browser1, - :css => '.active div.ticket-article', - :value => 'some update 4711', + browser: browser1, + css: '.active div.ticket-article', + value: 'some update 4711', ) verify_task( - :browser => browser1, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => false, + browser: browser1, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: false, } ) # verify if text in input body is now empty ticket_verify( - :browser => browser1, - :data => { - :body => '', + browser: browser1, + data: { + body: '', }, ) # check if body is still in second browser ticket_verify( - :browser => browser2, - :data => { - :body => 'some level 2 body in instance 2', + browser: browser2, + data: { + body: 'some level 2 body in instance 2', }, ) # verify task verify_task( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => true, + browser: browser2, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: true, } ) # reload instances, verify again reload( - :browser => browser1, + browser: browser1, ) reload( - :browser => browser2, + browser: browser2, ) # wait till application become ready sleep 8 verify_title( - :browser => browser2, - :value => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser2, + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser2, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( - :browser => browser2, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => false, # modify was muted at reload ticket tab + browser: browser2, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: false, # modify was muted at reload ticket tab } ) verify_title( - :browser => browser1, - :value => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser1, + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( - :browser => browser1, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', + browser: browser1, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( - :browser => browser1, - :data => { - :title => 'TTTsome level 2 subject<\/b> 123äöü', - :modified => false, + browser: browser1, + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', + modified: false, } ) # verify if update is on ticket in each browser watch_for( - :browser => browser1, - :css => '.active div.ticket-article', - :value => 'some update 4711', + browser: browser1, + css: '.active div.ticket-article', + value: 'some update 4711', ) watch_for( - :browser => browser2, - :css => '.active div.ticket-article', - :value => 'some update 4711', + browser: browser2, + css: '.active div.ticket-article', + value: 'some update 4711', ) # verify if text in input body is now empty ticket_verify( - :browser => browser1, - :data => { - :body => '', + browser: browser1, + data: { + body: '', }, ) # check if body is still in second browser ticket_verify( - :browser => browser2, - :data => { - :body => 'some level 2 body in instance 2', + browser: browser2, + data: { + body: 'some level 2 body in instance 2', }, ) end diff --git a/test/browser/agent_ticket_actions_level3_test.rb b/test/browser/agent_ticket_actions_level3_test.rb index 94af1144a..6320f21fa 100644 --- a/test/browser/agent_ticket_actions_level3_test.rb +++ b/test/browser/agent_ticket_actions_level3_test.rb @@ -6,272 +6,272 @@ class AgentTicketActionsLevel3Test < TestCase browser1 = browser_instance login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser1 ) + tasks_close_all( browser: browser1 ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser2 ) + tasks_close_all( browser: browser2 ) # create ticket ticket1 = ticket_create( - :browser => browser1, - :data => { - :group => 'Users', - :customer => 'nicole', - :title => 'some level 3 subject 123äöü', - :body => 'some level 3 body 123äöü', + browser: browser1, + data: { + group: 'Users', + customer: 'nicole', + title: 'some level 3 subject 123äöü', + body: 'some level 3 body 123äöü', } ) # open ticket in second browser ticket_open_by_search( - :browser => browser2, - :number => ticket1[:number], + browser: browser2, + number: ticket1[:number], ) watch_for( - :browser => browser2, - :css => '.active div.ticket-article', - :value => 'some level 3 body 123äöü', + browser: browser2, + css: '.active div.ticket-article', + value: 'some level 3 body 123äöü', ) # change edit screen in instance 1 ticket_update( - :browser => browser1, - :data => { - :body => 'some level 3 body in instance 1', + browser: browser1, + data: { + body: 'some level 3 body in instance 1', }, - :do_not_submit => true, + do_not_submit: true, ) # update ticket in instance 2 ticket_update( - :browser => browser2, - :data => { - :body => 'some level 3 body in instance 2', + browser: browser2, + data: { + body: 'some level 3 body in instance 2', }, - :do_not_submit => true, + do_not_submit: true, ) click( - :browser => browser2, - :css => '.active button.js-submit', + browser: browser2, + css: '.active button.js-submit', ) # discard changes should gone away watch_for_disappear( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) ticket_verify( - :browser => browser2, - :data => { - :body => '', + browser: browser2, + data: { + body: '', }, ) # check content and edit screen in instance 1 match( - :browser => browser2, - :css => '.active div.ticket-article', - :value => 'some level 3 body in instance 2', + browser: browser2, + css: '.active div.ticket-article', + value: 'some level 3 body in instance 2', ) ticket_verify( - :browser => browser1, - :data => { - :body => 'some level 3 body in instance 1', + browser: browser1, + data: { + body: 'some level 3 body in instance 1', }, ) # update ticket in instance 1 click( - :browser => browser1, - :css => '.active button.js-submit', + browser: browser1, + css: '.active button.js-submit', ) watch_for( - :browser => browser1, - :css => '.active div.ticket-article', - :value => 'some level 3 body in instance 2', + browser: browser1, + css: '.active div.ticket-article', + value: 'some level 3 body in instance 2', ) match_not( - :browser => browser1, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) # check content in instance 2 watch_for( - :browser => browser2, - :css => '.active div.ticket-article', - :value => 'some level 3 body in instance 1', + browser: browser2, + css: '.active div.ticket-article', + value: 'some level 3 body in instance 1', ) # check content and edit screen in instance 1+2 ticket_verify( - :browser => browser1, - :data => { - :body => '', + browser: browser1, + data: { + body: '', }, ) match_not( - :browser => browser1, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) ticket_verify( - :browser => browser2, - :data => { - :body => '', + browser: browser2, + data: { + body: '', }, ) match_not( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) # reload instances, verify again reload( - :browser => browser1, + browser: browser1, ) reload( - :browser => browser2, + browser: browser2, ) # check content and edit screen in instance 1+2 ticket_verify( - :browser => browser1, - :data => { - :body => '', + browser: browser1, + data: { + body: '', }, ) match_not( - :browser => browser1, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) ticket_verify( - :browser => browser2, - :data => { - :body => '', + browser: browser2, + data: { + body: '', }, ) match_not( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) # change form of ticket, reset, reload and verify in instance 2 ticket_update( - :browser => browser2, - :data => { - :body => '22 some level 3 body in instance 2', + browser: browser2, + data: { + body: '22 some level 3 body in instance 2', }, - :do_not_submit => true, + do_not_submit: true, ) watch_for( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) sleep 2 reload( - :browser => browser2, + browser: browser2, ) click( - :css => '.content.active .js-reset', - :browser => browser2, + css: '.content.active .js-reset', + browser: browser2, ) sleep 1 ticket_verify( - :browser => browser2, - :data => { - :body => '', + browser: browser2, + data: { + body: '', }, ) # change form of ticket in instance 2 ticket_update( - :browser => browser2, - :data => { - :body => '22 some level 3 body in instance 2', + browser: browser2, + data: { + body: '22 some level 3 body in instance 2', }, - :do_not_submit => true, + do_not_submit: true, ) watch_for( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) sleep 2 reload( - :browser => browser2, + browser: browser2, ) ticket_verify( - :browser => browser2, - :data => { - :body => '22 some level 3 body in instance 2', + browser: browser2, + data: { + body: '22 some level 3 body in instance 2', }, ) watch_for( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) click( - :browser => browser2, - :css => '.active button.js-submit', + browser: browser2, + css: '.active button.js-submit', ) # discard changes should gone away watch_for_disappear( - :browser => browser2, - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) # check if new article is empty ticket_verify( - :browser => browser2, - :data => { - :body => '', + browser: browser2, + data: { + body: '', }, ) watch_for( - :browser => browser2, - :css => '.active div.ticket-article', - :value => '22 some level 3 body in instance 2', + browser: browser2, + css: '.active div.ticket-article', + value: '22 some level 3 body in instance 2', ) end end \ No newline at end of file diff --git a/test/browser/agent_ticket_actions_level4_test.rb b/test/browser/agent_ticket_actions_level4_test.rb index 4220e5c1d..a82e9df6f 100644 --- a/test/browser/agent_ticket_actions_level4_test.rb +++ b/test/browser/agent_ticket_actions_level4_test.rb @@ -6,40 +6,40 @@ class AgentTicketActionLevel4Test < TestCase @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # create ticket ticket_create( - :data => { - :customer => 'nicole', - :group => 'Users', - :title => 'some subject 4 - 123äöü', - :body => 'some body 4 - 123äöü', + data: { + customer: 'nicole', + group: 'Users', + title: 'some subject 4 - 123äöü', + body: 'some body 4 - 123äöü', }, - :do_not_submit => true, + do_not_submit: true, ) sleep 8 # check if customer is shown in sidebar match( - :css => '.active .sidebar[data-tab="customer"]', - :value => 'nicole', + css: '.active .sidebar[data-tab="customer"]', + value: 'nicole', ) # check task title verify_task( - :data => { - :title => 'some subject 4 - 123äöü', + data: { + title: 'some subject 4 - 123äöü', } ) # check page title verify_title( - :value => 'some subject 4 - 123äöü', + value: 'some subject 4 - 123äöü', ) # reload instances, verify autosave @@ -47,22 +47,22 @@ class AgentTicketActionLevel4Test < TestCase # check if customer is still shown in sidebar watch_for( - :css => '.active .sidebar[data-tab="customer"]', - :value => 'nicole', + css: '.active .sidebar[data-tab="customer"]', + value: 'nicole', ) # finally create ticket - click( :css => '.content.active button.submit' ) + click( css: '.content.active button.submit' ) sleep 5 location_check( - :url => '#ticket/zoom/', + url: '#ticket/zoom/', ) # check ticket match( - :css => '.active div.ticket-article', - :value => 'some body 4 - 123äöü', + css: '.active div.ticket-article', + value: 'some body 4 - 123äöü', ) ticket_id = nil @@ -72,22 +72,22 @@ class AgentTicketActionLevel4Test < TestCase # check task title verify_task( - :data => { - :title => 'some subject 4 - 123äöü', + data: { + title: 'some subject 4 - 123äöü', } ) # check page title verify_title( - :value => 'some subject 4 - 123äöü', + value: 'some subject 4 - 123äöü', ) # check if task is not marked as modified exists( - :css => ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"]", + css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"]", ) exists_not( - :css => ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"] .modified", + css: ".tasks a[href=\"#ticket/zoom/#{ticket_id}\"] .modified", ) # reload @@ -96,25 +96,25 @@ class AgentTicketActionLevel4Test < TestCase # check task title verify_task( - :data => { - :title => 'some subject 4 - 123äöü', + data: { + title: 'some subject 4 - 123äöü', } ) # check page title verify_title( - :value => 'some subject 4 - 123äöü', + value: 'some subject 4 - 123äöü', ) # go to dashboard location( - :url => browser_url + url: browser_url ) sleep 5 # check page title verify_title( - :value => 'Dashboard', + value: 'Dashboard', ) # reload @@ -123,7 +123,7 @@ class AgentTicketActionLevel4Test < TestCase # check page title verify_title( - :value => 'Dashboard', + value: 'Dashboard', ) # cleanup diff --git a/test/browser/agent_ticket_actions_level5_test.rb b/test/browser/agent_ticket_actions_level5_test.rb index 617b016c5..99470aea3 100644 --- a/test/browser/agent_ticket_actions_level5_test.rb +++ b/test/browser/agent_ticket_actions_level5_test.rb @@ -15,9 +15,9 @@ class AgentTicketActionLevel5Test < TestCase @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() @@ -27,41 +27,41 @@ class AgentTicketActionLevel5Test < TestCase # create signatures signature_create( - :data => { - :name => signature_name1, - :body => signature_body1, + data: { + name: signature_name1, + body: signature_body1, }, ) signature_create( - :data => { - :name => signature_name2, - :body => signature_body2, + data: { + name: signature_name2, + body: signature_body2, }, ) # create groups group_create( - :data => { - :name => group_name1, - :signature => signature_name1, - :member => [ + data: { + name: group_name1, + signature: signature_name1, + member: [ 'master@example.com' ], } ) group_create( - :data => { - :name => group_name2, - :signature => signature_name2, - :member => [ + data: { + name: group_name2, + signature: signature_name2, + member: [ 'master@example.com' ], } ) group_create( - :data => { - :name => group_name3, - :member => [ + data: { + name: group_name3, + member: [ 'master@example.com' ], } @@ -76,188 +76,188 @@ class AgentTicketActionLevel5Test < TestCase # create ticket ticket_create( - :data => { - :customer => 'nicole', - :group => 'Users', - :title => 'some subject 5 - 123äöü', - :body => 'some body 5 - 123äöü', + data: { + customer: 'nicole', + group: 'Users', + title: 'some subject 5 - 123äöü', + body: 'some body 5 - 123äöü', }, - :do_not_submit => true, + do_not_submit: true, ) # select group select( - :css => '.active [name="group_id"]', - :value => group_name1, + css: '.active [name="group_id"]', + value: group_name1, ) # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match_not( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # select create channel click( - :css => '.active [data-type="email-out"]', + css: '.active [data-type="email-out"]', ) # group 1 is still selected # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # select group select( - :css => '.active [name="group_id"]', - :value => group_name2, + css: '.active [name="group_id"]', + value: group_name2, ) # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match_not( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # select group select( - :css => '.active [name="group_id"]', - :value => group_name3, + css: '.active [name="group_id"]', + value: group_name3, ) # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match_not( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # select group select( - :css => '.active [name="group_id"]', - :value => group_name1, + css: '.active [name="group_id"]', + value: group_name1, ) # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # select create channel click( - :css => '.active [data-type="phone-out"]', + css: '.active [data-type="phone-out"]', ) # check content match( - :css => '.active [data-name="body"]', - :value => 'some body 5', + css: '.active [data-name="body"]', + value: 'some body 5', ) # check signature match_not( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) # # check signature in zoom ticket # ticket_create( - :data => { - :customer => 'nicole', - :group => group_name1, - :title => 'some subject 5/2 - 123äöü', - :body => 'some body 5/2 - 123äöü', + data: { + customer: 'nicole', + group: group_name1, + title: 'some subject 5/2 - 123äöü', + body: 'some body 5/2 - 123äöü', }, ) # execute reply click( - :css => '.active [data-type="reply"]', + css: '.active [data-type="reply"]', ) # check if signature exists match( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) =begin @@ -282,20 +282,20 @@ class AgentTicketActionLevel5Test < TestCase # discard changes click( - :css => '.active .js-reset', + css: '.active .js-reset', ) sleep 3 # check if signature exists match_not( - :css => '.active [data-name="body"]', - :value => signature_body1, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body1, + no_quote: true, ) match_not( - :css => '.active [data-name="body"]', - :value => signature_body2, - :no_quote => true, + css: '.active [data-name="body"]', + value: signature_body2, + no_quote: true, ) end diff --git a/test/browser/agent_ticket_actions_level6_test.rb b/test/browser/agent_ticket_actions_level6_test.rb index 323161ce3..9cf98d6a6 100644 --- a/test/browser/agent_ticket_actions_level6_test.rb +++ b/test/browser/agent_ticket_actions_level6_test.rb @@ -6,9 +6,9 @@ class AgentTicketActionLevel6Test < TestCase @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() @@ -18,18 +18,18 @@ class AgentTicketActionLevel6Test < TestCase # create new ticket with no attachment, attachment check should pop up ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'test 6 - ticket 1', - :body => 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit', + data: { + customer: 'nico', + group: 'Users', + title: 'test 6 - ticket 1', + body: 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit', }, - :do_not_submit => true, + do_not_submit: true, ) sleep 1 # submit form - click( :css => '.content.active button.submit' ) + click( css: '.content.active button.submit' ) sleep 2 # check warning @@ -42,16 +42,16 @@ class AgentTicketActionLevel6Test < TestCase @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .richtext .attachments')" ) # submit form - click( :css => '.content.active button.submit' ) + click( css: '.content.active button.submit' ) sleep 5 # no warning #alert = @browser.switch_to.alert # check if ticket is shown - location_check( :url => '#ticket/zoom/' ) + location_check( url: '#ticket/zoom/' ) sleep 2 - ticket_number = @browser.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text + ticket_number = @browser.find_elements( { css: '.active .page-header .ticket-number' } )[0].text # # attachment checks - update ticket @@ -59,15 +59,15 @@ class AgentTicketActionLevel6Test < TestCase # update ticket with no attachment, attachment check should pop up ticket_update( - :data => { - :body => 'test 6 - ticket 1-1 - with the word attachment, but not attachment atteched it should give an warning on submit', + data: { + body: 'test 6 - ticket 1-1 - with the word attachment, but not attachment atteched it should give an warning on submit', }, - :do_not_submit => true, + do_not_submit: true, ) # submit form click( - :css => '.active button.js-submit', + css: '.active button.js-submit', ) sleep 2 @@ -80,7 +80,7 @@ class AgentTicketActionLevel6Test < TestCase # submit form click( - :css => '.active button.js-submit', + css: '.active button.js-submit', ) sleep 2 @@ -91,20 +91,20 @@ class AgentTicketActionLevel6Test < TestCase # discard changes should gone away watch_for_disappear( - :css => '.content.active .js-reset', - :value => '(Discard your unsaved changes.|Verwerfen der)', - :no_quote => true, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, ) ticket_verify( - :data => { - :body => '', + data: { + body: '', }, ) # check content and edit screen in instance 1 match( - :css => '.active div.ticket-article', - :value => 'test 6 - ticket 1-1', + css: '.active div.ticket-article', + value: 'test 6 - ticket 1-1', ) @@ -117,45 +117,45 @@ class AgentTicketActionLevel6Test < TestCase browser2 = browser_instance login( - :browser => browser2, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all( - :browser => browser2, + browser: browser2, ) random = 'ticket-actions-6-test-' + rand(999_999).to_s user_email = random + '@example.com' user_create( - :browser => browser2, - :data => { - :firstname => 'Action6 Firstname' + random, - :lastname => 'Action6 Lastname' + random, - :email => user_email, - :password => 'some-pass', + browser: browser2, + data: { + firstname: 'Action6 Firstname' + random, + lastname: 'Action6 Lastname' + random, + email: user_email, + password: 'some-pass', }, ) # update customer, check if new customer is shown in side bar ticket_open_by_search( - :browser => browser2, - :number => ticket_number, + browser: browser2, + number: ticket_number, ) ticket_update( - :browser => browser2, - :data => { - :customer => user_email, + browser: browser2, + data: { + customer: user_email, }, - :do_not_submit => true, + do_not_submit: true, ) # check if customer has changed in second browser - click( :browser => browser1, :css => '.active .tabsSidebar-tab[data-tab="customer"]') + click( browser: browser1, css: '.active .tabsSidebar-tab[data-tab="customer"]') watch_for( - :browser => browser1, - :css => '.active .tabsSidebar', - :value => user_email, + browser: browser1, + css: '.active .tabsSidebar', + value: user_email, ) # @@ -163,18 +163,18 @@ class AgentTicketActionLevel6Test < TestCase # # modify customer - click( :browser => browser1, :css => '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') - click( :browser => browser1, :css => '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') + click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') + click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') sleep 2 - set( :browser => browser1, :css => '.modal [name="address"]', :value => 'some new address' ) - click( :browser => browser1, :css => '.modal .js-submit') + set( browser: browser1, css: '.modal [name="address"]', value: 'some new address' ) + click( browser: browser1, css: '.modal .js-submit') # verify is customer has chnaged other browser too - click( :browser => browser2, :css => '.active .tabsSidebar-tab[data-tab="customer"]') + click( browser: browser2, css: '.active .tabsSidebar-tab[data-tab="customer"]') watch_for( - :browser => browser2, - :css => '.active .sidebar[data-tab="customer"]', - :value => 'some new address', + browser: browser2, + css: '.active .sidebar[data-tab="customer"]', + value: 'some new address', ) # @@ -182,19 +182,19 @@ class AgentTicketActionLevel6Test < TestCase # # change org of customer, check if org is shown in sidebar - click( :browser => browser1, :css => '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') - click( :browser => browser1, :css => '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') + click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') + click( browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') sleep 2 - select( :browser => browser1, :css => '.modal [name="organization_id"]', :value => 'Zammad Foundation' ) - click( :browser => browser1, :css => '.modal .js-submit') + select( browser: browser1, css: '.modal [name="organization_id"]', value: 'Zammad Foundation' ) + click( browser: browser1, css: '.modal .js-submit') # check if org has changed in second browser sleep 3 - click( :browser => browser2, :css => '.active .tabsSidebar-tab[data-tab="organization"]') + click( browser: browser2, css: '.active .tabsSidebar-tab[data-tab="organization"]') watch_for( - :browser => browser2, - :css => '.active .sidebar[data-tab="organization"]', - :value => 'Zammad Foundation', + browser: browser2, + css: '.active .sidebar[data-tab="organization"]', + value: 'Zammad Foundation', ) # diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index 7fe813f18..154828815 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -5,9 +5,9 @@ class AgentTicketOverviewLevel0Test < TestCase def test_I @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() @@ -15,101 +15,101 @@ class AgentTicketOverviewLevel0Test < TestCase # create new ticket ticket1 = ticket_create( - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview count test #1', - :body => 'overview count test #1', + data: { + customer: 'nico*', + group: 'Users', + title: 'overview count test #1', + body: 'overview count test #1', } ) ticket2 = ticket_create( - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview count test #2', - :body => 'overview count test #2', + data: { + customer: 'nico*', + group: 'Users', + title: 'overview count test #2', + body: 'overview count test #2', } ) sleep 6 # till overview is updated - click( :css => '#navigation li.overviews a' ) - click( :css => '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' ) + click( css: '#navigation li.overviews a' ) + click( css: '.content.active .sidebar a[href="#ticket/view/all_unassigned"]' ) sleep 4 # till overview is rendered # select both via bulk action click( - :css => '.active table tr td input[value="' + ticket1[:id] + '"] + .checkbox', - :fast => true, + css: '.active table tr td input[value="' + ticket1[:id] + '"] + .checkbox', + fast: true, ) click( - :css => '.active table tr td input[value="' + ticket2[:id] + '"] + .checkbox', - :fast => true, + css: '.active table tr td input[value="' + ticket2[:id] + '"] + .checkbox', + fast: true, ) exists( - :css => '.active table tr td input[value="' + ticket1[:id] + '"]:checked', + css: '.active table tr td input[value="' + ticket1[:id] + '"]:checked', ) exists( - :css => '.active table tr td input[value="' + ticket2[:id] + '"]:checked', + css: '.active table tr td input[value="' + ticket2[:id] + '"]:checked', ) # select close state & submit select( - :css => '.active .bulkAction [name="state_id"]', - :value => 'closed', + css: '.active .bulkAction [name="state_id"]', + value: 'closed', ) click( - :css => '.active .bulkAction .js-confirm', + css: '.active .bulkAction .js-confirm', ) click( - :css => '.active .bulkAction .js-submit', + css: '.active .bulkAction .js-submit', ) sleep 6 exists_not( - :css => '.active table tr td input[value="' + ticket1[:id] + '"]', + css: '.active table tr td input[value="' + ticket1[:id] + '"]', ) exists_not( - :css => '.active table tr td input[value="' + ticket2[:id] + '"]', + css: '.active table tr td input[value="' + ticket2[:id] + '"]', ) # remember current overview count overview_counter_before = overview_counter() # click options and enable number and article count - click( :css => '.active [data-type="settings"]' ) + click( css: '.active [data-type="settings"]' ) watch_for( - :css => '.modal h1', - :value => 'Edit', + css: '.modal h1', + value: 'Edit', ) check( - :css => '.modal input[value="number"]', + css: '.modal input[value="number"]', ) check( - :css => '.modal input[value="title"]', + css: '.modal input[value="title"]', ) check( - :css => '.modal input[value="customer"]', + css: '.modal input[value="customer"]', ) check( - :css => '.modal input[value="group"]', + css: '.modal input[value="group"]', ) check( - :css => '.modal input[value="created_at"]', + css: '.modal input[value="created_at"]', ) check( - :css => '.modal input[value="article_count"]', + css: '.modal input[value="article_count"]', ) - click( :css => '.modal .js-submit' ) + click( css: '.modal .js-submit' ) sleep 4 # check if number and article count is shown match( - :css => '.active table th:nth-child(3)', - :value => '#', + css: '.active table th:nth-child(3)', + value: '#', ) match( - :css => '.active table th:nth-child(8)', - :value => 'Article#', + css: '.active table th:nth-child(8)', + value: 'Article#', ) # reload browser @@ -118,46 +118,46 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is shown match( - :css => '.active table th:nth-child(3)', - :value => '#', + css: '.active table th:nth-child(3)', + value: '#', ) match( - :css => '.active table th:nth-child(8)', - :value => 'Article#', + css: '.active table th:nth-child(8)', + value: 'Article#', ) # disable number and article count - click( :css => '.active [data-type="settings"]' ) + click( css: '.active [data-type="settings"]' ) watch_for( - :css => '.modal h1', - :value => 'Edit', + css: '.modal h1', + value: 'Edit', ) uncheck( - :css => '.modal input[value="number"]', + css: '.modal input[value="number"]', ) uncheck( - :css => '.modal input[value="article_count"]', + css: '.modal input[value="article_count"]', ) - click( :css => '.modal .js-submit' ) + click( css: '.modal .js-submit' ) sleep 4 # check if number and article count is gone match_not( - :css => '.active table th:nth-child(3)', - :value => '#', + css: '.active table th:nth-child(3)', + value: '#', ) exists_not( - :css => '.active table th:nth-child(8)', + css: '.active table th:nth-child(8)', ) # create new ticket ticket3 = ticket_create( - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview count test #3', - :body => 'overview count test #3', + data: { + customer: 'nico*', + group: 'Users', + title: 'overview count test #3', + body: 'overview count test #3', } ) sleep 8 @@ -168,14 +168,14 @@ class AgentTicketOverviewLevel0Test < TestCase # open ticket by search ticket_open_by_search( - :number => ticket3[:number], + number: ticket3[:number], ) sleep 1 # close ticket ticket_update( - :data => { - :state => 'closed', + data: { + state: 'closed', } ) sleep 8 diff --git a/test/browser/agent_ticket_overview_level1_test.rb b/test/browser/agent_ticket_overview_level1_test.rb index 3b2eb3abd..f3f1df060 100644 --- a/test/browser/agent_ticket_overview_level1_test.rb +++ b/test/browser/agent_ticket_overview_level1_test.rb @@ -7,26 +7,26 @@ class AgentTicketOverviewLevel1Test < TestCase browser1 = browser_instance login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser1 ) + tasks_close_all( browser: browser1 ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) - tasks_close_all( :browser => browser2 ) + tasks_close_all( browser: browser2 ) # create new overview overview = overview_create( - :browser => browser1, - :data => { + browser: browser1, + data: { :name => name, :link => name, :role => 'Agent', @@ -37,124 +37,124 @@ class AgentTicketOverviewLevel1Test < TestCase # create tickets ticket1 = ticket_create( - :browser => browser1, - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview #1', - :body => 'overview #1', + browser: browser1, + data: { + customer: 'nico*', + group: 'Users', + title: 'overview #1', + body: 'overview #1', } ) # keep connection alive click( - :browser => browser2, - :css => '.search-holder', + browser: browser2, + css: '.search-holder', ) ticket2 = ticket_create( - :browser => browser1, - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview #2', - :body => 'overview #2', + browser: browser1, + data: { + customer: 'nico*', + group: 'Users', + title: 'overview #2', + body: 'overview #2', } ) ticket3 = ticket_create( - :browser => browser1, - :data => { - :customer => 'nico*', - :group => 'Users', - :title => 'overview #3', - :body => 'overview #3', + browser: browser1, + data: { + customer: 'nico*', + group: 'Users', + title: 'overview #3', + body: 'overview #3', } ) # click on #1 on overview ticket_open_by_overview( - :browser => browser2, - :number => ticket3[:number], - :link => '#ticket/view/' + name, + browser: browser2, + number: ticket3[:number], + link: '#ticket/view/' + name, ) # use overview navigation to got to #2 & #3 match( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', - :value => '1/', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', + value: '1/', ) match( - :browser => browser2, - :css => '.active .page-header .ticket-number', - :value => ticket3[:number], + browser: browser2, + css: '.active .page-header .ticket-number', + value: ticket3[:number], ) click( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .next', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .next', ) match( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', - :value => '2/', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', + value: '2/', ) match( - :browser => browser2, - :css => '.active .page-header .ticket-number', - :value => ticket2[:number], + browser: browser2, + css: '.active .page-header .ticket-number', + value: ticket2[:number], ) click( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .next', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .next', ) match( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', - :value => '3/', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', + value: '3/', ) match( - :browser => browser2, - :css => '.active .page-header .ticket-number', - :value => ticket1[:number], + browser: browser2, + css: '.active .page-header .ticket-number', + value: ticket1[:number], ) # close ticket sleep 2 # needed to selenium cache issues ticket_update( - :browser => browser2, - :data => { - :state => 'closed', + browser: browser2, + data: { + state: 'closed', } ) sleep 8 match( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', - :value => '3/', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', + value: '3/', ) match( - :browser => browser2, - :css => '.active .page-header .ticket-number', - :value => ticket1[:number], + browser: browser2, + css: '.active .page-header .ticket-number', + value: ticket1[:number], ) click( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .previous', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .previous', ) match( - :browser => browser2, - :css => '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', - :value => '2/', + browser: browser2, + css: '.active .ticketZoom .overview-navigator.horizontal .pagination-counter', + value: '2/', ) match( - :browser => browser2, - :css => '.active .page-header .ticket-number', - :value => ticket2[:number], + browser: browser2, + css: '.active .page-header .ticket-number', + value: ticket2[:number], ) end end \ No newline at end of file diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index 3619b4233..4984a857b 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -10,109 +10,109 @@ class AgentUserManageTest < TestCase @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() sleep 1 # create customer - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) - click( :css => '.active .newTicket [name="customer_id_completion"]' ) - sendkey( :value => :arrow_down ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) + click( css: '.active .newTicket [name="customer_id_completion"]' ) + sendkey( value: :arrow_down ) sleep 1 - click( :css => '.active .newTicket .recipientList-entry.js-user-new' ) + click( css: '.active .newTicket .recipientList-entry.js-user-new' ) sleep 1 set( - :css => '.modal input[name="firstname"]', - :value => firstname, + css: '.modal input[name="firstname"]', + value: firstname, ) set( - :css => '.modal input[name="lastname"]', - :value => lastname, + css: '.modal input[name="lastname"]', + value: lastname, ) set( - :css => '.modal input[name="email"]', - :value => customer_user_email, + css: '.modal input[name="email"]', + value: customer_user_email, ) - click( :css => '.modal button.js-submit' ) + click( css: '.modal button.js-submit' ) sleep 4 # check is used to check selected match( - :css => '.active input[name="customer_id"]', - :value => '^\d+$', - :no_quote => true, + css: '.active input[name="customer_id"]', + value: '^\d+$', + no_quote: true, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => firstname, + css: '.active input[name="customer_id_completion"]', + value: firstname, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => lastname, + css: '.active input[name="customer_id_completion"]', + value: lastname, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => customer_user_email, + css: '.active input[name="customer_id_completion"]', + value: customer_user_email, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => fullname, + css: '.active input[name="customer_id_completion"]', + value: fullname, ) sleep 4 # call new ticket screen again - tasks_close_all( :discard_changes => 1 ) + tasks_close_all( discard_changes: 1 ) - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) sleep 2 match( - :css => '.active input[name="customer_id"]', - :value => '', + css: '.active input[name="customer_id"]', + value: '', ) match( - :css => '.active input[name="customer_id_completion"]', - :value => '', + css: '.active input[name="customer_id_completion"]', + value: '', ) set( - :css => '.active .newTicket input[name="customer_id_completion"]', - :value => customer_user_email, + css: '.active .newTicket input[name="customer_id_completion"]', + value: customer_user_email, ) sleep 3 - sendkey( :value => :arrow_down ) + sendkey( value: :arrow_down ) sleep 1 - click( :css => '.active .newTicket .recipientList-entry.js-user.is-active' ) + click( css: '.active .newTicket .recipientList-entry.js-user.is-active' ) sleep 1 # check is used to check selected match( - :css => '.active input[name="customer_id"]', - :value => '^\d+$', - :no_quote => true, + css: '.active input[name="customer_id"]', + value: '^\d+$', + no_quote: true, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => firstname, + css: '.active input[name="customer_id_completion"]', + value: firstname, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => lastname, + css: '.active input[name="customer_id_completion"]', + value: lastname, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => customer_user_email, + css: '.active input[name="customer_id_completion"]', + value: customer_user_email, ) match( - :css => '.active input[name="customer_id_completion"]', - :value => fullname, + css: '.active input[name="customer_id_completion"]', + value: fullname, ) end diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index f2be1be42..fbe70311c 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -7,73 +7,73 @@ class AgentUserProfileTest < TestCase @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # search and open user - user_open_by_search( :value => 'Braun' ) + user_open_by_search( value: 'Braun' ) watch_for( - :css => '.active .profile-window', - :value => 'note', + css: '.active .profile-window', + value: 'note', ) watch_for( - :css => '.active .profile-window', - :value => 'email', + css: '.active .profile-window', + value: 'email', ) # update note set( - :css => '.active [data-name="note"]', - :value => 'some note 123', - :contenteditable => true, + css: '.active [data-name="note"]', + value: 'some note 123', + contenteditable: true, ) - click( :css => '#global-search' ) + click( css: '#global-search' ) sleep 2 # check and change note again in edit screen - click( :css => '.active .js-action .select-arrow' ) - click( :css => '.active .js-action a[data-type="edit"]' ) + click( css: '.active .js-action .select-arrow' ) + click( css: '.active .js-action a[data-type="edit"]' ) watch_for( - :css => '.active .modal', - :value => 'note', + css: '.active .modal', + value: 'note', ) watch_for( - :css => '.active .modal', - :value => 'some note 123', + css: '.active .modal', + value: 'some note 123', ) set( - :css => '.modal [data-name="note"]', - :value => 'some note abc', + css: '.modal [data-name="note"]', + value: 'some note abc', ) - click( :css => '.active .modal button.js-submit' ) + click( css: '.active .modal button.js-submit' ) watch_for( - :css => '.active .profile-window', - :value => 'some note abc', + css: '.active .profile-window', + value: 'some note abc', ) # create new ticket ticket_create( - :data => { - :customer => 'nico', - :group => 'Users', - :title => 'user profile check ' + message, - :body => 'user profile check ' + message, + data: { + customer: 'nico', + group: 'Users', + title: 'user profile check ' + message, + body: 'user profile check ' + message, }, ) # switch to org tab, verify if ticket is shown - user_open_by_search( :value => 'Braun' ) + user_open_by_search( value: 'Braun' ) watch_for( - :css => '.active .profile-window', - :value => 'user profile check ' + message, + css: '.active .profile-window', + value: 'user profile check ' + message, ) tasks_close_all() @@ -87,40 +87,40 @@ class AgentUserProfileTest < TestCase browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all( - :browser => browser2, + browser: browser2, ) user_open_by_search( - :browser => browser1, - :value => 'Braun', + browser: browser1, + value: 'Braun', ) user_open_by_search( - :browser => browser2, - :value => 'Braun', + browser: browser2, + value: 'Braun', ) # update note set( - :browser => browser1, - :css => '.active [data-name="note"]', - :value => message, - :contenteditable => true, + browser: browser1, + css: '.active [data-name="note"]', + value: message, + contenteditable: true, ) click( - :browser => browser1, - :css => '#global-search', + browser: browser1, + css: '#global-search', ) watch_for( - :browser => browser2, - :css => '.active .profile-window', - :value => message, + browser: browser2, + css: '.active .profile-window', + value: message, ) end diff --git a/test/browser/auth_test.rb b/test/browser/auth_test.rb index d18a9424b..b38f5c6bf 100644 --- a/test/browser/auth_test.rb +++ b/test/browser/auth_test.rb @@ -4,23 +4,23 @@ require 'browser_test_helper' class AuthTest < TestCase def test_authentication @browser = browser_instance - location( :url => browser_url ) + location( url: browser_url ) match( - :css => '#login', - :value => 'username', + css: '#login', + value: 'username', ) - click( :css => '#login button' ) + click( css: '#login button' ) sleep 4 match( - :css => '#login', - :value => 'username', + css: '#login', + value: 'username', ) # login with username/password login( - :username => 'nicole.braun@zammad.org', - :password => 'test', + username: 'nicole.braun@zammad.org', + password: 'test', ) # reload page @@ -28,57 +28,57 @@ class AuthTest < TestCase # check if cookie is temporarily watch_for( - :css => 'body', - :value => 'Overviews', + css: 'body', + value: 'Overviews', ) # verify session cookie cookie( - :name => '^_zammad.+?', - :value => '.+?', - :expires => '', + name: '^_zammad.+?', + value: '.+?', + expires: '', ) end def test_authentication_new_browser_without_permanent_cookie_no_session_should_be @browser = browser_instance - location( :url => browser_url ) + location( url: browser_url ) match( - :css => '#login', - :value => 'username', + css: '#login', + value: 'username', ) end def test_new_browser_with_permanent_cookie_login @browser = browser_instance - location( :url => browser_url ) + location( url: browser_url ) # login with username/password login( - :username => 'nicole.braun@zammad.org', - :password => 'test', - :remember_me => true, + username: 'nicole.braun@zammad.org', + password: 'test', + remember_me: true, ) # check if cookie is temporarily watch_for( - :css => 'body', - :value => 'Overviews', + css: 'body', + value: 'Overviews', ) # verify session cookie cookie( - :name => '^_zammad.+?', - :value => '.+?', - :expires => '\d{4}-\d{1,2}-\d{1,2}.+?', + name: '^_zammad.+?', + value: '.+?', + expires: '\d{4}-\d{1,2}-\d{1,2}.+?', ) logout() # verify session cookie cookie( - :name => '^_zammad.+?', - :should_not_exist => true, + name: '^_zammad.+?', + should_not_exist: true, ) end diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index ffcf2f4ff..24cbaf005 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -7,117 +7,117 @@ class ChatTest < TestCase message = 'message 1äöüß ' + rand(99_999_999_999_999_999).to_s tests = [ { - :name => 'start', - :instance1 => browser_instance, - :instance2 => browser_instance, - :instance1_username => 'master@example.com', - :instance1_password => 'test', - :instance2_username => 'agent1@example.com', - :instance2_password => 'test', - :url => browser_url, - :action => [ + name: 'start', + instance1: browser_instance, + instance2: browser_instance, + instance1_username: 'master@example.com', + instance1_password: 'test', + instance2_username: 'agent1@example.com', + instance2_password: 'test', + url: browser_url, + action: [ { - :where => :instance1, - :execute => 'check', - :css => '#login', - :result => false, + where: :instance1, + execute: 'check', + css: '#login', + result: false, }, { - :where => :instance2, - :execute => 'check', - :css => '#login', - :result => false, + where: :instance2, + execute: 'check', + css: '#login', + result: false, }, { - :execute => 'wait', - :value => 1, + execute: 'wait', + value: 1, }, { - :where => :instance1, - :execute => 'click', - :css => '#chat_toogle', + where: :instance1, + execute: 'click', + css: '#chat_toogle', }, { - :execute => 'wait', - :value => 8, + execute: 'wait', + value: 8, }, { - :where => :instance1, - :execute => 'click', - :css => '#chat_toogle', + where: :instance1, + execute: 'click', + css: '#chat_toogle', }, { - :execute => 'wait', - :value => 4, + execute: 'wait', + value: 4, }, { - :where => :instance2, - :execute => 'click', - :css => '#chat_toogle', + where: :instance2, + execute: 'click', + css: '#chat_toogle', }, { - :where => :instance1, - :execute => 'click', - :css => '#chat_toogle', + where: :instance1, + execute: 'click', + css: '#chat_toogle', }, { - :execute => 'wait', - :value => 2, + execute: 'wait', + value: 2, }, { - :where => :instance1, - :execute => 'set', - :css => 'input[name="chat_message"]', - :value => message, + where: :instance1, + execute: 'set', + css: 'input[name="chat_message"]', + value: message, }, { - :where => :instance1, - :execute => 'send_key', - :css => 'input[name="chat_message"]', - :value => :enter, + where: :instance1, + execute: 'send_key', + css: 'input[name="chat_message"]', + value: :enter, }, { - :execute => 'wait', - :value => 6, + execute: 'wait', + value: 6, }, { - :where => :instance1, - :execute => 'match', - :css => '#chat_log_container', - :value => message, - :match_result => true, + where: :instance1, + execute: 'match', + css: '#chat_log_container', + value: message, + match_result: true, }, { - :where => :instance2, - :execute => 'match', - :css => '#chat_log_container', - :value => message, - :match_result => true, + where: :instance2, + execute: 'match', + css: '#chat_log_container', + value: message, + match_result: true, }, { - :where => :instance1, - :execute => 'navigate', - :to => browser_url, + where: :instance1, + execute: 'navigate', + to: browser_url, }, { - :execute => 'wait', - :value => 8, + execute: 'wait', + value: 8, }, { - :where => :instance1, - :execute => 'click', - :css => '#chat_toogle', + where: :instance1, + execute: 'click', + css: '#chat_toogle', }, { - :execute => 'wait', - :value => 8, + execute: 'wait', + value: 8, }, { - :where => :instance1, - :execute => 'match', - :css => '#chat_log_container', - :value => message, - :match_result => true, + where: :instance1, + execute: 'match', + css: '#chat_log_container', + value: message, + match_result: true, }, ], }, diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index eeb81603f..0cda7eeed 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -5,51 +5,51 @@ class CustomerTicketCreateTest < TestCase def test_customer_ticket_create @browser = browser_instance login( - :username => 'nicole.braun@zammad.org', - :password => 'test', - :url => browser_url, + username: 'nicole.braun@zammad.org', + password: 'test', + url: browser_url, ) # customer ticket create - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#customer_ticket_new"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#customer_ticket_new"]' ) sleep 2 select( - :css => '.newTicket select[name="group_id"]', - :value => 'Users', + css: '.newTicket select[name="group_id"]', + value: 'Users', ) set( - :css => '.newTicket input[name="title"]', - :value => 'some subject 123äöü', + css: '.newTicket input[name="title"]', + value: 'some subject 123äöü', ) set( - :css => '.newTicket [data-name="body"]', - :value => 'some body 123äöü', + css: '.newTicket [data-name="body"]', + value: 'some body 123äöü', ) - click( :css => '.newTicket button.submit' ) + click( css: '.newTicket button.submit' ) sleep 5 # check if ticket is shown - location_check( :url => '#ticket/zoom/' ) + location_check( url: '#ticket/zoom/' ) match( - :css => '.active div.ticket-article', - :value => 'some body 123äöü', - :no_quote => true, + css: '.active div.ticket-article', + value: 'some body 123äöü', + no_quote: true, ) # update ticket set( - :css => '.active [data-name="body"]', - :value => 'some body 1234 äöüß', + css: '.active [data-name="body"]', + value: 'some body 1234 äöüß', ) - click( :css => '.active button.js-submit' ) + click( css: '.active button.js-submit' ) watch_for( - :css => '.active div.ticket-article', - :value => 'some body 1234 äöüß', + css: '.active div.ticket-article', + value: 'some body 1234 äöüß', ) end end \ No newline at end of file diff --git a/test/browser/maintenance_message_test.rb b/test/browser/maintenance_message_test.rb index 9e0a13eab..9dde3c61e 100644 --- a/test/browser/maintenance_message_test.rb +++ b/test/browser/maintenance_message_test.rb @@ -12,163 +12,163 @@ class MaintenanceMessageTest < TestCase # check #1 browser1 = browser_instance login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) click( - :browser => browser1, - :css => 'a[href="#manage"]', + browser: browser1, + css: 'a[href="#manage"]', ) click( - :browser => browser1, - :css => 'a[href="#system/maintenance"]', + browser: browser1, + css: 'a[href="#system/maintenance"]', ) set( - :browser => browser1, - :css => '#content input[name="head"]', - :value => title_html, + browser: browser1, + css: '#content input[name="head"]', + value: title_html, ) set( - :browser => browser1, - :css => '#content textarea[name="message"]', - :value => message_html, + browser: browser1, + css: '#content textarea[name="message"]', + value: message_html, ) click( - :browser => browser1, - :css => '#content button[type="submit"]', + browser: browser1, + css: '#content button[type="submit"]', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => title_text, + browser: browser2, + css: '.modal', + value: title_text, ) watch_for( - :browser => browser2, - :css => '.modal', - :value => message_text, + browser: browser2, + css: '.modal', + value: message_text, ) match_not( - :browser => browser1, - :css => 'body', - :value => message_text, + browser: browser1, + css: 'body', + value: message_text, ) click( - :browser => browser2, - :css => 'div.modal-header .close', + browser: browser2, + css: 'div.modal-header .close', ) # check #2 click( - :browser => browser1, - :css => 'a[href="#manage"]', + browser: browser1, + css: 'a[href="#manage"]', ) click( - :browser => browser1, - :css => 'a[href="#system/maintenance"]', + browser: browser1, + css: 'a[href="#system/maintenance"]', ) set( - :browser => browser1, - :css => '#content input[name="head"]', - :value => title_html + ' #2', + browser: browser1, + css: '#content input[name="head"]', + value: title_html + ' #2', ) set( - :browser => browser1, - :css => '#content textarea[name="message"]', - :value => message_html + ' #2', + browser: browser1, + css: '#content textarea[name="message"]', + value: message_html + ' #2', ) click( - :browser => browser1, - :css => '#content button[type="submit"]', + browser: browser1, + css: '#content button[type="submit"]', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => title_text + ' #2', + browser: browser2, + css: '.modal', + value: title_text + ' #2', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => message_text + ' #2', + browser: browser2, + css: '.modal', + value: message_text + ' #2', ) match_not( - :browser => browser1, - :css => 'body', - :value => message_text, + browser: browser1, + css: 'body', + value: message_text, ) click( - :browser => browser2, - :css => 'div.modal-header .close', + browser: browser2, + css: 'div.modal-header .close', ) # check #3 click( - :browser => browser1, - :css => 'a[href="#manage"]', + browser: browser1, + css: 'a[href="#manage"]', ) click( - :browser => browser1, - :css => 'a[href="#system/maintenance"]', + browser: browser1, + css: 'a[href="#system/maintenance"]', ) set( - :browser => browser1, - :css => '#content input[name="head"]', - :value => title_html + ' #3', + browser: browser1, + css: '#content input[name="head"]', + value: title_html + ' #3', ) set( - :browser => browser1, - :css => '#content textarea[name="message"]', - :value => message_html + ' #3', + browser: browser1, + css: '#content textarea[name="message"]', + value: message_html + ' #3', ) check( - :browser => browser1, - :css => '#content input[name="reload"][value="1"]', + browser: browser1, + css: '#content input[name="reload"][value="1"]', ) click( - :browser => browser1, - :css => '#content button[type="submit"]', + browser: browser1, + css: '#content button[type="submit"]', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => title_text + ' #3', + browser: browser2, + css: '.modal', + value: title_text + ' #3', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => message_text + ' #3', + browser: browser2, + css: '.modal', + value: message_text + ' #3', ) watch_for( - :browser => browser2, - :css => '.modal', - :value => 'Reload application', + browser: browser2, + css: '.modal', + value: 'Reload application', ) match_not( - :browser => browser1, - :css => 'body', - :value => message_text, + browser: browser1, + css: 'body', + value: message_text, ) end end \ No newline at end of file diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index e59ba355f..709159dc3 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -9,97 +9,97 @@ class ManageTest < TestCase # user management @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) - click( :css => 'a[href="#manage"]' ) - click( :css => 'a[href="#manage/users"]' ) + click( css: 'a[href="#manage"]' ) + click( css: 'a[href="#manage/users"]' ) user_create( - :data => { - :login => 'some login' + random, - :firstname => 'Manage Firstname' + random, - :lastname => 'Manage Lastname' + random, - :email => user_email, - :password => 'some-pass', + data: { + login: 'some login' + random, + firstname: 'Manage Firstname' + random, + lastname: 'Manage Lastname' + random, + email: user_email, + password: 'some-pass', } ) - click( :css => '.table-overview tr:last-child td' ) + click( css: '.table-overview tr:last-child td' ) sleep 2 set( - :css => '.modal input[name="lastname"]', - :value => '2Manage Lastname' + random, + css: '.modal input[name="lastname"]', + value: '2Manage Lastname' + random, ) - click( :css => '.modal button.js-submit' ) + click( css: '.modal button.js-submit' ) watch_for( - :css => 'body', - :value => '2Manage Lastname' + random, + css: 'body', + value: '2Manage Lastname' + random, ) # sla sla_create( - :data => { - :name => 'some sla' + random, - :first_response_time => 61 + data: { + name: 'some sla' + random, + first_response_time: 61 } ) watch_for( - :css => 'body', - :value => random, + css: 'body', + value: random, ) sleep 1 - click( :css => '.table-overview tr:last-child td' ) + click( css: '.table-overview tr:last-child td' ) sleep 1 set( - :css => '.modal input[name=name]', - :value => 'some sla update ' + random, + css: '.modal input[name=name]', + value: 'some sla update ' + random, ) set( - :css => '.modal input[name="first_response_time"]', - :value => 121, + css: '.modal input[name="first_response_time"]', + value: 121, ) - click( :css => '.modal button.js-submit' ) + click( css: '.modal button.js-submit' ) watch_for( - :css => 'body', - :value => 'some sla update ' + random, + css: 'body', + value: 'some sla update ' + random, ) sleep 4 - click( :css => 'a[data-type="destroy"]:last-child' ) + click( css: 'a[data-type="destroy"]:last-child' ) sleep 2 - click( :css => '.modal button.js-submit' ) + click( css: '.modal button.js-submit' ) sleep 4 match_not( - :css => 'body', - :value => 'some sla update ' + random, + css: 'body', + value: 'some sla update ' + random, ) - click( :css => 'a[href="#manage"]' ) - click( :css => 'a[href="#manage/slas"]' ) + click( css: 'a[href="#manage"]' ) + click( css: 'a[href="#manage/slas"]' ) sleep 2 match_not( - :css => 'body', - :value => 'some sla update ' + random, + css: 'body', + value: 'some sla update ' + random, ) reload() sleep 2 - click( :css => 'a[href="#manage"]' ) - click( :css => 'a[href="#manage/slas"]' ) + click( css: 'a[href="#manage"]' ) + click( css: 'a[href="#manage/slas"]' ) sleep 2 match_not( - :css => 'body', - :value => 'some sla update ' + random, + css: 'body', + value: 'some sla update ' + random, ) end end diff --git a/test/browser/prefereces_test.rb b/test/browser/prefereces_test.rb index cc9362038..d04fac3bf 100644 --- a/test/browser/prefereces_test.rb +++ b/test/browser/prefereces_test.rb @@ -5,284 +5,284 @@ class PreferencesTest < TestCase def test_preferences @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # start ticket create ticket_create( - :data => { - :customer => 'nicole', - :group => 'Users', - :title => 'preferences lang check #1', - :body => 'preferences lang check #1', + data: { + customer: 'nicole', + group: 'Users', + title: 'preferences lang check #1', + body: 'preferences lang check #1', }, - :do_not_submit => true, + do_not_submit: true, ) # start ticket zoom ticket = ticket_create( - :data => { - :customer => 'nicole', - :group => 'Users', - :title => 'preferences lang check #2', - :body => 'preferences lang check #2', + data: { + customer: 'nicole', + group: 'Users', + title: 'preferences lang check #2', + body: 'preferences lang check #2', }, ) # start user profile user_open_by_search( - :value => 'Nicole', + value: 'Nicole', ) # start organization profile organization_open_by_search( - :value => 'Zammad Foundation', + value: 'Zammad Foundation', ) - click( :css => 'a[href="#current_user"]' ) - click( :css => 'a[href="#profile"]' ) - click( :css => 'a[href="#profile/language"]' ) + click( css: 'a[href="#current_user"]' ) + click( css: 'a[href="#profile"]' ) + click( css: 'a[href="#profile/language"]' ) select( - :css => '.language_item select[name="locale"]', - :value => 'Deutsch', + css: '.language_item select[name="locale"]', + value: 'Deutsch', ) - click( :css => '.content button[type="submit"]' ) + click( css: '.content button[type="submit"]' ) watch_for( - :css => 'body', - :value => 'Sprache', + css: 'body', + value: 'Sprache', ) # check language in navbar watch_for( - :css => '#navigation', - :value => 'Übersicht' + css: '#navigation', + value: 'Übersicht' ) # check language in dashboard - click( :css => '#navigation a[href="#dashboard"]' ) + click( css: '#navigation a[href="#dashboard"]' ) watch_for( - :css => '.content.active', - :value => 'Meine zugewiesenen' + css: '.content.active', + value: 'Meine zugewiesenen' ) # check language in overview - click( :css => '#navigation a[href="#ticket/view"]' ) + click( css: '#navigation a[href="#ticket/view"]' ) watch_for( - :css => '.content.active', - :value => 'Meine' + css: '.content.active', + value: 'Meine' ) verify_title( - :value => 'Meine zugewiesenen', + value: 'Meine zugewiesenen', ) # check language in ticket create open_task( - :data => { - :title => 'Anruf', + data: { + title: 'Anruf', } ) verify_task( - :data => { - :title => 'Anruf', + data: { + title: 'Anruf', } ) open_task( - :data => { - :title => 'preferences lang check #1', + data: { + title: 'preferences lang check #1', } ) watch_for( - :css => '.content.active', - :value => 'kunde' + css: '.content.active', + value: 'kunde' ) watch_for( - :css => '.content.active', - :value => 'priorität' + css: '.content.active', + value: 'priorität' ) watch_for( - :css => '.content.active [data-name="body"]', - :value => 'preferences lang check #1' + css: '.content.active [data-name="body"]', + value: 'preferences lang check #1' ) verify_title( - :value => 'anruf', + value: 'anruf', ) # check language in ticket zoom open_task( - :data => { - :title => 'preferences lang check #2', + data: { + title: 'preferences lang check #2', } ) watch_for( - :css => '.content.active', - :value => 'erstellt' + css: '.content.active', + value: 'erstellt' ) watch_for( - :css => '.content.active', - :value => 'priorität' + css: '.content.active', + value: 'priorität' ) # check language in user profile open_task( - :data => { - :title => 'Nicole', + data: { + title: 'Nicole', } ) watch_for( - :css => '.content.active', - :value => 'notiz' + css: '.content.active', + value: 'notiz' ) watch_for( - :css => '.content.active', - :value => 'e-mail' + css: '.content.active', + value: 'e-mail' ) watch_for( - :css => '.content.active', - :value => 'aktion' + css: '.content.active', + value: 'aktion' ) # check language in organization profile open_task( - :data => { - :title => 'Zammad', + data: { + title: 'Zammad', } ) watch_for( - :css => '.content.active', - :value => 'notiz' + css: '.content.active', + value: 'notiz' ) - click( :css => 'a[href="#current_user"]' ) - click( :css => 'a[href="#profile"]' ) - click( :css => 'a[href="#profile/language"]' ) + click( css: 'a[href="#current_user"]' ) + click( css: 'a[href="#profile"]' ) + click( css: 'a[href="#profile/language"]' ) select( - :css => '.language_item select[name="locale"]', - :value => 'English (United States)', + css: '.language_item select[name="locale"]', + value: 'English (United States)', ) - click( :css => '.content button[type="submit"]' ) + click( css: '.content button[type="submit"]' ) sleep 2 watch_for( - :css => 'body', - :value => 'Language', + css: 'body', + value: 'Language', ) # check language in navbar watch_for( - :css => '#navigation', - :value => 'Overview' + css: '#navigation', + value: 'Overview' ) # check language in dashboard - click( :css => '#navigation a[href="#dashboard"]' ) + click( css: '#navigation a[href="#dashboard"]' ) watch_for( - :css => '.content.active', - :value => 'My assig' + css: '.content.active', + value: 'My assig' ) # check language in overview - click( :css => '#navigation a[href="#ticket/view"]' ) + click( css: '#navigation a[href="#ticket/view"]' ) watch_for( - :css => '.content.active', - :value => 'My' + css: '.content.active', + value: 'My' ) verify_title( - :value => 'My assig', + value: 'My assig', ) # check language in ticket create open_task( - :data => { - :title => 'Call', + data: { + title: 'Call', } ) verify_task( - :data => { - :title => 'Call', + data: { + title: 'Call', } ) open_task( - :data => { - :title => 'preferences lang check #1', + data: { + title: 'preferences lang check #1', } ) watch_for( - :css => '.content.active', - :value => 'customer' + css: '.content.active', + value: 'customer' ) watch_for( - :css => '.content.active', - :value => 'priority' + css: '.content.active', + value: 'priority' ) watch_for( - :css => '.content.active [data-name="body"]', - :value => 'preferences lang check #1' + css: '.content.active [data-name="body"]', + value: 'preferences lang check #1' ) verify_title( - :value => 'call', + value: 'call', ) # check language in ticket zoom open_task( - :data => { - :title => 'preferences lang check #2', + data: { + title: 'preferences lang check #2', } ) watch_for( - :css => '.content.active', - :value => 'create' + css: '.content.active', + value: 'create' ) watch_for( - :css => '.content.active', - :value => 'priority' + css: '.content.active', + value: 'priority' ) # check language in user profile open_task( - :data => { - :title => 'Nicole', + data: { + title: 'Nicole', } ) watch_for( - :css => '.content.active', - :value => 'note' + css: '.content.active', + value: 'note' ) watch_for( - :css => '.content.active', - :value => 'email' + css: '.content.active', + value: 'email' ) # check language in organization profile open_task( - :data => { - :title => 'Zammad', + data: { + title: 'Zammad', } ) watch_for( - :css => '.content.active', - :value => 'note' + css: '.content.active', + value: 'note' ) watch_for( - :css => '.content.active', - :value => 'action' + css: '.content.active', + value: 'action' ) # switch to de again - click( :css => 'a[href="#current_user"]' ) - click( :css => 'a[href="#profile"]' ) - click( :css => 'a[href="#profile/language"]' ) + click( css: 'a[href="#current_user"]' ) + click( css: 'a[href="#profile"]' ) + click( css: 'a[href="#profile/language"]' ) sleep 10 select( - :css => '.language_item select[name="locale"]', - :value => 'Deutsch', + css: '.language_item select[name="locale"]', + value: 'Deutsch', ) - click( :css => '.content button[type="submit"]' ) + click( css: '.content button[type="submit"]' ) sleep 4 watch_for( - :css => 'body', - :value => 'Sprache', + css: 'body', + value: 'Sprache', ) sleep 16 @@ -291,28 +291,28 @@ class PreferencesTest < TestCase sleep 4 watch_for( - :css => 'body', - :value => 'Sprache', + css: 'body', + value: 'Sprache', ) # check language in navbar watch_for( - :css => '#navigation', - :value => 'Übersicht' + css: '#navigation', + value: 'Übersicht' ) # check language in dashboard - click( :css => '#navigation a[href="#dashboard"]' ) + click( css: '#navigation a[href="#dashboard"]' ) watch_for( - :css => '.content.active', - :value => 'Meine' + css: '.content.active', + value: 'Meine' ) # check language in overview - click( :css => '#navigation a[href="#ticket/view"]' ) + click( css: '#navigation a[href="#ticket/view"]' ) watch_for( - :css => '.content.active', - :value => 'Meine' + css: '.content.active', + value: 'Meine' ) end end \ No newline at end of file diff --git a/test/browser/setting_test.rb b/test/browser/setting_test.rb index 04280f2d1..ff65d6815 100644 --- a/test/browser/setting_test.rb +++ b/test/browser/setting_test.rb @@ -5,130 +5,130 @@ class SettingTest < TestCase def test_setting @browser = browser_instance login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # make sure, that we have english frontend - click( :css => 'a[href="#current_user"]' ) - click( :css => 'a[href="#profile"]' ) - click( :css => 'a[href="#profile/language"]' ) + click( css: 'a[href="#current_user"]' ) + click( css: 'a[href="#profile"]' ) + click( css: 'a[href="#profile/language"]' ) select( - :css => '.language_item select[name="locale"]', - :value => 'English (United States)', + css: '.language_item select[name="locale"]', + value: 'English (United States)', ) - click( :css => '.content button[type="submit"]' ) + click( css: '.content button[type="submit"]' ) sleep 2 # change settings - click( :css => 'a[href="#manage"]' ) - click( :css => 'a[href="#settings/security"]' ) - click( :css => 'a[href="#third_party_auth"]' ) + click( css: 'a[href="#manage"]' ) + click( css: 'a[href="#settings/security"]' ) + click( css: 'a[href="#third_party_auth"]' ) sleep 2 # set yes select( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'yes', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'yes', ) match( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'yes', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'yes', ) - click( :css => '#auth_facebook button[type=submit]' ) + click( css: '#auth_facebook button[type=submit]' ) watch_for( - :css => '#notify', - :value => 'update successful', + css: '#notify', + value: 'update successful', ) sleep 4 match( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'yes', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'yes', ) match_not( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'no', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'no', ) # set no select( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'no', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'no', ) - click( :css => '#auth_facebook button[type=submit]' ) + click( css: '#auth_facebook button[type=submit]' ) watch_for( - :css => '#notify', - :value => 'update successful', + css: '#notify', + value: 'update successful', ) sleep 4 match( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'no', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'no', ) match_not( - :css => '#auth_facebook select[name="{boolean}auth_facebook"]', - :value => 'yes', + css: '#auth_facebook select[name="{boolean}auth_facebook"]', + value: 'yes', ) # set key and secret set( - :css => '#auth_facebook_credentials input[name=app_id]', - :value => 'id_test1234äöüß', + css: '#auth_facebook_credentials input[name=app_id]', + value: 'id_test1234äöüß', ) set( - :css => '#auth_facebook_credentials input[name=app_secret]', - :value => 'secret_test1234äöüß', + css: '#auth_facebook_credentials input[name=app_secret]', + value: 'secret_test1234äöüß', ) - click( :css => '#auth_facebook_credentials button[type=submit]' ) + click( css: '#auth_facebook_credentials button[type=submit]' ) watch_for( - :css => '#notify', - :value => 'update successful', + css: '#notify', + value: 'update successful', ) sleep 4 match( - :css => '#auth_facebook_credentials input[name=app_id]', - :value => 'id_test1234äöüß', + css: '#auth_facebook_credentials input[name=app_id]', + value: 'id_test1234äöüß', ) match( - :css => '#auth_facebook_credentials input[name=app_secret]', - :value => 'secret_test1234äöüß', + css: '#auth_facebook_credentials input[name=app_secret]', + value: 'secret_test1234äöüß', ) # set key and secret again set( - :css => '#auth_facebook_credentials input[name=app_id]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_id]', + value: '---', ) set( - :css => '#auth_facebook_credentials input[name=app_secret]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_secret]', + value: '---', ) - click( :css => '#auth_facebook_credentials button[type=submit]' ) + click( css: '#auth_facebook_credentials button[type=submit]' ) watch_for( - :css => '#notify', - :value => 'update successful', + css: '#notify', + value: 'update successful', ) sleep 4 match( - :css => '#auth_facebook_credentials input[name=app_id]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_id]', + value: '---', ) match( - :css => '#auth_facebook_credentials input[name=app_secret]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_secret]', + value: '---', ) reload() watch_for( - :css => '#auth_facebook_credentials input[name=app_id]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_id]', + value: '---', ) watch_for( - :css => '#auth_facebook_credentials input[name=app_secret]', - :value => '---', + css: '#auth_facebook_credentials input[name=app_secret]', + value: '---', ) end end \ No newline at end of file diff --git a/test/browser/signup_password_change_and_reset_test.rb b/test/browser/signup_password_change_and_reset_test.rb index 32b192c00..464987482 100644 --- a/test/browser/signup_password_change_and_reset_test.rb +++ b/test/browser/signup_password_change_and_reset_test.rb @@ -5,250 +5,250 @@ class SignupPasswordChangeAndResetTest < TestCase def test_signup signup_user_email = 'signup-test-' + rand(999_999).to_s + '@example.com' @browser = browser_instance - location( :url => browser_url ) - click( :css => 'a[href="#signup"]' ) - exists( :css => '.signup' ) + location( url: browser_url ) + click( css: 'a[href="#signup"]' ) + exists( css: '.signup' ) # signup set( - :css => 'input[name="firstname"]', - :value => 'Signup Firstname', + css: 'input[name="firstname"]', + value: 'Signup Firstname', ) set( - :css => 'input[name="lastname"]', - :value => 'Signup Lastname', + css: 'input[name="lastname"]', + value: 'Signup Lastname', ) set( - :css => 'input[name="email"]', - :value => signup_user_email, + css: 'input[name="email"]', + value: signup_user_email, ) set( - :css => 'input[name="password"]', - :value => 'some-pass', + css: 'input[name="password"]', + value: 'some-pass', ) set( - :css => 'input[name="password_confirm"]', - :value => 'some-pass', + css: 'input[name="password_confirm"]', + value: 'some-pass', ) - click( :css => 'button.submit' ) + click( css: 'button.submit' ) sleep 5 - exists_not( :css => '.signup' ) + exists_not( css: '.signup' ) match( - :css => '.user-menu .user a', - :value => signup_user_email, - :attribute => 'title', + css: '.user-menu .user a', + value: signup_user_email, + attribute: 'title', ) # change password - click( :css => '.navbar-items-personal .user a' ) + click( css: '.navbar-items-personal .user a' ) sleep 1 - click( :css => 'a[href="#profile"]' ) - click( :css => 'a[href="#profile/password"]' ) + click( css: 'a[href="#profile"]' ) + click( css: 'a[href="#profile/password"]' ) set( - :css => 'input[name="password_old"]', - :value => 'nonexisiting', + css: 'input[name="password_old"]', + value: 'nonexisiting', ) set( - :css => 'input[name="password_new"]', - :value => 'some', + css: 'input[name="password_new"]', + value: 'some', ) set( - :css => 'input[name="password_new_confirm"]', - :value => 'some', + css: 'input[name="password_new_confirm"]', + value: 'some', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'current password is wrong', + css: 'body', + value: 'current password is wrong', ) set( - :css => 'input[name="password_old"]', - :value => 'some-pass', + css: 'input[name="password_old"]', + value: 'some-pass', ) set( - :css => 'input[name="password_new_confirm"]', - :value => 'some2', + css: 'input[name="password_new_confirm"]', + value: 'some2', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'passwords do not match', + css: 'body', + value: 'passwords do not match', ) set( - :css => 'input[name="password_new"]', - :value => 'some', + css: 'input[name="password_new"]', + value: 'some', ) set( - :css => 'input[name="password_new_confirm"]', - :value => 'some', + css: 'input[name="password_new_confirm"]', + value: 'some', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'it must be at least', + css: 'body', + value: 'it must be at least', ) set( - :css => 'input[name="password_new"]', - :value => 'some-pass-new', + css: 'input[name="password_new"]', + value: 'some-pass-new', ) set( - :css => 'input[name="password_new_confirm"]', - :value => 'some-pass-new', + css: 'input[name="password_new_confirm"]', + value: 'some-pass-new', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'must contain at least 1 digit', + css: 'body', + value: 'must contain at least 1 digit', ) set( - :css => 'input[name="password_new"]', - :value => 'some-pass-new2', + css: 'input[name="password_new"]', + value: 'some-pass-new2', ) set( - :css => 'input[name="password_new_confirm"]', - :value => 'some-pass-new2', + css: 'input[name="password_new_confirm"]', + value: 'some-pass-new2', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'Password changed successfully', + css: 'body', + value: 'Password changed successfully', ) logout() # check login with new pw login( - :username => signup_user_email, - :password => 'some-pass-new2', + username: signup_user_email, + password: 'some-pass-new2', ) logout() # reset password (not possible) - location( :url => browser_url + '/#password_reset_verify/not_existing_token' ) + location( url: browser_url + '/#password_reset_verify/not_existing_token' ) watch_for( - :css => 'body', - :value => 'Token is invalid', + css: 'body', + value: 'Token is invalid', ) # reset password (with valid session - should not be possible) login( - :username => signup_user_email, - :password => 'some-pass-new2', - :url => browser_url, + username: signup_user_email, + password: 'some-pass-new2', + url: browser_url, ) - location( :url => browser_url + '/#password_reset' ) + location( url: browser_url + '/#password_reset' ) sleep 1 match_not( - :css => 'body', - :value => 'password', + css: 'body', + value: 'password', ) logout() # reset password (correct way) - click( :css => 'a[href="#password_reset"]' ) + click( css: 'a[href="#password_reset"]' ) set( - :css => 'input[name="username"]', - :value => 'nonexisiting', + css: 'input[name="username"]', + value: 'nonexisiting', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'address invalid', + css: 'body', + value: 'address invalid', ) set( - :css => 'input[name="username"]', - :value => signup_user_email, + css: 'input[name="username"]', + value: signup_user_email, ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'sent password reset instructions', + css: 'body', + value: 'sent password reset instructions', ) # redirect to "#password_reset_verify/#{token}" url by app, because of "developer_mode" watch_for( - :css => 'body', - :value => 'Choose your new password', + css: 'body', + value: 'Choose your new password', ) # set new password set( - :css => 'input[name="password"]', - :value => 'some', + css: 'input[name="password"]', + value: 'some', ) set( - :css => 'input[name="password_confirm"]', - :value => 'some2', + css: 'input[name="password_confirm"]', + value: 'some2', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'passwords do not match', + css: 'body', + value: 'passwords do not match', ) set( - :css => 'input[name="password"]', - :value => 'some', + css: 'input[name="password"]', + value: 'some', ) set( - :css => 'input[name="password_confirm"]', - :value => 'some', + css: 'input[name="password_confirm"]', + value: 'some', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'it must be at least', + css: 'body', + value: 'it must be at least', ) set( - :css => 'input[name="password"]', - :value => 'some-pass-new', + css: 'input[name="password"]', + value: 'some-pass-new', ) set( - :css => 'input[name="password_confirm"]', - :value => 'some-pass-new', + css: 'input[name="password_confirm"]', + value: 'some-pass-new', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'must contain at least 1 digit', + css: 'body', + value: 'must contain at least 1 digit', ) set( - :css => 'input[name="password"]', - :value => 'some-pass-new2', + css: 'input[name="password"]', + value: 'some-pass-new2', ) set( - :css => 'input[name="password_confirm"]', - :value => 'some-pass-new2', + css: 'input[name="password_confirm"]', + value: 'some-pass-new2', ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => 'body', - :value => 'Your password has been changed', + css: 'body', + value: 'Your password has been changed', ) # check if user is logged in sleep 5 match( - :css => '.user-menu .user a', - :value => signup_user_email, - :attribute => 'title', + css: '.user-menu .user a', + value: signup_user_email, + attribute: 'title', ) end diff --git a/test/browser/taskbar_session_test.rb b/test/browser/taskbar_session_test.rb index 8c25b7ff4..3be41baaa 100644 --- a/test/browser/taskbar_session_test.rb +++ b/test/browser/taskbar_session_test.rb @@ -7,31 +7,31 @@ class TaskbarSessionTest < TestCase # check taken over session block screen with same user browser1 = browser_instance login( - :browser => browser1, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) sleep 8 match( - :browser => browser1, - :css => 'body', - :value => 'Reload application', + browser: browser1, + css: 'body', + value: 'Reload application', ) match_not( - :browser => browser2, - :css => 'body', - :value => 'Reload application', + browser: browser2, + css: 'body', + value: 'Reload application', ) end @@ -41,31 +41,31 @@ class TaskbarSessionTest < TestCase # check taken over session block screen with same user browser1 = browser_instance login( - :browser => browser1, - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, ) browser2 = browser_instance login( - :browser => browser2, - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) sleep 8 match_not( - :browser => browser1, - :css => 'body', - :value => 'Reload application', + browser: browser1, + css: 'body', + value: 'Reload application', ) match_not( - :browser => browser2, - :css => 'body', - :value => 'Reload application', + browser: browser2, + css: 'body', + value: 'Reload application', ) end diff --git a/test/browser/taskbar_task_test.rb b/test/browser/taskbar_task_test.rb index 866f0b1e4..f851b905d 100644 --- a/test/browser/taskbar_task_test.rb +++ b/test/browser/taskbar_task_test.rb @@ -5,71 +5,71 @@ class TaskbarTaskTest < TestCase def test_persistant_task_a @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() # persistant task - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) set( - :css => '.active .newTicket input[name="title"]', - :value => 'some test AAA', + css: '.active .newTicket input[name="title"]', + value: 'some test AAA', ) sleep 10 end def test_persistant_task_b @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) sleep 3 # check if task still exists - click( :css => '.task' ) + click( css: '.task' ) match( - :css => '.active .newTicket input[name="title"]', - :value => 'some test AAA', + css: '.active .newTicket input[name="title"]', + value: 'some test AAA', ) tasks_close_all() - exists_not( :css => '.active .newTicket input[name="title"]' ) + exists_not( css: '.active .newTicket input[name="title"]' ) end def test_persistant_task_with_relogin @browser = browser_instance login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) tasks_close_all() - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) set( - :css => '.active .newTicket input[name="title"]', - :value => 'INBOUND TEST#1', + css: '.active .newTicket input[name="title"]', + value: 'INBOUND TEST#1', ) set( - :css => '.active .newTicket [data-name="body"]', - :value => 'INBOUND BODY TEST#1', + css: '.active .newTicket [data-name="body"]', + value: 'INBOUND BODY TEST#1', ) - click( :css => 'a[href="#new"]' ) - click( :css => 'a[href="#ticket/create"]' ) + click( css: 'a[href="#new"]' ) + click( css: 'a[href="#ticket/create"]' ) set( - :css => '.active .newTicket input[name="title"]', - :value => 'OUTBOUND TEST#1', + css: '.active .newTicket input[name="title"]', + value: 'OUTBOUND TEST#1', ) set( - :css => '.active .newTicket [data-name="body"]', - :value => 'OUTBOUND BODY TEST#1', + css: '.active .newTicket [data-name="body"]', + value: 'OUTBOUND BODY TEST#1', ) sleep 10 @@ -78,47 +78,47 @@ class TaskbarTaskTest < TestCase # relogin with master - task are not viewable login( - :username => 'master@example.com', - :password => 'test', - :url => browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, ) sleep 3 match_not( - :css => 'body', - :value => 'INBOUND TEST#1', + css: 'body', + value: 'INBOUND TEST#1', ) match_not( - :css => 'body', - :value => 'OUTBOUND TEST#1', + css: 'body', + value: 'OUTBOUND TEST#1', ) logout() sleep 2 match_not( - :css => 'body', - :value => 'INBOUND TEST#1', + css: 'body', + value: 'INBOUND TEST#1', ) match_not( - :css => 'body', - :value => 'OUTBOUND TEST#1', + css: 'body', + value: 'OUTBOUND TEST#1', ) # relogin with agent - task are viewable login( - :username => 'agent1@example.com', - :password => 'test', - :url => browser_url, + username: 'agent1@example.com', + password: 'test', + url: browser_url, ) sleep 3 match( - :css => 'body', - :value => 'INBOUND TEST#1', + css: 'body', + value: 'INBOUND TEST#1', ) match( - :css => 'body', - :value => 'OUTBOUND TEST#1', + css: 'body', + value: 'OUTBOUND TEST#1', ) end end \ No newline at end of file diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 315a84f91..82f792bc8 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -39,8 +39,8 @@ class TestCase < Test::Unit::TestCase end local_browser = Selenium::WebDriver.for( :remote, - :url => ENV['REMOTE_URL'], - :desired_capabilities => caps, + url: ENV['REMOTE_URL'], + desired_capabilities: caps, ) browser_instance_preferences(local_browser) @browsers[local_browser.hash] = local_browser @@ -92,24 +92,24 @@ class TestCase < Test::Unit::TestCase instance.get( params[:url] ) end - element = instance.find_elements( { :css => '#login input[name="username"]' } )[0] + element = instance.find_elements( { css: '#login input[name="username"]' } )[0] if !element raise 'No login box found' end element.clear element.send_keys( params[:username] ) - element = instance.find_elements( { :css => '#login input[name="password"]' } )[0] + element = instance.find_elements( { css: '#login input[name="password"]' } )[0] element.clear element.send_keys( params[:password] ) if params[:remember_me] - instance.find_elements( { :css => '#login [name="remember_me"]' } )[0].click + instance.find_elements( { css: '#login [name="remember_me"]' } )[0].click end - instance.find_elements( { :css => '#login button' } )[0].click + instance.find_elements( { css: '#login button' } )[0].click sleep 4 - login = instance.find_elements( { :css => '.user-menu .user a' } )[0].attribute('title') + login = instance.find_elements( { css: '.user-menu .user a' } )[0].attribute('title') if login != params[:username] raise 'login failed' end @@ -130,12 +130,12 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser - instance.find_elements( { :css => 'a[href="#current_user"]' } )[0].click + instance.find_elements( { css: 'a[href="#current_user"]' } )[0].click sleep 0.1 - instance.find_elements( { :css => 'a[href="#logout"]' } )[0].click + instance.find_elements( { css: 'a[href="#logout"]' } )[0].click (1..6).each {|loop| sleep 1 - login = instance.find_elements( { :css => '#login' } )[0] + login = instance.find_elements( { css: '#login' } )[0] if login assert( true, 'logout ok' ) return @@ -215,9 +215,9 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser if params[:css] - instance.find_elements( { :css => params[:css] } )[0].click + instance.find_elements( { css: params[:css] } )[0].click else - instance.find_elements( { :partial_link_text => params[:text] } )[0].click + instance.find_elements( { partial_link_text: params[:text] } )[0].click end if !params[:fast] sleep 0.4 @@ -237,7 +237,7 @@ class TestCase < Test::Unit::TestCase log('exists', params) instance = params[:browser] || @browser - if !instance.find_elements( { :css => params[:css] } )[0] + if !instance.find_elements( { css: params[:css] } )[0] raise "#{params[:css]} dosn't exist, but should" end true @@ -256,7 +256,7 @@ class TestCase < Test::Unit::TestCase log('exists_not', params) instance = params[:browser] || @browser - if instance.find_elements( { :css => params[:css] } )[0] + if instance.find_elements( { css: params[:css] } )[0] raise "#{params[:css]} exists but should not" end true @@ -281,7 +281,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] #element.click element.clear @@ -301,7 +301,7 @@ class TestCase < Test::Unit::TestCase # it's not working stable via selenium, use js if params[:contenteditable] - value = instance.find_elements( { :css => params[:css] } )[0].text + value = instance.find_elements( { css: params[:css] } )[0].text if value != params[:value] body_quoted = quote( params[:value] ) instance.execute_script( "$('#{params[:css]}').focus().html('#{body_quoted}').trigger('focusout')" ) @@ -327,13 +327,13 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser begin - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by(:text, params[:value]) puts "select - #{params.inspect}" rescue # just try again - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by(:text, params[:value]) puts "select2 - #{params.inspect}" @@ -354,7 +354,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] checked = element.attribute('checked') if !checked element.click @@ -375,7 +375,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] checked = element.attribute('checked') if checked element.click @@ -422,7 +422,7 @@ class TestCase < Test::Unit::TestCase log('match', params) instance = params[:browser] || @browser - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] if params[:css] =~ /select/ dropdown = Selenium::WebDriver::Support::Select.new(element) @@ -618,7 +618,7 @@ class TestCase < Test::Unit::TestCase # verify title if data[:title] - title = instance.find_elements( { :css => '.tasks .active' } )[0].text.strip + title = instance.find_elements( { css: '.tasks .active' } )[0].text.strip if title =~ /#{data[:title]}/i assert( true, "matching '#{data[:title]}' in title '#{title}'" ) else @@ -628,8 +628,8 @@ class TestCase < Test::Unit::TestCase puts "tv #{params.inspect}" # verify modified if data.has_key?(:modified) - exists = instance.find_elements( { :css => '.tasks .active .icon' } )[0] - is_modified = instance.find_elements( { :css => '.tasks .active .icon.modified' } )[0] + exists = instance.find_elements( { css: '.tasks .active .icon' } )[0] + is_modified = instance.find_elements( { css: '.tasks .active .icon.modified' } )[0] puts "m #{data[:modified].inspect}" if exists puts ' ecists' @@ -684,7 +684,7 @@ puts "tv #{params.inspect}" instance = params[:browser] || @browser data = params[:data] - element = instance.find_elements( { :partial_link_text => data[:title] } )[0] + element = instance.find_elements( { partial_link_text: data[:title] } )[0] if !element raise "no task with title '#{data[:title]}' found" end @@ -711,7 +711,7 @@ puts "tv #{params.inspect}" file = File.join(Dir.pwd, filename) #file = 'some test lalal' - element = instance.find_elements( { :css => params[:css] } )[0].send_keys file + element = instance.find_elements( { css: params[:css] } )[0].send_keys file #instance.find_elements( { :css => params[:css] } )[0] #element #@driver.find_element(id: 'file-submit').click @@ -742,7 +742,7 @@ puts "tv #{params.inspect}" loops = (timeout).to_i * 2 text = '' (1..loops).each { |loop| - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] if element #&& element.displayed? begin @@ -802,7 +802,7 @@ wait untill text in selector disabppears loops = (timeout).to_i text = '' (1..loops).each { |loop| - element = instance.find_elements( { :css => params[:css] } )[0] + element = instance.find_elements( { css: params[:css] } )[0] if !element #|| element.displayed? assert( true, 'not found' ) sleep 1 @@ -810,7 +810,7 @@ wait untill text in selector disabppears end if params[:value] begin - text = instance.find_elements( { :css => params[:css] } )[0].text + text = instance.find_elements( { css: params[:css] } )[0].text if text !~ /#{params[:value]}/i assert( true, "not matching '#{params[:value]}' in text '#{text}'" ) sleep 1 @@ -842,11 +842,11 @@ wait untill text in selector disabppears for i in 1..100 sleep 1 begin - if instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] - instance.mouse.move_to( instance.find_elements( { :css => '.navigation .tasks .task:first-child' } )[0] ) + if instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0] + instance.mouse.move_to( instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0] ) sleep 0.2 - click_element = instance.find_elements( { :css => '.navigation .tasks .task:first-child .js-close' } )[0] + click_element = instance.find_elements( { css: '.navigation .tasks .task:first-child .js-close' } )[0] if click_element sleep 0.1 click_element.click @@ -854,7 +854,7 @@ wait untill text in selector disabppears # accept task close warning if params[:discard_changes] sleep 1 - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click end end else @@ -889,46 +889,46 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/overviews"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/overviews"]' } )[0].click sleep 0.2 - instance.find_elements( { :css => '#content a[data-type="new"]' } )[0].click + instance.find_elements( { css: '#content a[data-type="new"]' } )[0].click sleep 2 if data[:name] - element = instance.find_elements( { :css => '.modal input[name=name]' } )[0] + element = instance.find_elements( { css: '.modal input[name=name]' } )[0] element.clear element.send_keys( data[:name] ) end if data[:link] - element = instance.find_elements( { :css => '.modal input[name=link]' } )[0] + element = instance.find_elements( { css: '.modal input[name=link]' } )[0] element.clear element.send_keys( data[:link] ) end if data[:role] - element = instance.find_elements( { :css => '.modal select[name="role_id"]' } )[0] + element = instance.find_elements( { css: '.modal select[name="role_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data[:role]) end if data[:prio] - element = instance.find_elements( { :css => '.modal input[name=prio]' } )[0] + element = instance.find_elements( { css: '.modal input[name=prio]' } )[0] element.clear element.send_keys( data[:prio] ) end if data['order::direction'] - element = instance.find_elements( { :css => '.modal select[name="order::direction"]' } )[0] + element = instance.find_elements( { css: '.modal select[name="order::direction"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data['order::direction']) end - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click (1..12).each {|loop| - element = instance.find_elements( { :css => 'body' } )[0] + element = instance.find_elements( { css: 'body' } )[0] text = element.text if text =~ /#{Regexp.quote(data[:name])}/ assert( true, 'overview created' ) overview = { - :name => name, + name: name, } return overview end @@ -964,26 +964,26 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#new"]' } )[0].click - instance.find_elements( { :css => 'a[href="#ticket/create"]' } )[0].click - element = instance.find_elements( { :css => '.active .newTicket' } )[0] + instance.find_elements( { css: 'a[href="#new"]' } )[0].click + instance.find_elements( { css: 'a[href="#ticket/create"]' } )[0].click + element = instance.find_elements( { css: '.active .newTicket' } )[0] if !element raise 'no ticket create screen found!' end sleep 1 # check count of agents, should be only 1 / - selection on init screen - count = instance.find_elements( { :css => '.active .newTicket select[name="owner_id"] option' } ).count + count = instance.find_elements( { css: '.active .newTicket select[name="owner_id"] option' } ).count assert_equal( 1, count, 'check if owner selection is empty per default' ) if data[:group] - element = instance.find_elements( { :css => '.active .newTicket select[name="group_id"]' } )[0] + element = instance.find_elements( { css: '.active .newTicket select[name="group_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data[:group]) sleep 0.2 end if data[:title] - element = instance.find_elements( { :css => '.active .newTicket input[name="title"]' } )[0] + element = instance.find_elements( { css: '.active .newTicket input[name="title"]' } )[0] element.clear element.send_keys( data[:title] ) sleep 0.2 @@ -991,12 +991,12 @@ wait untill text in selector disabppears if data[:body] #instance.execute_script( '$(".active .newTicket div[data-name=body]").focus()' ) sleep 0.5 - element = instance.find_elements( { :css => '.active .newTicket div[data-name=body]' } )[0] + element = instance.find_elements( { css: '.active .newTicket div[data-name=body]' } )[0] element.clear element.send_keys( data[:body] ) # it's not working stable via selenium, use js - value = instance.find_elements( { :css => '.content .newTicket div[data-name=body]' } )[0].text + value = instance.find_elements( { css: '.content .newTicket div[data-name=body]' } )[0].text #puts "V #{value.inspect}" if value != data[:body] body_quoted = quote( data[:body] ) @@ -1004,7 +1004,7 @@ wait untill text in selector disabppears end end if data[:customer] - element = instance.find_elements( { :css => '.active .newTicket input[name="customer_id_completion"]' } )[0] + element = instance.find_elements( { css: '.active .newTicket input[name="customer_id_completion"]' } )[0] element.click element.clear @@ -1021,15 +1021,15 @@ wait untill text in selector disabppears end element.send_keys( :arrow_down ) sleep 0.3 - instance.find_elements( { :css => '.active .newTicket .recipientList-entry.js-user.is-active' } )[0].click + instance.find_elements( { css: '.active .newTicket .recipientList-entry.js-user.is-active' } )[0].click sleep 0.3 end if data[:attachment] file_upload( - :browser => instance, - :css => '#content .text-1', - :value => 'some text', + browser: instance, + css: '#content .text-1', + value: 'some text', ) end @@ -1039,7 +1039,7 @@ wait untill text in selector disabppears end sleep 0.8 #instance.execute_script( '$(".content.active .newTicket form").submit();' ) - instance.find_elements( { :css => '.active .newTicket button.submit' } )[0].click + instance.find_elements( { css: '.active .newTicket button.submit' } )[0].click sleep 1 (1..8).each {|loop| if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ @@ -1049,12 +1049,12 @@ wait untill text in selector disabppears id.gsub!(//, ) id.gsub!(/^.+?\/(\d+)$/, '\\1') - element = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0] + element = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0] if element number = element.text ticket = { - :id => id, - :number => number, + id: id, + number: number, } sleep 3 # wait until notify is gone return ticket @@ -1117,17 +1117,17 @@ wait untill text in selector disabppears if data[:customer] # select tab - click( :browser => instance, :css => '.active .tabsSidebar-tab[data-tab="customer"]') + click( browser: instance, css: '.active .tabsSidebar-tab[data-tab="customer"]') - click( :browser => instance, :css => '.active div[data-tab="customer"] .js-actions .select-arrow' ) - click( :browser => instance, :css => '.active div[data-tab="customer"] .js-actions a[data-type="customer-change"]' ) + click( browser: instance, css: '.active div[data-tab="customer"] .js-actions .select-arrow' ) + click( browser: instance, css: '.active div[data-tab="customer"] .js-actions a[data-type="customer-change"]' ) watch_for( - :browser => instance, - :css => '.modal', - :value => 'change', + browser: instance, + css: '.modal', + value: 'change', ) - element = instance.find_elements( { :css => '.modal input[name="customer_id_completion"]' } )[0] + element = instance.find_elements( { css: '.modal input[name="customer_id_completion"]' } )[0] element.click element.clear @@ -1144,35 +1144,35 @@ wait untill text in selector disabppears end element.send_keys( :arrow_down ) sleep 0.3 - instance.find_elements( { :css => '.modal .user_autocompletion .recipientList-entry.js-user.is-active' } )[0].click + instance.find_elements( { css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active' } )[0].click sleep 0.3 - click( :browser => instance, :css => '.modal .js-submit' ) + click( browser: instance, css: '.modal .js-submit' ) watch_for_disappear( - :browser => instance, - :css => '.modal', + browser: instance, + css: '.modal', ) watch_for( - :browser => instance, - :css => '.active .tabsSidebar', - :value => data[:customer], + browser: instance, + css: '.active .tabsSidebar', + value: data[:customer], ) # select tab - click( :browser => instance, :css => '.active .tabsSidebar-tab[data-tab="ticket"]') + click( browser: instance, css: '.active .tabsSidebar-tab[data-tab="ticket"]') end if data[:body] #instance.execute_script( '$(".content.active div[data-name=body]").focus()' ) sleep 0.5 - element = instance.find_elements( { :css => '.content.active div[data-name=body]' } )[0] + element = instance.find_elements( { css: '.content.active div[data-name=body]' } )[0] element.clear element.send_keys( data[:body] ) # it's not working stable via selenium, use js - value = instance.find_elements( { :css => '.content.active div[data-name=body]' } )[0].text + value = instance.find_elements( { css: '.content.active div[data-name=body]' } )[0].text puts "V #{value.inspect}" if value != data[:body] body_quoted = quote( data[:body] ) @@ -1182,14 +1182,14 @@ wait untill text in selector disabppears end if data[:group] - element = instance.find_elements( { :css => '.active .sidebar select[name="group_id"]' } )[0] + element = instance.find_elements( { css: '.active .sidebar select[name="group_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data[:group]) sleep 0.2 end if data[:state] - element = instance.find_elements( { :css => '.active .sidebar select[name="state_id"]' } )[0] + element = instance.find_elements( { css: '.active .sidebar select[name="state_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data[:state]) sleep 0.2 @@ -1200,7 +1200,7 @@ wait untill text in selector disabppears (1..5).each {|loop| if !found 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)/ found = true end @@ -1220,11 +1220,11 @@ wait untill text in selector disabppears return true end - instance.find_elements( { :css => '.content.active button.js-submit' } )[0].click + instance.find_elements( { css: '.content.active button.js-submit' } )[0].click (1..10).each {|loop| 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? return true end @@ -1257,7 +1257,7 @@ wait untill text in selector disabppears data = params[:data] if data[:title] - title = instance.find_elements( { :css => '.content.active .page-header .ticket-title-update' } )[0].text.strip + title = instance.find_elements( { css: '.content.active .page-header .ticket-title-update' } )[0].text.strip if title =~ /#{data[:title]}/i assert( true, "matching '#{data[:title]}' in title '#{title}'" ) else @@ -1266,7 +1266,7 @@ wait untill text in selector disabppears end if data[:body] - body = instance.find_elements( { :css => '.content.active [data-name="body"]' } )[0].text.strip + body = instance.find_elements( { css: '.content.active [data-name="body"]' } )[0].text.strip if body =~ /#{data[:body]}/i assert( true, "matching '#{data[:body]}' in body '#{body}'" ) else @@ -1291,13 +1291,13 @@ wait untill text in selector disabppears instance = params[:browser] || @browser - instance.find_elements( { :css => '#navigation li.overviews a' } )[0].click + instance.find_elements( { css: '#navigation li.overviews a' } )[0].click sleep 1 - instance.find_elements( { :css => ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click + instance.find_elements( { css: ".content.active .sidebar a[href=\"#{params[:link]}\"]" } )[0].click sleep 1 - element = instance.find_elements( { :partial_link_text => params[:number] } )[0].click + element = instance.find_elements( { partial_link_text: params[:number] } )[0].click sleep 1 - number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text + number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text if number !~ /#{params[:number]}/ raise "unable to search/find ticket #{params[:number]}!" end @@ -1321,30 +1321,30 @@ wait untill text in selector disabppears instance = params[:browser] || @browser # search by number - element = instance.find_elements( { :css => '#global-search' } )[0] + element = instance.find_elements( { css: '#global-search' } )[0] element.click element.clear element.send_keys( params[:number] ) sleep 3 # empty search box by x - instance.find_elements( { :css => '.search .empty-search' } )[0].click + instance.find_elements( { css: '.search .empty-search' } )[0].click sleep 0.5 - text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value') + text = instance.find_elements( { css: '#global-search' } )[0].attribute('value') if !text raise '#global-search is not empty!' end # search by number again - element = instance.find_elements( { :css => '#global-search' } )[0] + element = instance.find_elements( { css: '#global-search' } )[0] element.click element.clear element.send_keys( params[:number] ) sleep 1 # open ticket - element = instance.find_element( { :partial_link_text => params[:number] } ).click - number = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0].text + element = instance.find_element( { partial_link_text: params[:number] } ).click + number = instance.find_elements( { css: '.active .page-header .ticket-number' } )[0].text if number !~ /#{params[:number]}/ raise "unable to search/find ticket #{params[:number]}!" end @@ -1370,10 +1370,10 @@ wait untill text in selector disabppears instance = params[:browser] || @browser - instance.find_elements( { :css => '#navigation li.overviews a' } )[0].click + instance.find_elements( { css: '#navigation li.overviews a' } )[0].click sleep 2 overviews = {} - instance.find_elements( { :css => '.content.active .sidebar a[href]' } ).each {|element| + instance.find_elements( { css: '.content.active .sidebar a[href]' } ).each {|element| url = element.attribute('href') url.gsub!(/(http|https):\/\/.+?\/(.+?)$/, '\\2') overviews[url] = 0 @@ -1381,7 +1381,7 @@ wait untill text in selector disabppears #puts element.inspect } overviews.each {|url, value| - count = instance.find_elements( { :css => ".content.active .sidebar a[href=\"#{url}\"] .badge" } )[0].text + count = instance.find_elements( { css: ".content.active .sidebar a[href=\"#{url}\"] .badge" } )[0].text overviews[url] = count.to_i } overviews @@ -1401,25 +1401,25 @@ wait untill text in selector disabppears instance = params[:browser] || @browser - element = instance.find_elements( { :css => '#global-search' } )[0] + element = instance.find_elements( { css: '#global-search' } )[0] element.click element.clear element.send_keys( params[:value] ) sleep 3 - instance.find_elements( { :css => '.search .empty-search' } )[0].click + instance.find_elements( { css: '.search .empty-search' } )[0].click sleep 0.5 - text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value') + text = instance.find_elements( { css: '#global-search' } )[0].attribute('value') if !text raise '#global-search is not empty!' end - element = instance.find_elements( { :css => '#global-search' } )[0] + element = instance.find_elements( { css: '#global-search' } )[0] element.click element.clear element.send_keys( params[:value] ) sleep 2 - element = instance.find_element( { :partial_link_text => params[:value] } ).click - name = instance.find_elements( { :css => '.active h1' } )[0].text + element = instance.find_element( { partial_link_text: params[:value] } ).click + name = instance.find_elements( { css: '.active h1' } )[0].text if name !~ /#{params[:value]}/ raise "unable to search/find org #{params[:value]}!" return @@ -1443,13 +1443,13 @@ wait untill text in selector disabppears instance = params[:browser] || @browser - element = instance.find_elements( { :css => '#global-search' } )[0] + element = instance.find_elements( { css: '#global-search' } )[0] element.click element.clear element.send_keys( params[:value] ) sleep 3 - element = instance.find_element( { :partial_link_text => params[:value] } ).click - name = instance.find_elements( { :css => '.active h1' } )[0].text + element = instance.find_element( { partial_link_text: params[:value] } ).click + name = instance.find_elements( { css: '.active h1' } )[0].text if name !~ /#{params[:value]}/ raise "unable to search/find user #{params[:value]}!" end @@ -1479,39 +1479,39 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/users"]' } )[0].click sleep 2 - instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click + instance.find_elements( { css: 'a[data-type="new"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '.modal input[name=firstname]' } )[0] + element = instance.find_elements( { css: '.modal input[name=firstname]' } )[0] element.clear element.send_keys( data[:firstname] ) - element = instance.find_elements( { :css => '.modal input[name=lastname]' } )[0] + element = instance.find_elements( { css: '.modal input[name=lastname]' } )[0] element.clear element.send_keys( data[:lastname] ) - element = instance.find_elements( { :css => '.modal input[name=email]' } )[0] + element = instance.find_elements( { css: '.modal input[name=email]' } )[0] element.clear element.send_keys( data[:email] ) - element = instance.find_elements( { :css => '.modal input[name=password]' } )[0] + element = instance.find_elements( { css: '.modal input[name=password]' } )[0] element.clear element.send_keys( data[:password] ) - element = instance.find_elements( { :css => '.modal input[name=password_confirm]' } )[0] + element = instance.find_elements( { css: '.modal input[name=password_confirm]' } )[0] element.clear element.send_keys( data[:password] ) - instance.find_elements( { :css => '.modal input[name="role_ids"][value="3"]' } )[0].click - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal input[name="role_ids"][value="3"]' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click sleep 2 set( - :browser => instance, - :css => '.content .js-search', - :value => data[:email], + browser: instance, + css: '.content .js-search', + value: data[:email], ) watch_for( - :browser => instance, - :css => 'body', - :value => data[:lastname], + browser: instance, + css: 'body', + value: data[:lastname], ) assert( true, 'user created' ) @@ -1535,20 +1535,20 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/slas"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/slas"]' } )[0].click sleep 2 - instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click + instance.find_elements( { css: 'a[data-type="new"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '.modal input[name=name]' } )[0] + element = instance.find_elements( { css: '.modal input[name=name]' } )[0] element.clear element.send_keys( data[:name] ) - element = instance.find_elements( { :css => '.modal input[name=first_response_time]' } )[0] + element = instance.find_elements( { css: '.modal input[name=first_response_time]' } )[0] element.clear element.send_keys( data[:first_response_time] ) - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click (1..8).each {|loop| - element = instance.find_elements( { :css => 'body' } )[0] + element = instance.find_elements( { css: 'body' } )[0] text = element.text if text =~ /#{Regexp.quote(data[:name])}/ assert( true, 'sla created' ) @@ -1578,23 +1578,23 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/text_modules"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/text_modules"]' } )[0].click sleep 2 - instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click + instance.find_elements( { css: 'a[data-type="new"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '.modal input[name=name]' } )[0] + element = instance.find_elements( { css: '.modal input[name=name]' } )[0] element.clear element.send_keys( data[:name] ) - element = instance.find_elements( { :css => '.modal input[name=keywords]' } )[0] + element = instance.find_elements( { css: '.modal input[name=keywords]' } )[0] element.clear element.send_keys( data[:keywords] ) - element = instance.find_elements( { :css => '.modal textarea[name=content]' } )[0] + element = instance.find_elements( { css: '.modal textarea[name=content]' } )[0] element.clear 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 (1..8).each {|loop| - element = instance.find_elements( { :css => 'body' } )[0] + element = instance.find_elements( { css: 'body' } )[0] text = element.text if text =~ /#{Regexp.quote(data[:name])}/ assert( true, 'text module created' ) @@ -1623,21 +1623,21 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#channels/email"]' } )[0].click - instance.find_elements( { :css => 'a[href="#c-signature"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#channels/email"]' } )[0].click + instance.find_elements( { css: 'a[href="#c-signature"]' } )[0].click sleep 8 - instance.find_elements( { :css => '#content #c-signature a[data-type="new"]' } )[0].click + instance.find_elements( { css: '#content #c-signature a[data-type="new"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '.modal input[name=name]' } )[0] + element = instance.find_elements( { css: '.modal input[name=name]' } )[0] element.clear element.send_keys( data[:name] ) - element = instance.find_elements( { :css => '.modal textarea[name=body]' } )[0] + element = instance.find_elements( { css: '.modal textarea[name=body]' } )[0] element.clear 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 (1..12).each {|loop| - element = instance.find_elements( { :css => 'body' } )[0] + element = instance.find_elements( { css: 'body' } )[0] text = element.text if text =~ /#{Regexp.quote(data[:name])}/ assert( true, 'signature created' ) @@ -1669,26 +1669,26 @@ wait untill text in selector disabppears instance = params[:browser] || @browser data = params[:data] - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/groups"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/groups"]' } )[0].click sleep 2 - instance.find_elements( { :css => 'a[data-type="new"]' } )[0].click + instance.find_elements( { css: 'a[data-type="new"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '.modal input[name=name]' } )[0] + element = instance.find_elements( { css: '.modal input[name=name]' } )[0] element.clear element.send_keys( data[:name] ) - element = instance.find_elements( { :css => '.modal select[name="email_address_id"]' } )[0] + element = instance.find_elements( { css: '.modal select[name="email_address_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :index, 1 ) #dropdown.select_by( :text, action[:group]) if data[:signature] - element = instance.find_elements( { :css => '.modal select[name="signature_id"]' } )[0] + element = instance.find_elements( { css: '.modal select[name="signature_id"]' } )[0] dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, data[:signature]) end - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click (1..12).each {|loop| - element = instance.find_elements( { :css => 'body' } )[0] + element = instance.find_elements( { css: 'body' } )[0] text = element.text if text =~ /#{Regexp.quote(data[:name])}/ assert( true, 'group created' ) @@ -1696,10 +1696,10 @@ wait untill text in selector disabppears # add member if data[:member] data[:member].each {|login| - instance.find_elements( { :css => 'a[href="#manage"]' } )[0].click - instance.find_elements( { :css => 'a[href="#manage/users"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage"]' } )[0].click + instance.find_elements( { css: 'a[href="#manage/users"]' } )[0].click sleep 2 - element = instance.find_elements( { :css => '#content [name="search"]' } )[0] + element = instance.find_elements( { css: '#content [name="search"]' } )[0] element.clear element.send_keys( login ) sleep 2 @@ -1708,7 +1708,7 @@ wait untill text in selector disabppears sleep 2 #instance.find_elements( { :css => 'label:contains(" ' + action[:name] + '")' } )[0].click instance.execute_script( '$(\'label:contains(" ' + data[:name] + '")\').first().click()' ) - instance.find_elements( { :css => '.modal button.js-submit' } )[0].click + instance.find_elements( { css: '.modal button.js-submit' } )[0].click } end end diff --git a/test/integration/auto_wizard_test.rb b/test/integration/auto_wizard_test.rb index 2162565ca..65ef44862 100644 --- a/test/integration/auto_wizard_test.rb +++ b/test/integration/auto_wizard_test.rb @@ -4,21 +4,21 @@ require 'browser_test_helper' class AutoWizardTest < TestCase def test_auto_wizard @browser = browser_instance - location( :url => browser_url ) + location( url: browser_url ) watch_for( - :css => 'body', - :value => 'Invite', - :timeout => 10, + css: 'body', + value: 'Invite', + timeout: 10, ) - click( :css => '.content .btn--primary' ) + click( css: '.content .btn--primary' ) watch_for( - :css => '.user-menu .user a', - :attribute => 'title', - :value => 'hans.atila@zammad.org', - :timeout => 20, + css: '.user-menu .user a', + attribute: 'title', + value: 'hans.atila@zammad.org', + timeout: 20, ) end diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index 5015a8a92..72d0bcb8b 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -26,189 +26,189 @@ class ElasticsearchTest < ActiveSupport::TestCase #Rake::Task["searchindex:create"].execute system('rake searchindex:rebuild') - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent = User.create_or_update( - :login => 'es-agent@example.com', - :firstname => 'E', - :lastname => 'S', - :email => 'es-agent@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_by_id => 1, - :created_by_id => 1, + login: 'es-agent@example.com', + firstname: 'E', + lastname: 'S', + email: 'es-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_by_id: 1, + created_by_id: 1, ) group_without_access = Group.create_if_not_exists( - :name => 'WithoutAccess', - :note => 'Test for not access check.', - :updated_by_id => 1, - :created_by_id => 1 + name: 'WithoutAccess', + note: 'Test for not access check.', + updated_by_id: 1, + created_by_id: 1 ) - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) organization1 = Organization.create_if_not_exists( - :name => 'Customer Organization Update', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Customer Organization Update', + updated_by_id: 1, + created_by_id: 1, ) customer1 = User.create_or_update( - :login => 'es-customer1@example.com', - :firstname => 'ES', - :lastname => 'Customer1', - :email => 'es-customer1@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_by_id => 1, - :created_by_id => 1, + login: 'es-customer1@example.com', + firstname: 'ES', + lastname: 'Customer1', + email: 'es-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) sleep 1 customer2 = User.create_or_update( - :login => 'es-customer2@example.com', - :firstname => 'ES', - :lastname => 'Customer2', - :email => 'es-customer2@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_by_id => 1, - :created_by_id => 1, + login: 'es-customer2@example.com', + firstname: 'ES', + lastname: 'Customer2', + email: 'es-customer2@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) sleep 1 customer3 = User.create_or_update( - :login => 'es-customer3@example.com', - :firstname => 'ES', - :lastname => 'Customer3', - :email => 'es-customer3@example.com', - :password => 'customerpw', - :active => true, - :roles => roles, - :updated_by_id => 1, - :created_by_id => 1, + login: 'es-customer3@example.com', + firstname: 'ES', + lastname: 'Customer3', + email: 'es-customer3@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) # check tickets and search it test 'a - tickets' do ticket1 = Ticket.create( - :title => "some title\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) article1 = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, ) # add attachments which should get index / .txt # "some normal text" Store.add( - :object => 'Ticket::Article', - :o_id => article1.id, - :data => File.open("#{Rails.root.to_s}/test/fixtures/es-normal.txt", 'rb') { |file| file.read }, - :filename => 'es-normal.txt', - :preferences => {}, - :created_by_id => 1, + object: 'Ticket::Article', + o_id: article1.id, + data: File.open("#{Rails.root.to_s}/test/fixtures/es-normal.txt", 'rb') { |file| file.read }, + filename: 'es-normal.txt', + preferences: {}, + created_by_id: 1, ) # add attachments which should get index / .pdf # "Zammad Test77" Store.add( - :object => 'Ticket::Article', - :o_id => article1.id, - :data => File.open("#{Rails.root.to_s}/test/fixtures/es-pdf1.pdf", 'rb') { |file| file.read }, - :filename => 'es-pdf1.pdf', - :preferences => {}, - :created_by_id => 1, + object: 'Ticket::Article', + o_id: article1.id, + data: File.open("#{Rails.root.to_s}/test/fixtures/es-pdf1.pdf", 'rb') { |file| file.read }, + filename: 'es-pdf1.pdf', + preferences: {}, + created_by_id: 1, ) # add attachments which should get index / .box # "Old programmers never die test99" Store.add( - :object => 'Ticket::Article', - :o_id => article1.id, - :data => File.open("#{Rails.root.to_s}/test/fixtures/es-box1.box", 'rb') { |file| file.read }, - :filename => 'mail1.box', - :preferences => {}, - :created_by_id => 1, + object: 'Ticket::Article', + o_id: article1.id, + data: File.open("#{Rails.root.to_s}/test/fixtures/es-box1.box", 'rb') { |file| file.read }, + filename: 'mail1.box', + preferences: {}, + created_by_id: 1, ) # add to big attachment which should not get index # "some too big text88" Store.add( - :object => 'Ticket::Article', - :o_id => article1.id, - :data => File.open("#{Rails.root.to_s}/test/fixtures/es-too-big.txt", 'rb') { |file| file.read }, - :filename => 'es-too-big.txt', - :preferences => {}, - :created_by_id => 1, + object: 'Ticket::Article', + o_id: article1.id, + data: File.open("#{Rails.root.to_s}/test/fixtures/es-too-big.txt", 'rb') { |file| file.read }, + filename: 'es-too-big.txt', + preferences: {}, + created_by_id: 1, ) sleep 1 ticket2 = Ticket.create( - :title => 'something else', - :group => Group.lookup( :name => 'Users'), - :customer_id => customer2.id, - :state => Ticket::State.lookup( :name => 'open' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'something else', + group: Group.lookup( name: 'Users'), + customer_id: customer2.id, + state: Ticket::State.lookup( name: 'open' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) article2 = Ticket::Article.create( - :ticket_id => ticket2.id, - :from => 'some_sender@example.org', - :to => 'some_recipient@example.org', - :subject => 'some subject2 / autobahn what else?', - :message_id => 'some@id', - :body => 'some other message with strong text', - :content_type => 'text/html', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket2.id, + from: 'some_sender@example.org', + to: 'some_recipient@example.org', + subject: 'some subject2 / autobahn what else?', + message_id: 'some@id', + body: 'some other message with strong text', + content_type: 'text/html', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, ) sleep 1 ticket3 = Ticket.create( - :title => 'something else', - :group => Group.lookup( :name => 'WithoutAccess'), - :customer_id => customer3.id, - :state => Ticket::State.lookup( :name => 'open' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'something else', + group: Group.lookup( name: 'WithoutAccess'), + customer_id: customer3.id, + state: Ticket::State.lookup( name: 'open' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) article3 = Ticket::Article.create( - :ticket_id => ticket3.id, - :from => 'some_sender@example.org', - :to => 'some_recipient@example.org', - :subject => 'some subject3', - :message_id => 'some@id', - :body => 'some other message 3 / kindergarden what else?', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket3.id, + from: 'some_sender@example.org', + to: 'some_recipient@example.org', + subject: 'some subject3', + message_id: 'some@id', + body: 'some other message 3 / kindergarden what else?', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, ) # execute background jobs @@ -221,9 +221,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for article data result = Ticket.search( - :current_user => agent, - :query => 'autobahn', - :limit => 15, + current_user: agent, + query: 'autobahn', + limit: 15, ) assert(!result.empty?, 'result exists not') @@ -233,9 +233,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for html content result = Ticket.search( - :current_user => agent, - :query => 'strong', - :limit => 15, + current_user: agent, + query: 'strong', + limit: 15, ) assert(!result.empty?, 'result exists not') @@ -245,17 +245,17 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for indexed attachment result = Ticket.search( - :current_user => agent, - :query => '"some normal text66"', - :limit => 15, + current_user: agent, + query: '"some normal text66"', + limit: 15, ) assert(result[0], 'record 1') assert_equal(result[0].id, ticket1.id) result = Ticket.search( - :current_user => agent, - :query => 'test77', - :limit => 15, + current_user: agent, + query: 'test77', + limit: 15, ) assert(result[0], 'record 1') assert_equal(result[0].id, ticket1.id) @@ -263,25 +263,25 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for not indexed attachment result = Ticket.search( - :current_user => agent, - :query => 'test88', - :limit => 15, + current_user: agent, + query: 'test88', + limit: 15, ) assert(!result[0], 'record 1') result = Ticket.search( - :current_user => agent, - :query => 'test99', - :limit => 15, + current_user: agent, + query: 'test99', + limit: 15, ) assert(!result[0], 'record 1') # search for ticket with no permissions result = Ticket.search( - :current_user => agent, - :query => 'kindergarden', - :limit => 15, + current_user: agent, + query: 'kindergarden', + limit: 15, ) assert(result.empty?, 'result should be empty') assert(!result[0], 'record 1') @@ -289,9 +289,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as customer1 result = Ticket.search( - :current_user => customer1, - :query => 'title OR else', - :limit => 15, + current_user: customer1, + query: 'title OR else', + limit: 15, ) assert(!result.empty?, 'result exists not') @@ -303,9 +303,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as customer2 result = Ticket.search( - :current_user => customer2, - :query => 'title OR else', - :limit => 15, + current_user: customer2, + query: 'title OR else', + limit: 15, ) assert(!result.empty?, 'result exists not') @@ -317,9 +317,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as customer3 result = Ticket.search( - :current_user => customer3, - :query => 'title OR else', - :limit => 15, + current_user: customer3, + query: 'title OR else', + limit: 15, ) assert(!result.empty?, 'result exists not') @@ -333,9 +333,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as agent result = User.search( - :current_user => agent, - :query => 'customer1', - :limit => 15, + current_user: agent, + query: 'customer1', + limit: 15, ) assert(!result.empty?, 'result should not be empty') assert(result[0], 'record 1') @@ -344,9 +344,9 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as customer1 result = User.search( - :current_user => customer1, - :query => 'customer1', - :limit => 15, + current_user: customer1, + query: 'customer1', + limit: 15, ) assert(result.empty?, 'result should be empty') assert(!result[0], 'record 1') diff --git a/test/integration/otrs_import_test.rb b/test/integration/otrs_import_test.rb index 4aef2b75b..f54cc4e6c 100644 --- a/test/integration/otrs_import_test.rb +++ b/test/integration/otrs_import_test.rb @@ -43,9 +43,9 @@ class OtrsImportTest < ActiveSupport::TestCase # check imported users and permission test 'check users' do - role_admin = Role.where( :name => 'Admin' ).first - role_agent = Role.where( :name => 'Agent' ).first - role_customer = Role.where( :name => 'Customer' ).first + role_admin = Role.where( name: 'Admin' ).first + role_agent = Role.where( name: 'Agent' ).first + role_customer = Role.where( name: 'Customer' ).first #role_report = Role.where( :name => 'Report' ).first user1 = User.find(2) @@ -61,8 +61,8 @@ class OtrsImportTest < ActiveSupport::TestCase assert( !user1.roles.include?( role_customer ) ) #assert( !user1.roles.include?( role_report ) ) - group_dasa = Group.where( :name => 'dasa' ).first - group_raw = Group.where( :name => 'Raw' ).first + group_dasa = Group.where( name: 'dasa' ).first + group_raw = Group.where( name: 'Raw' ).first assert( !user1.groups.include?( group_dasa ) ) assert( user1.groups.include?( group_raw ) ) @@ -143,7 +143,7 @@ class OtrsImportTest < ActiveSupport::TestCase # check imported customers and organization relation test 'check customers / organizations' do - user1 = User.where( :login => 'jn' ).first + user1 = User.where( login: 'jn' ).first assert_equal( 'Johannes', user1.firstname ) assert_equal( 'Nickel', user1.lastname ) assert_equal( 'jn', user1.login ) @@ -152,7 +152,7 @@ class OtrsImportTest < ActiveSupport::TestCase assert_equal( 'Znuny GmbH Berlin', organization1.name ) assert_equal( 'äöüß', organization1.note ) - user2 = User.where( :login => 'test90133' ).first + user2 = User.where( login: 'test90133' ).first assert_equal( 'test90133', user2.firstname ) assert_equal( 'test90133', user2.lastname ) assert_equal( 'test90133', user2.login ) diff --git a/test/integration/twitter_test.rb b/test/integration/twitter_test.rb index eea06014b..112da0d52 100644 --- a/test/integration/twitter_test.rb +++ b/test/integration/twitter_test.rb @@ -8,11 +8,11 @@ class TwitterTest < ActiveSupport::TestCase # needed to check correct behavior Group.create_if_not_exists( - :id => 2, - :name => 'Twitter', - :note => 'All Tweets.', - :updated_by_id => 1, - :created_by_id => 1 + id: 2, + name: 'Twitter', + note: 'All Tweets.', + updated_by_id: 1, + created_by_id: 1 ) # app config @@ -28,69 +28,69 @@ class TwitterTest < ActiveSupport::TestCase user2_token_secret = 'T8ph5afeSDjGDA9X1ZBlzEvoSiXfN266ZZUMj5UaY' # add channel - current = Channel.where( :adapter => 'Twitter2' ) + current = Channel.where( adapter: 'Twitter2' ) current.each {|r| r.destroy } Channel.create( - :adapter => 'Twitter2', - :area => 'Twitter::Inbound', - :options => { - :consumer_key => consumer_key, - :consumer_secret => consumer_secret, - :oauth_token => user1_token, - :oauth_token_secret => user1_token_secret, - :search => [ + adapter: 'Twitter2', + area: 'Twitter::Inbound', + options: { + consumer_key: consumer_key, + consumer_secret: consumer_secret, + oauth_token: user1_token, + oauth_token_secret: user1_token_secret, + search: [ { - :item => '#citheo42', - :group => 'Twitter', + item: '#citheo42', + group: 'Twitter', }, { - :item => '#citheo24', - :group => 'Users', + item: '#citheo24', + group: 'Users', }, ], - :mentions => { - :group => 'Twitter', + mentions: { + group: 'Twitter', }, - :direct_messages => { - :group => 'Twitter', + direct_messages: { + group: 'Twitter', } }, - :active => true, - :created_by_id => 1, - :updated_by_id => 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) test 'new outbound and reply' do user = User.find(2) - group = Group.where( :name => 'Twitter' ).first - state = Ticket::State.where( :name => 'new' ).first - priority = Ticket::Priority.where( :name => '2 normal' ).first + group = Group.where( name: 'Twitter' ).first + state = Ticket::State.where( name: 'new' ).first + priority = Ticket::Priority.where( name: '2 normal' ).first hash = '#citheo42' + rand(9999).to_s text = 'Today the weather is really nice... ' + hash ticket = Ticket.create( - :group_id => group.id, - :customer_id => user.id, - :title => text[0,40], - :state_id => state.id, - :priority_id => priority.id, - :updated_by_id => 1, - :created_by_id => 1, + group_id: group.id, + customer_id: user.id, + title: text[0,40], + state_id: state.id, + priority_id: priority.id, + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'outbound ticket created' ) article = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id, - :sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id, - :body => text, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where( name: 'twitter status' ).first.id, + sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id, + body: text, # :from => sender.name, # :to => to, # :message_id => tweet.id, - :internal => false, - :updated_by_id => 1, - :created_by_id => 1, + internal: false, + updated_by_id: 1, + created_by_id: 1, ) assert( article, 'outbound article created' ) assert_equal( article.ticket.articles.count, 1 ) @@ -103,7 +103,7 @@ class TwitterTest < ActiveSupport::TestCase config.access_token = user2_token config.access_token_secret = user2_token_secret end - client.search(hash, :count => 50, :result_type => 'recent').collect do |tweet| + client.search(hash, count: 50, result_type: 'recent').collect do |tweet| assert_equal( tweet.id, article.message_id ) end @@ -112,7 +112,7 @@ class TwitterTest < ActiveSupport::TestCase tweet = client.update( reply_text, { - :in_reply_to_status_id => article.message_id + in_reply_to_status_id: article.message_id } ) @@ -136,19 +136,19 @@ class TwitterTest < ActiveSupport::TestCase config.access_token = user1_token config.access_token_secret = user1_token_secret end - dms = client.direct_messages( :count => 200 ) + dms = client.direct_messages( count: 200 ) dms.each {|dm| client.destroy_direct_message(dm.id) } # direct message to @armin_theo client = Twitter::REST::Client.new( - :consumer_key => consumer_key, - :consumer_secret => consumer_secret, - :access_token => user2_token, - :access_token_secret => user2_token_secret + consumer_key: consumer_key, + consumer_secret: consumer_secret, + access_token: user2_token, + access_token_secret: user2_token_secret ) - dms = client.direct_messages( :count => 200 ) + dms = client.direct_messages( count: 200 ) dms.each {|dm| client.destroy_direct_message(dm.id) } @@ -171,7 +171,7 @@ class TwitterTest < ActiveSupport::TestCase Channel.fetch # check if ticket and article has been created - article = Ticket::Article.where( :message_id => dm.id ).last + article = Ticket::Article.where( message_id: dm.id ).last } puts '----------------------------------------' puts 'DM: ' + dm.inspect @@ -189,15 +189,15 @@ class TwitterTest < ActiveSupport::TestCase # reply via ticket outbound_article = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where( :name => 'twitter direct-message' ).first.id, - :sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id, - :body => text, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where( name: 'twitter direct-message' ).first.id, + sender_id: Ticket::Article::Sender.where( name: 'Agent' ).first.id, + body: text, # :from => sender.name, - :to => 'me_bauer', - :internal => false, - :updated_by_id => 1, - :created_by_id => 1, + to: 'me_bauer', + internal: false, + updated_by_id: 1, + created_by_id: 1, ) assert( outbound_article, 'outbound article created' ) assert_equal( outbound_article.ticket.articles.count, article_count + 1 ) diff --git a/test/integration/user_agent_test.rb b/test/integration/user_agent_test.rb index b12ba55bc..b823e41eb 100644 --- a/test/integration/user_agent_test.rb +++ b/test/integration/user_agent_test.rb @@ -33,7 +33,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test/post/1", { - :submitted => 'some value', + submitted: 'some value', } ) assert(result) @@ -48,7 +48,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test/not_existing", { - :submitted => 'some value', + submitted: 'some value', } ) assert(result) @@ -60,7 +60,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.put( "#{host}/test/put/1", { - :submitted => 'some value', + submitted: 'some value', } ) assert(result) @@ -75,7 +75,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.put( "#{host}/test/not_existing", { - :submitted => 'some value', + submitted: 'some value', } ) assert(result) @@ -112,8 +112,8 @@ class UserAgentTest < ActiveSupport::TestCase "#{host}/test_basic_auth/get/1?submitted=123", {}, { - :user => 'basic_auth_user', - :password => 'test123', + user: 'basic_auth_user', + password: 'test123', } ) assert(result) @@ -129,8 +129,8 @@ class UserAgentTest < ActiveSupport::TestCase "#{host}/test_basic_auth/get/1?submitted=123", {}, { - :user => 'basic_auth_user_not_existing', - :password => 'test<>123', + user: 'basic_auth_user_not_existing', + password: 'test<>123', } ) assert(result) @@ -142,11 +142,11 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test_basic_auth/post/1", { - :submitted => 'some value', + submitted: 'some value', }, { - :user => 'basic_auth_user', - :password => 'test123', + user: 'basic_auth_user', + password: 'test123', } ) assert(result) @@ -161,11 +161,11 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test_basic_auth/post/1", { - :submitted => 'some value', + submitted: 'some value', }, { - :user => 'basic_auth_user_not_existing', - :password => 'test<>123', + user: 'basic_auth_user_not_existing', + password: 'test<>123', } ) assert(result) @@ -177,11 +177,11 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.put( "#{host}/test_basic_auth/put/1", { - :submitted => 'some value', + submitted: 'some value', }, { - :user => 'basic_auth_user', - :password => 'test123', + user: 'basic_auth_user', + password: 'test123', } ) assert(result) @@ -196,11 +196,11 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.put( "#{host}/test_basic_auth/put/1", { - :submitted => 'some value', + submitted: 'some value', }, { - :user => 'basic_auth_user_not_existing', - :password => 'test<>123', + user: 'basic_auth_user_not_existing', + password: 'test<>123', } ) assert(result) @@ -213,8 +213,8 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.delete( "#{host}/test_basic_auth/delete/1", { - :user => 'basic_auth_user', - :password => 'test123', + user: 'basic_auth_user', + password: 'test123', } ) assert(result) @@ -228,8 +228,8 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.delete( "#{host}/test_basic_auth/delete/1", { - :user => 'basic_auth_user_not_existing', - :password => 'test<>123', + user: 'basic_auth_user_not_existing', + password: 'test<>123', } ) assert(result) @@ -258,8 +258,8 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.request( "#{host}/test_basic_auth/redirect", { - :user => 'basic_auth_user', - :password => 'test123', + user: 'basic_auth_user', + password: 'test123', } ) assert(result) @@ -275,8 +275,8 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.request( "#{host}/test_basic_auth/redirect", { - :user => 'basic_auth_user_not_existing', - :password => 'test123', + user: 'basic_auth_user_not_existing', + password: 'test123', } ) assert(result) @@ -393,8 +393,8 @@ class UserAgentTest < ActiveSupport::TestCase "#{host}/test/get/3?submitted=123", {}, { - :open_timeout => 1, - :read_timeout => 1, + open_timeout: 1, + read_timeout: 1, } ) assert(result) @@ -406,11 +406,11 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test/post/3", { - :submitted => 'timeout', + submitted: 'timeout', }, { - :open_timeout => 1, - :read_timeout => 1, + open_timeout: 1, + read_timeout: 1, } ) assert(result) @@ -426,10 +426,10 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.get( "#{host}/test/get/1", { - :submitted => { :key => 'some value ' } + submitted: { key: 'some value ' } }, { - :json => true, + json: true, } ) assert(result) @@ -444,10 +444,10 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.get( "#{host}/test/not_existing", { - :submitted => { :key => 'some value ' } + submitted: { key: 'some value ' } }, { - :json => true, + json: true, } ) assert(result) @@ -460,10 +460,10 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.post( "#{host}/test/post/1", { - :submitted => { :key => 'some value ' } + submitted: { key: 'some value ' } }, { - :json => true, + json: true, } ) assert(result) diff --git a/test/ui_test.rb b/test/ui_test.rb index 6fa5bb4ca..a4efdcb32 100644 --- a/test/ui_test.rb +++ b/test/ui_test.rb @@ -23,25 +23,25 @@ class ExampleTest < Test::Unit::TestCase def test_login_failed browser.get 'http://portal.znuny.com/' - element_username = browser.find_element :name => 'username' + element_username = browser.find_element name: 'username' element_username.send_keys 'roy@kaldung.de' - element_password = browser.find_element :name => 'password' + element_password = browser.find_element name: 'password' element_password.send_keys '123456' element_password.submit - wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds - wait.until { browser.find_element(:id => 'app') } + wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds + wait.until { browser.find_element(id: 'app') } assert_equal browser.current_url, 'https://portal.znuny.com/#login' end def test_login_passed browser.get 'http://portal.znuny.com/' - element_username = browser.find_element :name => 'username' + element_username = browser.find_element name: 'username' element_username.send_keys 'roy@kaldung.com' - element_password = browser.find_element :name => 'password' + element_password = browser.find_element name: 'password' element_password.send_keys '090504' element_password.submit - wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds - wait.until { browser.find_element(:id => 'app') } + wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds + wait.until { browser.find_element(id: 'app') } assert_equal browser.current_url, 'https://portal.znuny.com/#ticket_view/my_tickets' end end diff --git a/test/unit/activity_stream_test.rb b/test/unit/activity_stream_test.rb index 31a6b9e17..510977b62 100644 --- a/test/unit/activity_stream_test.rb +++ b/test/unit/activity_stream_test.rb @@ -2,82 +2,82 @@ require 'test_helper' class ActivityStreamTest < ActiveSupport::TestCase - role = Role.lookup( :name => 'Admin' ) - group = Group.lookup( :name => 'Users' ) + role = Role.lookup( name: 'Admin' ) + group = Group.lookup( name: 'Users' ) admin_user = User.create_or_update( - :login => 'admin', - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'bob@example.com', - :password => 'some_pass', - :active => true, - :role_ids => [role.id], - :group_ids => [group.id], - :updated_by_id => 1, - :created_by_id => 1 + login: 'admin', + firstname: 'Bob', + lastname: 'Smith', + email: 'bob@example.com', + password: 'some_pass', + active: true, + role_ids: [role.id], + group_ids: [group.id], + updated_by_id: 1, + created_by_id: 1 ) - current_user = User.lookup( :login => 'nicole.braun@zammad.org' ) + current_user = User.lookup( login: 'nicole.braun@zammad.org' ) test 'ticket+user' do tests = [ # test 1 { - :create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => current_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 1 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: current_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: current_user.id, + created_by_id: current_user.id, }, - :article => { - :updated_by_id => current_user.id, - :created_by_id => current_user.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: current_user.id, + created_by_id: current_user.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, }, - :update => { - :ticket => { - :title => 'Unit Test 1 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, + update: { + ticket: { + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, }, }, - :update2 => { - :ticket => { - :title => 'Unit Test 2 (äöüß) - update!', - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, + update2: { + ticket: { + title: 'Unit Test 2 (äöüß) - update!', + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, }, }, - :check => [ + check: [ { - :result => true, - :object => 'Ticket', - :type => 'updated', + result: true, + object: 'Ticket', + type: 'updated', }, { - :result => true, - :object => 'Ticket::Article', - :type => 'created', + result: true, + object: 'Ticket::Article', + type: 'created', }, { - :result => true, - :object => 'Ticket', - :type => 'created', + result: true, + object: 'Ticket', + type: 'created', }, { - :result => false, - :object => 'User', - :type => 'updated', - :o_id => current_user.id, + result: false, + object: 'User', + type: 'updated', + o_id: current_user.id, }, ] }, @@ -141,7 +141,7 @@ class ActivityStreamTest < ActiveSupport::TestCase tickets.each { |ticket| ticket_id = ticket.id ticket.destroy - found = Ticket.where( :id => ticket_id ).first + found = Ticket.where( id: ticket_id ).first assert( !found, 'Ticket destroyed') } end @@ -151,33 +151,33 @@ class ActivityStreamTest < ActiveSupport::TestCase # test 1 { - :create => { - :organization => { - :name => 'some name', - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + create: { + organization: { + name: 'some name', + updated_by_id: current_user.id, + created_by_id: current_user.id, }, }, - :update1 => { - :organization => { - :name => 'some name (äöüß)', + update1: { + organization: { + name: 'some name (äöüß)', }, }, - :update2 => { - :organization => { - :name => 'some name 2 (äöüß)', + update2: { + organization: { + name: 'some name 2 (äöüß)', }, }, - :check => [ + check: [ { - :result => true, - :object => 'Organization', - :type => 'updated', + result: true, + object: 'Organization', + type: 'updated', }, { - :result => true, - :object => 'Organization', - :type => 'created', + result: true, + object: 'Organization', + type: 'created', }, ] }, @@ -216,7 +216,7 @@ class ActivityStreamTest < ActiveSupport::TestCase organizations.each { |organization| organization_id = organization.id organization.destroy - found = Organization.where( :id => organization_id ).first + found = Organization.where( id: organization_id ).first assert( !found, 'Organization destroyed') } end @@ -227,30 +227,30 @@ class ActivityStreamTest < ActiveSupport::TestCase # test 1 { - :create => { - :user => { - :login => 'someemail@example.com', - :email => 'Bob Smith II ', - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + create: { + user: { + login: 'someemail@example.com', + email: 'Bob Smith II ', + updated_by_id: current_user.id, + created_by_id: current_user.id, }, }, - :update1 => { - :user => { - :firstname => 'Bob U', - :lastname => 'Smith U', + update1: { + user: { + firstname: 'Bob U', + lastname: 'Smith U', }, }, - :check => [ + check: [ { - :result => true, - :object => 'User', - :type => 'created', + result: true, + object: 'User', + type: 'created', }, { - :result => false, - :object => 'User', - :type => 'updated', + result: false, + object: 'User', + type: 'updated', }, ] }, @@ -283,7 +283,7 @@ class ActivityStreamTest < ActiveSupport::TestCase users.each { |user| user_id = user.id user.destroy - found = User.where( :id => user_id ).first + found = User.where( id: user_id ).first assert( !found, 'User destroyed') } end @@ -293,36 +293,36 @@ class ActivityStreamTest < ActiveSupport::TestCase # test 1 { - :create => { - :user => { - :login => 'someemail@example.com', - :email => 'Bob Smith II ', - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + create: { + user: { + login: 'someemail@example.com', + email: 'Bob Smith II ', + updated_by_id: current_user.id, + created_by_id: current_user.id, }, }, - :update1 => { - :user => { - :firstname => 'Bob U', - :lastname => 'Smith U', + update1: { + user: { + firstname: 'Bob U', + lastname: 'Smith U', }, }, - :update2 => { - :user => { - :firstname => 'Bob', - :lastname => 'Smith', + update2: { + user: { + firstname: 'Bob', + lastname: 'Smith', }, }, - :check => [ + check: [ { - :result => true, - :object => 'User', - :type => 'updated', + result: true, + object: 'User', + type: 'updated', }, { - :result => true, - :object => 'User', - :type => 'created', + result: true, + object: 'User', + type: 'created', }, ] }, @@ -362,7 +362,7 @@ class ActivityStreamTest < ActiveSupport::TestCase users.each { |user| user_id = user.id user.destroy - found = User.where( :id => user_id ).first + found = User.where( id: user_id ).first assert( !found, 'User destroyed') } end diff --git a/test/unit/assets_test.rb b/test/unit/assets_test.rb index 119550b82..d499e0434 100644 --- a/test/unit/assets_test.rb +++ b/test/unit/assets_test.rb @@ -4,54 +4,54 @@ require 'test_helper' class AssetsTest < ActiveSupport::TestCase test 'user' do - roles = Role.where( :name => [ 'Agent', 'Admin'] ) + roles = Role.where( name: [ 'Agent', 'Admin'] ) groups = Group.all org = Organization.create_or_update( - :name => 'some org', - :updated_by_id => 1, - :created_by_id => 1, + name: 'some org', + updated_by_id: 1, + created_by_id: 1, ) user1 = User.create_or_update( - :login => 'assets1@example.org', - :firstname => 'assets1', - :lastname => 'assets1', - :email => 'assets1@example.org', - :password => 'some_pass', - :active => true, - :updated_by_id => 1, - :created_by_id => 1, - :organization_id => org.id, - :roles => roles, - :groups => groups, + login: 'assets1@example.org', + firstname: 'assets1', + lastname: 'assets1', + email: 'assets1@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, + organization_id: org.id, + roles: roles, + groups: groups, ) user1.save user2 = User.create_or_update( - :login => 'assets2@example.org', - :firstname => 'assets2', - :lastname => 'assets2', - :email => 'assets2@example.org', - :password => 'some_pass', - :active => true, - :updated_by_id => 1, - :created_by_id => 1, - :roles => roles, - :groups => groups, + login: 'assets2@example.org', + firstname: 'assets2', + lastname: 'assets2', + email: 'assets2@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, + roles: roles, + groups: groups, ) user2.save user3 = User.create_or_update( - :login => 'assets3@example.org', - :firstname => 'assets3', - :lastname => 'assets3', - :email => 'assets3@example.org', - :password => 'some_pass', - :active => true, - :updated_by_id => user1.id, - :created_by_id => user2.id, - :roles => roles, - :groups => groups, + login: 'assets3@example.org', + firstname: 'assets3', + lastname: 'assets3', + email: 'assets3@example.org', + password: 'some_pass', + active: true, + updated_by_id: user1.id, + created_by_id: user2.id, + roles: roles, + groups: groups, ) user3.save assets = user3.assets({}) diff --git a/test/unit/auth_test.rb b/test/unit/auth_test.rb index 443f5c4d4..8b8517cb9 100644 --- a/test/unit/auth_test.rb +++ b/test/unit/auth_test.rb @@ -2,47 +2,47 @@ require 'test_helper' Setting.create_or_update( - :title => 'Authentication via LDAP', - :name => 'auth_ldap', - :area => 'Security::Authentication', - :description => 'Enables user authentication via LDAP.', - :state => { - :adapter => 'Auth::Ldap', - :host => 'localhost', - :port => 389, - :bind_dn => 'cn=Manager,dc=example,dc=org', - :bind_pw => 'example', - :uid => 'mail', - :base => 'dc=example,dc=org', - :always_filter => '', - :always_roles => ['Admin', 'Agent'], - :always_groups => ['Users'], - :sync_params => { - :firstname => 'sn', - :lastname => 'givenName', - :email => 'mail', - :login => 'mail', + title: 'Authentication via LDAP', + name: 'auth_ldap', + area: 'Security::Authentication', + description: 'Enables user authentication via LDAP.', + state: { + adapter: 'Auth::Ldap', + host: 'localhost', + port: 389, + bind_dn: 'cn=Manager,dc=example,dc=org', + bind_pw: 'example', + uid: 'mail', + base: 'dc=example,dc=org', + always_filter: '', + always_roles: ['Admin', 'Agent'], + always_groups: ['Users'], + sync_params: { + firstname: 'sn', + lastname: 'givenName', + email: 'mail', + login: 'mail', }, }, - :frontend => false + frontend: false ) -user = User.lookup( :login => 'nicole.braun@zammad.org' ) +user = User.lookup( login: 'nicole.braun@zammad.org' ) if user user.update_attributes( - :password => 'some_pass', - :active => true, + password: 'some_pass', + active: true, ) else user = User.create_if_not_exists( - :login => 'nicole.braun@zammad.org', - :firstname => 'Nicole', - :lastname => 'Braun', - :email => 'nicole.braun@zammad.org', - :password => 'some_pass', - :active => true, - :updated_by_id => 1, - :created_by_id => 1 + login: 'nicole.braun@zammad.org', + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1 ) end @@ -52,32 +52,32 @@ class AuthTest < ActiveSupport::TestCase # test 1 { - :username => 'not_existing', - :password => 'password', - :result => nil, + username: 'not_existing', + password: 'password', + result: nil, }, # test 2 { - :username => 'paige.chen@example.org', - :password => 'password', - :result => true, - :verify => { - :firstname => 'Chen', - :lastname => 'Paige', - :email => 'paige.chen@example.org', + username: 'paige.chen@example.org', + password: 'password', + result: true, + verify: { + firstname: 'Chen', + lastname: 'Paige', + email: 'paige.chen@example.org', } }, # test 3 { - :username => 'nicole.braun@zammad.org', - :password => 'some_pass', - :result => true, - :verify => { - :firstname => 'Nicole', - :lastname => 'Braun', - :email => 'nicole.braun@zammad.org', + username: 'nicole.braun@zammad.org', + password: 'some_pass', + result: true, + verify: { + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, ] diff --git a/test/unit/cache_test.rb b/test/unit/cache_test.rb index fa0837866..cbc1fd1e1 100644 --- a/test/unit/cache_test.rb +++ b/test/unit/cache_test.rb @@ -7,87 +7,87 @@ class CacheTest < ActiveSupport::TestCase # test 1 { - :set => { - :key => '123', - :data => { - :key => 'some value', + set: { + key: '123', + data: { + key: 'some value', } }, - :verify => { - :key => '123', - :data => { - :key => 'some value', + verify: { + key: '123', + data: { + key: 'some value', } }, }, # test 2 { - :set => { - :key => '123', - :data => { - :key => 'some valueöäüß', + set: { + key: '123', + data: { + key: 'some valueöäüß', } }, - :verify => { - :key => '123', - :data => { - :key => 'some valueöäüß', + verify: { + key: '123', + data: { + key: 'some valueöäüß', } }, }, # test 3 { - :delete => { - :key => '123', + delete: { + key: '123', }, - :verify => { - :key => '123', - :data => nil + verify: { + key: '123', + data: nil }, }, # test 4 { - :set => { - :key => '123', - :data => { - :key => 'some valueöäüß2', + set: { + key: '123', + data: { + key: 'some valueöäüß2', } }, - :verify => { - :key => '123', - :data => { - :key => 'some valueöäüß2', + verify: { + key: '123', + data: { + key: 'some valueöäüß2', } }, }, # test 5 { - :cleanup => true, - :verify => { - :key => '123', - :data => nil + cleanup: true, + verify: { + key: '123', + data: nil }, }, # test 6 { - :set => { - :key => '123', - :data => { - :key => 'some valueöäüß2', + set: { + key: '123', + data: { + key: 'some valueöäüß2', }, - :param => { - :expires_in => 5.seconds, + param: { + expires_in: 5.seconds, } }, - :sleep => 10, - :verify => { - :key => '123', - :data => nil + sleep: 10, + verify: { + key: '123', + data: nil }, }, ] diff --git a/test/unit/db_auto_increment_test.rb b/test/unit/db_auto_increment_test.rb index a83a1a6c3..ea3fad13f 100644 --- a/test/unit/db_auto_increment_test.rb +++ b/test/unit/db_auto_increment_test.rb @@ -9,42 +9,42 @@ class DbAutoIncrementTest < ActiveSupport::TestCase Setting.set('system_init_done', false) - Ticket::StateType.create_if_not_exists( :id => 200, :name => 'unit test 1', :updated_by_id => 1, :created_by_id => 1 ) - state_type = Ticket::StateType.where( :name => 'unit test 1' ).first + Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1', updated_by_id: 1, created_by_id: 1 ) + state_type = Ticket::StateType.where( name: 'unit test 1' ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1', state_type.name ) - Ticket::StateType.create_if_not_exists( :id => 200, :name => 'unit test 1 _ should not be created', :updated_by_id => 1, :created_by_id => 1 ) - state_type = Ticket::StateType.where( :id => 200 ).first + Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1 _ should not be created', updated_by_id: 1, created_by_id: 1 ) + state_type = Ticket::StateType.where( id: 200 ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1', state_type.name ) - Ticket::StateType.create_or_update( :id => 200, :name => 'unit test 1 _ should be updated', :updated_by_id => 1, :created_by_id => 1 ) - state_type = Ticket::StateType.where( :name => 'unit test 1 _ should be updated' ).first + Ticket::StateType.create_or_update( id: 200, name: 'unit test 1 _ should be updated', updated_by_id: 1, created_by_id: 1 ) + state_type = Ticket::StateType.where( name: 'unit test 1 _ should be updated' ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state_type.name ) - state_type = Ticket::StateType.where( :id => 200 ).first + state_type = Ticket::StateType.where( id: 200 ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state_type.name ) - Ticket::State.create_if_not_exists( :id => 210, :name => 'unit test 1', :state_type_id => Ticket::StateType.where(:name => 'unit test 1 _ should be updated').first.id, :updated_by_id => 1, :created_by_id => 1 ) - state = Ticket::State.where( :name => 'unit test 1' ).first + Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + state = Ticket::State.where( name: 'unit test 1' ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1', state.name ) - Ticket::State.create_if_not_exists( :id => 210, :name => 'unit test 1 _ should not be created', :state_type_id => Ticket::StateType.where(:name => 'unit test 1 _ should be updated').first.id, :updated_by_id => 1, :created_by_id => 1 ) - state = Ticket::State.where( :id => 210 ).first + Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1 _ should not be created', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + state = Ticket::State.where( id: 210 ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1', state.name ) - Ticket::State.create_or_update( :id => 210, :name => 'unit test 1 _ should be updated', :state_type_id => Ticket::StateType.where(:name => 'unit test 1 _ should be updated').first.id, :updated_by_id => 1, :created_by_id => 1 ) - state = Ticket::State.where( :name => 'unit test 1 _ should be updated' ).first + Ticket::State.create_or_update( id: 210, name: 'unit test 1 _ should be updated', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + state = Ticket::State.where( name: 'unit test 1 _ should be updated' ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state.name ) - state = Ticket::State.where( :id => 210 ).first + state = Ticket::State.where( id: 210 ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state.name ) diff --git a/test/unit/email_build_test.rb b/test/unit/email_build_test.rb index 7f7764d7b..56344ecfe 100644 --- a/test/unit/email_build_test.rb +++ b/test/unit/email_build_test.rb @@ -36,11 +36,11 @@ class EmailBuildTest < ActiveSupport::TestCase ' mail = Channel::EmailBuild.build( - :from => 'sender@example.com', - :to => 'recipient@example.com', - :body => html, - :content_type => 'text/html', - :attachments => [ + from: 'sender@example.com', + to: 'recipient@example.com', + body: html, + content_type: 'text/html', + attachments: [ { 'Mime-Type' => 'image/png', :content => 'xxx', @@ -91,10 +91,10 @@ class EmailBuildTest < ActiveSupport::TestCase > Thank you for installing Zammad. äöüß >' mail = Channel::EmailBuild.build( - :from => 'sender@example.com', - :to => 'recipient@example.com', - :body => text, - :attachments => [ + from: 'sender@example.com', + to: 'recipient@example.com', + body: text, + attachments: [ { 'Mime-Type' => 'image/png', :content => 'xxx', @@ -140,9 +140,9 @@ class EmailBuildTest < ActiveSupport::TestCase > Thank you for installing Zammad. äöüß >' mail = Channel::EmailBuild.build( - :from => 'sender@example.com', - :to => 'recipient@example.com', - :body => text, + from: 'sender@example.com', + to: 'recipient@example.com', + body: text, ) should = '> Welcome! diff --git a/test/unit/email_parser_test.rb b/test/unit/email_parser_test.rb index 451aae1fa..583ec4f7f 100644 --- a/test/unit/email_parser_test.rb +++ b/test/unit/email_parser_test.rb @@ -5,25 +5,25 @@ class EmailParserTest < ActiveSupport::TestCase test 'parse' do files = [ { - :data => IO.read('test/fixtures/mail1.box'), - :body_md5 => 'b57d21dcac6b05e1aa67af51a9e4c1ec', - :params => { - :from => 'John.Smith@example.com', - :from_email => 'John.Smith@example.com', - :from_display_name => '', - :subject => 'CI Daten für PublicView ', + data: IO.read('test/fixtures/mail1.box'), + body_md5: 'b57d21dcac6b05e1aa67af51a9e4c1ec', + params: { + from: 'John.Smith@example.com', + from_email: 'John.Smith@example.com', + from_display_name: '', + subject: 'CI Daten für PublicView ', }, }, { - :data => IO.read('test/fixtures/mail2.box'), - :body_md5 => '154c7d3ae7b94f99589df62882841b08', - :params => { - :from => 'Martin Edenhofer ', - :from_email => 'martin@example.com', - :from_display_name => 'Martin Edenhofer', - :subject => 'aaäöüßad asd', - :body_md5 => "äöüß ad asd\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n", - :body => "äöüß ad asd + data: IO.read('test/fixtures/mail2.box'), + body_md5: '154c7d3ae7b94f99589df62882841b08', + params: { + from: 'Martin Edenhofer ', + from_email: 'martin@example.com', + from_display_name: 'Martin Edenhofer', + subject: 'aaäöüßad asd', + body_md5: "äöüß ad asd\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n", + body: "äöüß ad asd -Martin @@ -33,24 +33,24 @@ Old programmers never die. They just branch to a new address. }, }, { - :data => IO.read('test/fixtures/mail3.box'), - :body_md5 => '96a0a7847c1c60e82058db8f8bff8136', - :params => { - :from => '"Günther John | Example GmbH" ', - :from_email => 'k.guenther@example.com', - :from_display_name => 'Günther John | Example GmbH', - :subject => 'Ticket Templates', + data: IO.read('test/fixtures/mail3.box'), + body_md5: '96a0a7847c1c60e82058db8f8bff8136', + params: { + from: '"Günther John | Example GmbH" ', + from_email: 'k.guenther@example.com', + from_display_name: 'Günther John | Example GmbH', + subject: 'Ticket Templates', }, }, { - :data => IO.read('test/fixtures/mail4.box'), - :body_md5 => '9fab9a0e8523011fde0f3ecd80f8d72c', - :params => { - :from => '"Günther Katja | Example GmbH" ', - :from_email => 'k.guenther@example.com', - :from_display_name => 'Günther Katja | Example GmbH', - :subject => 'AW: Ticket Templates [Ticket#11168]', - :body => "Hallo Katja, + data: IO.read('test/fixtures/mail4.box'), + body_md5: '9fab9a0e8523011fde0f3ecd80f8d72c', + params: { + from: '"Günther Katja | Example GmbH" ', + from_email: 'k.guenther@example.com', + from_display_name: 'Günther Katja | Example GmbH', + subject: 'AW: Ticket Templates [Ticket#11168]', + body: "Hallo Katja, super! Ich freu mich! @@ -74,24 +74,24 @@ Liebe Grüße! }, }, { - :data => IO.read('test/fixtures/mail5.box'), - :body_md5 => 'f34033e9a34bb5367062dd5df21115df', - :params => { - :from => 'marc.smith@example.com (Marc Smith)', - :from_email => 'marc.smith@example.com', - :from_display_name => 'Marc Smith', - :subject => 'Re: XXXX Betatest Ticket Templates [Ticket#11162]', + data: IO.read('test/fixtures/mail5.box'), + body_md5: 'f34033e9a34bb5367062dd5df21115df', + params: { + from: 'marc.smith@example.com (Marc Smith)', + from_email: 'marc.smith@example.com', + from_display_name: 'Marc Smith', + subject: 'Re: XXXX Betatest Ticket Templates [Ticket#11162]', }, }, { - :data => IO.read('test/fixtures/mail6.box'), - :body_md5 => 'cc60217317756f45a6e02829c0a8c49c', - :params => { - :from => '"Hans BÄKOSchönland" ', - :from_email => 'me@bogen.net', - :from_display_name => 'Hans BÄKOSchönland', - :subject => 'utf8: 使って / ISO-8859-1: Priorität" / cp-1251: Сергей Углицких', - :body => "this is a test + data: IO.read('test/fixtures/mail6.box'), + body_md5: 'cc60217317756f45a6e02829c0a8c49c', + params: { + from: '"Hans BÄKOSchönland" ', + from_email: 'me@bogen.net', + from_display_name: 'Hans BÄKOSchönland', + subject: 'utf8: 使って / ISO-8859-1: Priorität" / cp-1251: Сергей Углицких', + body: "this is a test ___ [1] Compare Cable, DSL or Satellite plans: As low as $2.95. @@ -106,14 +106,14 @@ Test5:= }, }, { - :data => IO.read('test/fixtures/mail7.box'), - :body_md5 => 'c78f6a91905538ee32bc0bf71f70fcf2', - :params => { - :from => 'Eike.Ehringer@example.com', - :from_email => 'Eike.Ehringer@example.com', - :from_display_name => '', - :subject => 'AW:Installation [Ticket#11392]', - :body => "Hallo. + data: IO.read('test/fixtures/mail7.box'), + body_md5: 'c78f6a91905538ee32bc0bf71f70fcf2', + params: { + from: 'Eike.Ehringer@example.com', + from_email: 'Eike.Ehringer@example.com', + from_display_name: '', + subject: 'AW:Installation [Ticket#11392]', + body: "Hallo. Jetzt muss ich dir noch kurzfristig absagen für morgen. Lass uns evtl morgen Tel. @@ -146,20 +146,20 @@ Managing Director: Martin Edenhofer", }, }, { - :data => IO.read('test/fixtures/mail8.box'), - :body_md5 => 'ca502c70a1b006f5184d1f0bf79d5799', - :attachments => [ + data: IO.read('test/fixtures/mail8.box'), + body_md5: 'ca502c70a1b006f5184d1f0bf79d5799', + attachments: [ { - :md5 => 'c3ca4aab222eed8a148a716371b70129', - :filename => 'message.html', + md5: 'c3ca4aab222eed8a148a716371b70129', + filename: 'message.html', }, ], - :params => { - :from => 'Franz.Schaefer@example.com', - :from_email => 'Franz.Schaefer@example.com', - :from_display_name => '', - :subject => 'could not rename: ZZZAAuto', - :body_md5 => "Gravierend? + params: { + from: 'Franz.Schaefer@example.com', + from_email: 'Franz.Schaefer@example.com', + from_display_name: '', + subject: 'could not rename: ZZZAAuto', + body_md5: "Gravierend? Mit freundlichen Grüßen @@ -186,199 +186,199 @@ Hof }, }, { - :data => IO.read('test/fixtures/mail9.box'), - :body_md5 => 'c70de14cc69b17b07850b570d7a4fbe7', - :attachments => [ + data: IO.read('test/fixtures/mail9.box'), + body_md5: 'c70de14cc69b17b07850b570d7a4fbe7', + attachments: [ { - :md5 => '9964263c167ab47f8ec59c48e57cb905', - :filename => 'message.html', + md5: '9964263c167ab47f8ec59c48e57cb905', + filename: 'message.html', }, { - :md5 => 'ddbdf67aa2f5c60c294008a54d57082b', - :filename => 'super-seven.jpg', + md5: 'ddbdf67aa2f5c60c294008a54d57082b', + filename: 'super-seven.jpg', }, ], - :params => { - :from => 'Martin Edenhofer ', - :from_email => 'martin@example.de', - :from_display_name => 'Martin Edenhofer', - :subject => 'AW: OTRS / Anfrage OTRS Einführung/Präsentation [Ticket#11545]', - :body => "Enjoy!\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n\n" + params: { + from: 'Martin Edenhofer ', + from_email: 'martin@example.de', + from_display_name: 'Martin Edenhofer', + subject: 'AW: OTRS / Anfrage OTRS Einführung/Präsentation [Ticket#11545]', + body: "Enjoy!\n\n-Martin\n\n--\nOld programmers never die. They just branch to a new address.\n\n" }, }, { - :data => IO.read('test/fixtures/mail10.box'), - :body_md5 => 'ddfad696bd34d83f607763180243f3c5', - :attachments => [ + data: IO.read('test/fixtures/mail10.box'), + body_md5: 'ddfad696bd34d83f607763180243f3c5', + attachments: [ { - :md5 => '52d946fdf1a9304d0799cceb2fcf0e36', - :filename => 'message.html', + md5: '52d946fdf1a9304d0799cceb2fcf0e36', + filename: 'message.html', }, { - :md5 => 'a618d671348735744d4c9a4005b56799', - :filename => 'image001.jpg', + md5: 'a618d671348735744d4c9a4005b56799', + filename: 'image001.jpg', }, ], - :params => { - :from => 'Smith Sepp ', - :from_email => 'smith@example.com', - :from_display_name => 'Smith Sepp', - :subject => 'Gruß aus Oberalteich', + params: { + from: 'Smith Sepp ', + from_email: 'smith@example.com', + from_display_name: 'Smith Sepp', + subject: 'Gruß aus Oberalteich', # :body => "Herzliche Grüße aus Oberalteich sendet Herrn Smith\n\n \n\nSepp Smith - Dipl.Ing. agr. (FH)\n\nGeschäftsführer der example Straubing-Bogen\n\nKlosterhof 1 | 94327 Bogen-Oberalteich\n\nTel: 09422-505601 | Fax: 09422-505620\n\nInternet: http://example-straubing-bogen.de \n\nFacebook: http://facebook.de/examplesrbog \n\n - European Foundation für Quality Management\n\n" }, }, { - :data => IO.read('test/fixtures/mail11.box'), - :body_md5 => 'cf8b26d9fc4ce9abb19a36ce3a130c79', - :attachments => [ + data: IO.read('test/fixtures/mail11.box'), + body_md5: 'cf8b26d9fc4ce9abb19a36ce3a130c79', + attachments: [ { - :md5 => '08660cd33ce8c64b95bcf0207ff6c4d6', - :filename => 'message.html', + md5: '08660cd33ce8c64b95bcf0207ff6c4d6', + filename: 'message.html', }, ], - :params => { - :from => 'CYLEX Newsletter ', - :from_email => 'carina.merkant@cylex.de', - :from_display_name => 'CYLEX Newsletter', - :subject => 'Eine schöne Adventszeit für ZNUNY GMBH - ENTERPRISE SERVICES FÜR OTRS', - :to => 'enjoy_us@znuny.com', + params: { + from: 'CYLEX Newsletter ', + from_email: 'carina.merkant@cylex.de', + from_display_name: 'CYLEX Newsletter', + subject: 'Eine schöne Adventszeit für ZNUNY GMBH - ENTERPRISE SERVICES FÜR OTRS', + to: 'enjoy_us@znuny.com', }, }, { - :data => IO.read('test/fixtures/mail12.box'), - :body_md5 => '8b48e082bc77e927d395448875259172', - :attachments => [ + data: IO.read('test/fixtures/mail12.box'), + body_md5: '8b48e082bc77e927d395448875259172', + attachments: [ { - :md5 => '46cf0f95ea0c8211cbb704e1959b9173', - :filename => 'message.html', + md5: '46cf0f95ea0c8211cbb704e1959b9173', + filename: 'message.html', }, { - :md5 => 'b6e70f587c4b1810facbb20bb5ec69ef', - :filename => 'image002.png', + md5: 'b6e70f587c4b1810facbb20bb5ec69ef', + filename: 'image002.png', }, ], - :params => { - :from => 'Alex.Smith@example.com', - :from_email => 'Alex.Smith@example.com', - :from_display_name => '', - :subject => 'AW: Agenda [Ticket#11995]', - :to => 'example@znuny.com', + params: { + from: 'Alex.Smith@example.com', + from_email: 'Alex.Smith@example.com', + from_display_name: '', + subject: 'AW: Agenda [Ticket#11995]', + to: 'example@znuny.com', }, }, { - :data => IO.read('test/fixtures/mail13.box'), - :body_md5 => '58806e006b14b04a535784a5462d09b0', - :attachments => [ + data: IO.read('test/fixtures/mail13.box'), + body_md5: '58806e006b14b04a535784a5462d09b0', + attachments: [ { - :md5 => '29cc1679f8a44c72be6be7c1da4278ac', - :filename => 'message.html', + md5: '29cc1679f8a44c72be6be7c1da4278ac', + filename: 'message.html', }, ], - :params => { - :from => 'thomas.smith@example.com', - :from_email => 'thomas.smith@example.com', - :from_display_name => '', - :subject => 'Antwort: Probleme ADB / Anlegen von Tickets [Ticket#111079]', - :to => 'q1@znuny.com', + params: { + from: 'thomas.smith@example.com', + from_email: 'thomas.smith@example.com', + from_display_name: '', + subject: 'Antwort: Probleme ADB / Anlegen von Tickets [Ticket#111079]', + to: 'q1@znuny.com', }, }, { - :data => IO.read('test/fixtures/mail14.box'), - :body_md5 => '154c7d3ae7b94f99589df62882841b08', - :attachments => [ + data: IO.read('test/fixtures/mail14.box'), + body_md5: '154c7d3ae7b94f99589df62882841b08', + attachments: [ { - :md5 => '5536be23f647953dc39c1673205d6f5b', - :filename => 'file-1', + md5: '5536be23f647953dc39c1673205d6f5b', + filename: 'file-1', }, { - :md5 => '4eeeae078b920f9d0708353ba0f6aa63', - :filename => 'file-2', + md5: '4eeeae078b920f9d0708353ba0f6aa63', + filename: 'file-2', }, ], - :params => { - :from => '"Müller, Bernd" ', - :from_email => 'Bernd.Mueller@example.com', - :from_display_name => 'Müller, Bernd', - :subject => 'AW: OTRS [Ticket#118192]', - :to => '\'Martin Edenhofer via Znuny Sales\' ', + params: { + from: '"Müller, Bernd" ', + from_email: 'Bernd.Mueller@example.com', + from_display_name: 'Müller, Bernd', + subject: 'AW: OTRS [Ticket#118192]', + to: '\'Martin Edenhofer via Znuny Sales\' ', }, }, # spam email { - :data => IO.read('test/fixtures/mail15.box'), - :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e', - :attachments => [ + data: IO.read('test/fixtures/mail15.box'), + body_md5: 'd41d8cd98f00b204e9800998ecf8427e', + attachments: [ # :preferences=>{"Message-ID"=>"", "Content-Type"=>"application/octet-stream; name=\"\xBC\xA8\xD0\xA7\xB9\xDC\xC0\xED,\xBE\xBF\xBE\xB9\xCB\xAD\xB4\xED\xC1\xCB.xls\"", "Mime-Type"=>"application/octet-stream", "Charset"=>"UTF-8"}} # mutt c1abb5fb77a9d2ab2017749a7987c074 { - :md5 => '2ef81e47872d42efce7ef34bfa2de043', - :filename => 'file-1', + md5: '2ef81e47872d42efce7ef34bfa2de043', + filename: 'file-1', }, ], - :params => { - :from => '"Sara.Gang" ', - :from_email => 'ynbe.ctrhk@gmail.com', - :from_display_name => 'Sara.Gang', - :subject => '绩效管理,究竟谁错了', - :to => 'info42@znuny.com', + params: { + from: '"Sara.Gang" ', + from_email: 'ynbe.ctrhk@gmail.com', + from_display_name: 'Sara.Gang', + subject: '绩效管理,究竟谁错了', + to: 'info42@znuny.com', }, }, # spam email { - :data => IO.read('test/fixtures/mail16.box'), - :body_md5 => 'a2367adfa77857a078dad83826d659e8', - :params => { - :from => nil, - :from_email => 'vipyimin@126.com', - :from_display_name => '', - :subject => '【 直通美国排名第49大学 成功后付费 】', - :to => '"enterprisemobility.apacservice" ', + data: IO.read('test/fixtures/mail16.box'), + body_md5: 'a2367adfa77857a078dad83826d659e8', + params: { + from: nil, + from_email: 'vipyimin@126.com', + from_display_name: '', + subject: '【 直通美国排名第49大学 成功后付费 】', + to: '"enterprisemobility.apacservice" ', }, }, # spam email { - :data => IO.read('test/fixtures/mail17.box'), - :body_md5 => 'c32d6502f47435e613a2112625118270', - :params => { - :from => '"都琹" ', - :from_email => 'ghgbwum@185.com.cn', - :from_display_name => '都琹', - :subject => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               人物 互联网事百度新闻独家出品传媒换一批捷克戴维斯杯决赛前任命临时领队 前领队因病住院最新:盖世汽车讯 11月6日,通用汽车宣布今年10月份在华销量...减持三特索道 孟凯将全力发展湘鄂情江青摄影作品科技日报讯 (记者过国忠 通讯员陈飞燕)江苏省无线电科学研究所有限公司院士工作站日前正式建...[详细]', - :to => 'info@znuny.com', + data: IO.read('test/fixtures/mail17.box'), + body_md5: 'c32d6502f47435e613a2112625118270', + params: { + from: '"都琹" ', + from_email: 'ghgbwum@185.com.cn', + from_display_name: '都琹', + subject: '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               人物 互联网事百度新闻独家出品传媒换一批捷克戴维斯杯决赛前任命临时领队 前领队因病住院最新:盖世汽车讯 11月6日,通用汽车宣布今年10月份在华销量...减持三特索道 孟凯将全力发展湘鄂情江青摄影作品科技日报讯 (记者过国忠 通讯员陈飞燕)江苏省无线电科学研究所有限公司院士工作站日前正式建...[详细]', + to: 'info@znuny.com', }, }, { - :data => IO.read('test/fixtures/mail18.box'), - :body_md5 => '66f20e8557095762ccad9a6cb6f59c3a', - :params => { - :from => 'postmaster@example.com', - :from_email => 'postmaster@example.com', - :from_display_name => '', - :subject => 'Benachrichtung zum =?unicode-1-1-utf-7?Q?+ANw-bermittlungsstatus (Fehlgeschlagen)?=', - :to => 'sales@znuny.org', + data: IO.read('test/fixtures/mail18.box'), + body_md5: '66f20e8557095762ccad9a6cb6f59c3a', + params: { + from: 'postmaster@example.com', + from_email: 'postmaster@example.com', + from_display_name: '', + subject: 'Benachrichtung zum =?unicode-1-1-utf-7?Q?+ANw-bermittlungsstatus (Fehlgeschlagen)?=', + to: 'sales@znuny.org', }, }, { - :data => IO.read('test/fixtures/mail19.box'), - :body_md5 => '3e42be74f967379a3053f21f4125ca66', - :params => { - :from => '"我" <>', - :from_email => '"=?GB2312?B?ztI=?=" <>', - :from_display_name => '', - :subject => '《欧美简讯》', - :to => '377861373 <377861373@qq.com>', + data: IO.read('test/fixtures/mail19.box'), + body_md5: '3e42be74f967379a3053f21f4125ca66', + params: { + from: '"我" <>', + from_email: '"=?GB2312?B?ztI=?=" <>', + from_display_name: '', + subject: '《欧美简讯》', + to: '377861373 <377861373@qq.com>', }, }, { - :data => IO.read('test/fixtures/mail20.box'), - :body_md5 => '65ca1367dfc26abcf49d30f68098f122', - :params => { - :from => 'Health and Care-Mall ', - :from_email => 'drugs-cheapest8@sicor.com', - :from_display_name => 'Health and Care-Mall', - :subject => 'The Highest Grade Drugs And EXTRA LOW Price .', - :to => 'info2@znuny.com', - :body => "________________________________________________________________________Yeah but even when they. Beth liî ed her neck as well + data: IO.read('test/fixtures/mail20.box'), + body_md5: '65ca1367dfc26abcf49d30f68098f122', + params: { + from: 'Health and Care-Mall ', + from_email: 'drugs-cheapest8@sicor.com', + from_display_name: 'Health and Care-Mall', + subject: 'The Highest Grade Drugs And EXTRA LOW Price .', + to: 'info2@znuny.com', + body: "________________________________________________________________________Yeah but even when they. Beth liî ed her neck as well ó25aHw511IΨ11xG⌊o8KHCmς9-2½23QgñV6UAD12AX←t1Lf7⊕1Ir²r1TLA5pYJhjV gPnãM36V1E89RUDΤÅ12I92s2CΘYEϒAfg∗bT11∫rIoiš¦O5oUIN1Is2S21Pp Ÿ2q1FΧ⇑eGOz⌈F1R98y§ 74”lTr8r1H2æu2E2P2q VmkfB∫SKNElst4S∃182T2G1í lY92Pu×8>RÒ¬⊕ΜIÙzÙCC412QEΡºS2!XgŒs. 2γ⇓B[1] cwspC L8I C K88H E1R?E2e31 !Calm dylan for school today. @@ -410,26 +410,26 @@ Wade to give it seemed like this. Yeah but one for any longer. Everything you go }, }, { - :data => IO.read('test/fixtures/mail21.box'), - :body_md5 => 'f909a17fde261099903f3236f8755249', - :params => { - :from => 'Viagra Super Force Online ', - :from_email => 'pharmacy_affordable1@ertelecom.ru', - :from_display_name => 'Viagra Super Force Online', - :subject => 'World Best DRUGS Mall For a Reasonable Price.', - :to => 'info@znuny.nix', + data: IO.read('test/fixtures/mail21.box'), + body_md5: 'f909a17fde261099903f3236f8755249', + params: { + from: 'Viagra Super Force Online ', + from_email: 'pharmacy_affordable1@ertelecom.ru', + from_display_name: 'Viagra Super Force Online', + subject: 'World Best DRUGS Mall For a Reasonable Price.', + to: 'info@znuny.nix', }, }, { - :data => IO.read('test/fixtures/mail22.box'), - :body_md5 => '9e79cb133d52afe9e18e8438df539305', - :params => { - :from => 'Gilbertina Suthar ', - :from_email => 'ireoniqla@lipetsk.ru', - :from_display_name => 'Gilbertina Suthar', - :subject => 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.', - :to => 'Info ', - :body => "Puzzled by judith bronte dave. Melvin will want her way through with. + data: IO.read('test/fixtures/mail22.box'), + body_md5: '9e79cb133d52afe9e18e8438df539305', + params: { + from: 'Gilbertina Suthar ', + from_email: 'ireoniqla@lipetsk.ru', + from_display_name: 'Gilbertina Suthar', + subject: 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.', + to: 'Info ', + body: "Puzzled by judith bronte dave. Melvin will want her way through with. Continued adam helped charlie cried. Soon joined the master bathroom. Grinned adam rubbed his arms she nodded. Freemont and they talked with beppe. Thinking of bed and whenever adam. @@ -449,47 +449,47 @@ Freemont and pulling out several minutes. }, { - :data => IO.read('test/fixtures/mail23.box'), - :body_md5 => '545a1b067fd10ac636c20b44f5df8868', - :params => { - :from => 'marketingmanager@nthcpghana.com', - :from_email => 'marketingmanager@nthcpghana.com', - :from_display_name => '', - :subject => nil, - :to => 'undisclosed-recipients: ;', + data: IO.read('test/fixtures/mail23.box'), + body_md5: '545a1b067fd10ac636c20b44f5df8868', + params: { + from: 'marketingmanager@nthcpghana.com', + from_email: 'marketingmanager@nthcpghana.com', + from_display_name: '', + subject: nil, + to: 'undisclosed-recipients: ;', }, }, { - :data => IO.read('test/fixtures/mail24.box'), - :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e', - :params => { - :from => 'oracle@IG0-1-DB01.example.com', - :from_email => 'oracle@IG0-1-DB01.example.com', - :from_display_name => '', - :subject => 'Regelsets im Test-Status gefunden: 1', - :to => 'support@example.com', - :body => '', + data: IO.read('test/fixtures/mail24.box'), + body_md5: 'd41d8cd98f00b204e9800998ecf8427e', + params: { + from: 'oracle@IG0-1-DB01.example.com', + from_email: 'oracle@IG0-1-DB01.example.com', + from_display_name: '', + subject: 'Regelsets im Test-Status gefunden: 1', + to: 'support@example.com', + body: '', }, - :attachments => [ + attachments: [ { - :data => 'RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE + data: 'RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE 387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14 ', - :md5 => 'a61c76479fdc2f107fe2697ac5ad60ae', - :filename => 'rulesets-report.csv', + md5: 'a61c76479fdc2f107fe2697ac5ad60ae', + filename: 'rulesets-report.csv', }, ], }, { - :data => IO.read('test/fixtures/mail25.box'), - :body_md5 => '436f71d8d8a4ffbd3f18fc9de7d7f767', - :params => { - :from => 'oracle@IG0-1-DB01.example.com', - :from_email => 'oracle@IG0-1-DB01.example.com', - :from_display_name => '', - :subject => 'Regelsets im Test-Status gefunden: 1', - :to => 'support@example.com', - :body => "begin 644 rulesets-report.csv + data: IO.read('test/fixtures/mail25.box'), + body_md5: '436f71d8d8a4ffbd3f18fc9de7d7f767', + params: { + from: 'oracle@IG0-1-DB01.example.com', + from_email: 'oracle@IG0-1-DB01.example.com', + from_display_name: '', + subject: 'Regelsets im Test-Status gefunden: 1', + to: 'support@example.com', + body: "begin 644 rulesets-report.csv M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$ M051%\"C,X-SM$4\"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U-- *.S$W+C`Y+C$T\"@`` @@ -499,15 +499,15 @@ end }, }, { - :data => IO.read('test/fixtures/mail26.box'), - :body_md5 => 'c68fd31c71a463c7ea820ccdf672c680', - :params => { - :from => 'gate ', - :from_email => 'team@support.gate.de', - :from_display_name => 'gate', - :subject => 'Ihre Rechnung als PDF-Dokument', - :to => 'Martin Edenhofer ', - :body => "******************************************************************** + data: IO.read('test/fixtures/mail26.box'), + body_md5: 'c68fd31c71a463c7ea820ccdf672c680', + params: { + from: 'gate ', + from_email: 'team@support.gate.de', + from_display_name: 'gate', + subject: 'Ihre Rechnung als PDF-Dokument', + to: 'Martin Edenhofer ', + body: "******************************************************************** gate Service @@ -517,67 +517,67 @@ gate GmbH * Gladbacher Str. 74 * 40219 Düsseldorf ", }, - :attachments => [ + attachments: [ { - :md5 => '5d6a49a266987af128bb7254abcb2896', - :filename => 'message.html', + md5: '5d6a49a266987af128bb7254abcb2896', + filename: 'message.html', }, { - :md5 => '552e21cd4cd9918678e3c1a0df491bc3', - :filename => 'invoice_gatede_B181347.txt', + md5: '552e21cd4cd9918678e3c1a0df491bc3', + filename: 'invoice_gatede_B181347.txt', }, ], }, { - :data => IO.read('test/fixtures/mail27.box'), - :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e', - :params => { - :from => 'caoyaoewfzfw@21cn.com', - :from_email => 'caoyaoewfzfw@21cn.com', - :from_display_name => '', - :subject => "\r\n蠭龕中層管理者如何避免角色行为誤区", - :to => 'duan@seat.com.cn, info@znuny.com, jinzh@kingdream.com', - :body => '', + data: IO.read('test/fixtures/mail27.box'), + body_md5: 'd41d8cd98f00b204e9800998ecf8427e', + params: { + from: 'caoyaoewfzfw@21cn.com', + from_email: 'caoyaoewfzfw@21cn.com', + from_display_name: '', + subject: "\r\n蠭龕中層管理者如何避免角色行为誤区", + to: 'duan@seat.com.cn, info@znuny.com, jinzh@kingdream.com', + body: '', }, - :attachments => [ + attachments: [ { - :md5 => '498b8ae7b26033af1a08f85644d6695c', - :filename => 'message.html', + md5: '498b8ae7b26033af1a08f85644d6695c', + filename: 'message.html', }, ], }, { - :data => IO.read('test/fixtures/mail28.box'), - :body_md5 => '5872ddcdfdf6bfe40f36cd0408fca667', - :params => { - :from => 'kontakt@example.de', - :from_email => 'kontakt@example.de', - :from_display_name => '', - :subject => 'Bewerbung auf Ihr Stellenangebot', - :to => 'info@znuny.inc', - :body => 'no visible content', + data: IO.read('test/fixtures/mail28.box'), + body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', + params: { + from: 'kontakt@example.de', + from_email: 'kontakt@example.de', + from_display_name: '', + subject: 'Bewerbung auf Ihr Stellenangebot', + to: 'info@znuny.inc', + body: 'no visible content', }, - :attachments => [ + attachments: [ { - :md5 => '6605d016bda980cdc65fb72d232e4df9', - :filename => 'Znuny GmbH .pdf', + md5: '6605d016bda980cdc65fb72d232e4df9', + filename: 'Znuny GmbH .pdf', }, { - :md5 => '6729bc7cbe44fc967a9d953c4af114b7', - :filename => 'Lebenslauf.pdf', + md5: '6729bc7cbe44fc967a9d953c4af114b7', + filename: 'Lebenslauf.pdf', }, ], }, { - :data => IO.read('test/fixtures/mail29.box'), - :body_md5 => 'b6cc8164ce896046d631ddd44f8c9f6e', - :params => { - :from => 'Example Sales ', - :from_email => 'sales@example.com', - :from_display_name => 'Example Sales', - :subject => 'Example licensing information: No channel available', - :to => 'info@znuny.inc', - :body => "Dear Mr. Edenhofer,We want to keep you updated on TeamViewer licensing shortages on a regular basis. + data: IO.read('test/fixtures/mail29.box'), + body_md5: 'b6cc8164ce896046d631ddd44f8c9f6e', + params: { + from: 'Example Sales ', + from_email: 'sales@example.com', + from_display_name: 'Example Sales', + subject: 'Example licensing information: No channel available', + to: 'info@znuny.inc', + body: "Dear Mr. Edenhofer,We want to keep you updated on TeamViewer licensing shortages on a regular basis. We would like to inform you that since the last message on 25-Nov-2014 there have been temporary session channel exceedances which make it impossible to establish more sessions. Since the last e-mail this has occurred in a total of 1 cases. Additional session channels can be added at any time. Please visit our [1] TeamViewer Online Shop for pricing information. Thank you - and again all the best with TeamViewer! @@ -599,15 +599,15 @@ Registration AG Ulm HRB 534075 * General Manager Holger Felgner }, }, { - :data => IO.read('test/fixtures/mail30.box'), - :body_md5 => 'bba63e2dbe29e7b82d893c2554ff466a', - :params => { - :from => 'Manfred Haert ', - :from_email => 'Manfred.Haert@example.com', - :from_display_name => 'Manfred Haert', - :subject => 'Antragswesen in TesT abbilden', - :to => 'info@znuny.inc', - :body => "Sehr geehrte Damen undHerren, + data: IO.read('test/fixtures/mail30.box'), + body_md5: 'bba63e2dbe29e7b82d893c2554ff466a', + params: { + from: 'Manfred Haert ', + from_email: 'Manfred.Haert@example.com', + from_display_name: 'Manfred Haert', + subject: 'Antragswesen in TesT abbilden', + to: 'info@znuny.inc', + body: "Sehr geehrte Damen undHerren, wir hatten bereits letztes Jahr einen TesT-Workshop mit IhremHerrn XXX durchgeführt und würden nun gerne erneutIhre Dienste in Anspruch nehmen. @@ -644,25 +644,25 @@ Weil wir die Echtheit oder Vollständigkeit der in dieserNachricht enthaltenen I }, }, { - :data => IO.read('test/fixtures/mail31.box'), - :body_md5 => '10484f3b096e85e7001da387c18871d5', - :params => { - :from => '"bertha mou" ', - :from_email => 'zhengkang@ha.chinamobile.com', - :from_display_name => 'bertha mou', - :subject => '內應力產生与注塑工艺条件之间的关系;', - :to => 'info@znuny.inc', + data: IO.read('test/fixtures/mail31.box'), + body_md5: '10484f3b096e85e7001da387c18871d5', + params: { + from: '"bertha mou" ', + from_email: 'zhengkang@ha.chinamobile.com', + from_display_name: 'bertha mou', + subject: '內應力產生与注塑工艺条件之间的关系;', + to: 'info@znuny.inc', }, }, { - :data => IO.read('test/fixtures/mail32.box'), - :body_md5 => '6bed82e0d079e521f506e4e5d3529107', - :params => { - :from => '"Dana.Qin" ', - :from_email => 'Dana.Qin6e1@gmail.com', - :from_display_name => 'Dana.Qin', - :subject => '发现最美车间主任', - :to => 'info@znuny.inc', + data: IO.read('test/fixtures/mail32.box'), + body_md5: '6bed82e0d079e521f506e4e5d3529107', + params: { + from: '"Dana.Qin" ', + from_email: 'Dana.Qin6e1@gmail.com', + from_display_name: 'Dana.Qin', + subject: '发现最美车间主任', + to: 'info@znuny.inc', }, }, ] diff --git a/test/unit/email_process_test.rb b/test/unit/email_process_test.rb index dde74397b..8d1063c5d 100644 --- a/test/unit/email_process_test.rb +++ b/test/unit/email_process_test.rb @@ -5,57 +5,57 @@ class EmailProcessTest < ActiveSupport::TestCase test 'process simple' do files = [ { - :data => 'From: me@example.com + data: 'From: me@example.com To: customer@example.com Subject: some subject Some Text', - :trusted => false, - :success => true, + trusted: false, + success: true, }, { - :data => "From: me@example.com + data: "From: me@example.com To: customer@example.com Subject: äöü some subject Some Textäöü", - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :priority => '2 normal', - :title => 'äöü some subject', + priority: '2 normal', + title: 'äöü some subject', }, 1 => { - :body => 'Some Textäöü', - :sender => 'Customer', - :type => 'email', - :internal => false, + body: 'Some Textäöü', + sender: 'Customer', + type: 'email', + internal: false, }, }, }, { - :data => "From: me@example.com + data: "From: me@example.com To: customer@example.com Subject: äöü some subject Some Textäöü".encode('ISO-8859-1'), - :success => true, - :result => { + success: true, + result: { 0 => { - :priority => '2 normal', - :title => '', # should be äöü some subject, but can not be parsed from mime tools + priority: '2 normal', + title: '', # should be äöü some subject, but can not be parsed from mime tools }, 1 => { - :body => 'Some Textäöü', - :sender => 'Customer', - :type => 'email', - :internal => false, + body: 'Some Textäöü', + sender: 'Customer', + type: 'email', + internal: false, }, }, }, { - :data => "From: me@example.com + data: "From: me@example.com To: customer@example.com Subject: Subject: =?utf-8?B?44CQ5LiT5Lia5Li65oKo5rOo5YaM6aaZ5riv5Y+K5rW35aSW5YWs5Y+477yI5aW95aSE5aSa5aSa77yJ?= =?utf-8?B?44CR44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA44CA?= @@ -115,30 +115,30 @@ Subject: Subject: =?utf-8?B?44CQ5LiT5Lia5Li65oKo5rOo5YaM6aaZ5riv5Y+K5rW35aSW5YWs =?utf-8?B?5YWs5Y+46Zmi5aOr5bel5L2c56uZ5pel5YmN5q2j5byP5bu6Li4uW+ivpue7hl0=?= Some Text", - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :priority => '2 normal', - :title => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                     ', + priority: '2 normal', + title: '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                     ', }, 1 => { - :body => 'Some Text', - :sender => 'Customer', - :type => 'email', + body: 'Some Text', + sender: 'Customer', + type: 'email', }, }, }, { - :data => IO.read('test/fixtures/mail21.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail21.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => 'World Best DRUGS Mall For a Reasonable Price.', + priority: '2 normal', + title: 'World Best DRUGS Mall For a Reasonable Price.', }, 1 => { - :body => "_________________________________________________________________________________Please beth saw his head + body: "_________________________________________________________________________________Please beth saw his head 92hH3ÿoI221G1¿iH16u-2◊NQ422U1awAq¹JLZμ2IicgT1ζ2Y7⊆t 63‘M236E2Ý→DA2†I048CvJ9A↑3iTc4ÉIΥvXO502N1FJSð1r 154F1HPO11CRxZp tLîT9öXH1b3Es1W mN2Bg3õEbPŒS2fτTóY4 sU2P2ζΔRFkcI21™CÓZ3EΛRq!Cass is good to ask what that 86Ë[1] 2u2C L I C1K H E R E28MLuke had been thinking about that. @@ -175,22 +175,22 @@ ___ [1] http://piufup.medicatingsafemart.ru [2] http://www.avast.com/ [3] http://www.avast.com/", - :sender => 'Customer', - :type => 'email', - :internal => false, + sender: 'Customer', + type: 'email', + internal: false, }, }, }, { - :data => IO.read('test/fixtures/mail22.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail22.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.', + priority: '2 normal', + title: 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.', }, 1 => { - :body => "Puzzled by judith bronte dave. Melvin will want her way through with. + body: "Puzzled by judith bronte dave. Melvin will want her way through with. Continued adam helped charlie cried. Soon joined the master bathroom. Grinned adam rubbed his arms she nodded. Freemont and they talked with beppe. Thinking of bed and whenever adam. @@ -206,23 +206,23 @@ Just then returned to believe it here. Freemont and pulling out several minutes. [1] http://аоск.рф?jmlfwnwe&ucwkiyyc", - :sender => 'Customer', - :type => 'email', - :internal => false, + sender: 'Customer', + type: 'email', + internal: false, }, }, }, { - :data => IO.read('test/fixtures/mail23.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail23.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => '', + priority: '2 normal', + title: '', }, 1 => { - :from => 'marketingmanager@nthcpghana.com', - :body => '»ú·¿»·¾³·¨¹æ + from: 'marketingmanager@nthcpghana.com', + body: '»ú·¿»·¾³·¨¹æ Message-ID: <20140911055224675615@nthcpghana.com> From: =?utf-8?B?6IOh5qW35ZKM?= To: , @@ -1817,134 +1817,134 @@ AElFTkSuQmCC ------=_NextPart_000_0FA8_01BB04D8.188AE890-- ', - :sender => 'Customer', - :type => 'email', - :internal => false, + sender: 'Customer', + type: 'email', + internal: false, }, }, }, { - :data => 'From: Some Body + data: 'From: Some Body To: Bob Cc: any@example.com Subject: some subject Some Text', - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :group => 'Users', - :priority => '2 normal', - :title => 'some subject', + group: 'Users', + priority: '2 normal', + title: 'some subject', }, 1 => { - :sender => 'Customer', - :type => 'email', + sender: 'Customer', + type: 'email', }, }, - :verify => { - :users => [ + verify: { + users: [ { - :firstname => 'Some', - :lastname => 'Body', - :email => 'somebody@example.com', + firstname: 'Some', + lastname: 'Body', + email: 'somebody@example.com', }, { - :firstname => 'Bob', - :lastname => '', - :fullname => 'Bob', - :email => 'bod@example.com', + firstname: 'Bob', + lastname: '', + fullname: 'Bob', + email: 'bod@example.com', }, { - :firstname => '', - :lastname => '', - :email => 'any@example.com', - :fullname => 'any@example.com', + firstname: '', + lastname: '', + email: 'any@example.com', + fullname: 'any@example.com', }, ], } }, { - :data => IO.read('test/fixtures/mail30.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail30.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => 'Antragswesen in TesT abbilden', + priority: '2 normal', + title: 'Antragswesen in TesT abbilden', }, 1 => { - :sender => 'Customer', - :type => 'email', + sender: 'Customer', + type: 'email', }, }, - :verify => { - :users => [ + verify: { + users: [ { - :firstname => 'Bert', - :lastname => 'Jörg', - :fullname => 'Bert Jörg', - :email => 'joerg.bert@example.com', + firstname: 'Bert', + lastname: 'Jörg', + fullname: 'Bert Jörg', + email: 'joerg.bert@example.com', }, { - :firstname => 'Karl-Heinz', - :lastname => 'Test', - :fullname => 'Karl-Heinz Test', - :email => 'karl-heinz.test@example.com', + firstname: 'Karl-Heinz', + lastname: 'Test', + fullname: 'Karl-Heinz Test', + email: 'karl-heinz.test@example.com', }, { - :firstname => 'Manfred', - :lastname => 'Haert', - :email => 'manfred.haert@example.com', - :fullname => 'Manfred Haert', + firstname: 'Manfred', + lastname: 'Haert', + email: 'manfred.haert@example.com', + fullname: 'Manfred Haert', }, ], } }, { - :data => IO.read('test/fixtures/mail31.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail31.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => '內應力產生与注塑工艺条件之间的关系;', + priority: '2 normal', + title: '內應力產生与注塑工艺条件之间的关系;', }, 1 => { - :sender => 'Customer', - :type => 'email', + sender: 'Customer', + type: 'email', }, }, - :verify => { - :users => [ + verify: { + users: [ { - :firstname => 'bertha mou', - :lastname => '', - :fullname => 'bertha mou', - :email => 'zhengkang@ha.chinamobile.com', + firstname: 'bertha mou', + lastname: '', + fullname: 'bertha mou', + email: 'zhengkang@ha.chinamobile.com', }, ], } }, { - :data => IO.read('test/fixtures/mail32.box'), - :success => true, - :result => { + data: IO.read('test/fixtures/mail32.box'), + success: true, + result: { 0 => { - :priority => '2 normal', - :title => '发现最美车间主任', + priority: '2 normal', + title: '发现最美车间主任', }, 1 => { - :sender => 'Customer', - :type => 'email', + sender: 'Customer', + type: 'email', }, }, - :verify => { - :users => [ + verify: { + users: [ { - :firstname => 'Dana.Qin', - :lastname => '', - :fullname => 'Dana.Qin', - :email => 'dana.qin6e1@gmail.com', + firstname: 'Dana.Qin', + lastname: '', + fullname: 'Dana.Qin', + email: 'dana.qin6e1@gmail.com', }, ], } @@ -1955,17 +1955,17 @@ Some Text', test 'process trusted' do files = [ { - :data => 'From: me@example.com + data: 'From: me@example.com To: customer@example.com Subject: some subject X-Zammad-Ignore: true Some Text', - :trusted => true, - :success => false, + trusted: true, + success: false, }, { - :data => 'From: me@example.com + data: 'From: me@example.com To: customer@example.com Subject: some subject X-Zammad-Ticket-priority: 3 high @@ -1974,17 +1974,17 @@ x-Zammad-Article-type: phone x-Zammad-Article-Internal: true Some Text', - :trusted => true, - :success => true, - :result => { + trusted: true, + success: true, + result: { 0 => { - :priority => '3 high', - :title => 'some subject', + priority: '3 high', + title: 'some subject', }, 1 => { - :sender => 'System', - :type => 'phone', - :internal => true, + sender: 'System', + type: 'phone', + internal: true, }, }, }, @@ -1995,7 +1995,7 @@ Some Text', test 'process not trusted' do files = [ { - :data => 'From: me@example.com + data: 'From: me@example.com To: customer@example.com Subject: some subject X-Zammad-Ticket-Priority: 3 high @@ -2004,17 +2004,17 @@ x-Zammad-Article-Type: phone x-Zammad-Article-Internal: true Some Text', - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :priority => '2 normal', - :title => 'some subject', + priority: '2 normal', + title: 'some subject', }, 1 => { - :sender => 'Customer', - :type => 'email', - :internal => false, + sender: 'Customer', + type: 'email', + internal: false, }, }, }, @@ -2024,98 +2024,98 @@ Some Text', test 'process with postmaster filter' do group1 = Group.create_if_not_exists( - :name => 'Test Group1', - :created_by_id => 1, - :updated_by_id => 1, + name: 'Test Group1', + created_by_id: 1, + updated_by_id: 1, ) group2 = Group.create_if_not_exists( - :name => 'Test Group2', - :created_by_id => 1, - :updated_by_id => 1, + name: 'Test Group2', + created_by_id: 1, + updated_by_id: 1, ) PostmasterFilter.destroy_all PostmasterFilter.create( - :name => 'not used', - :match => { - :from => 'nobody@example.com', + name: 'not used', + match: { + from: 'nobody@example.com', }, - :perform => { + perform: { 'X-Zammad-Ticket-priority' => '3 high', }, - :channel => 'email', - :active => true, - :created_by_id => 1, - :updated_by_id => 1, + channel: 'email', + active: true, + created_by_id: 1, + updated_by_id: 1, ) PostmasterFilter.create( - :name => 'used', - :match => { - :from => 'me@example.com', + name: 'used', + match: { + from: 'me@example.com', }, - :perform => { + perform: { 'X-Zammad-Ticket-group_id' => group1.id, 'x-Zammad-Article-Internal' => true, }, - :channel => 'email', - :active => true, - :created_by_id => 1, - :updated_by_id => 1, + channel: 'email', + active: true, + created_by_id: 1, + updated_by_id: 1, ) PostmasterFilter.create( - :name => 'used x-any-recipient', - :match => { + name: 'used x-any-recipient', + match: { 'x-any-recipient' => 'any@example.com', }, - :perform => { + perform: { 'X-Zammad-Ticket-group_id' => group2.id, 'x-Zammad-Article-Internal' => true, }, - :channel => 'email', - :active => true, - :created_by_id => 1, - :updated_by_id => 1, + channel: 'email', + active: true, + created_by_id: 1, + updated_by_id: 1, ) files = [ { - :data => 'From: me@example.com + data: 'From: me@example.com To: customer@example.com Subject: some subject Some Text', - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :group => group1.name, - :priority => '2 normal', - :title => 'some subject', + group: group1.name, + priority: '2 normal', + title: 'some subject', }, 1 => { - :sender => 'Customer', - :type => 'email', - :internal => true, + sender: 'Customer', + type: 'email', + internal: true, }, }, }, { - :data => 'From: Some Body + data: 'From: Some Body To: Bob Cc: any@example.com Subject: some subject Some Text', - :trusted => false, - :success => true, - :result => { + trusted: false, + success: true, + result: { 0 => { - :group => group2.name, - :priority => '2 normal', - :title => 'some subject', + group: group2.name, + priority: '2 normal', + title: 'some subject', }, 1 => { - :sender => 'Customer', - :type => 'email', - :internal => true, + sender: 'Customer', + type: 'email', + internal: true, }, }, }, @@ -2127,7 +2127,7 @@ Some Text', def process(files) files.each { |file| parser = Channel::EmailParser.new - result = parser.process( { :trusted => file[:trusted] }, file[:data] ) + result = parser.process( { trusted: file[:trusted] }, file[:data] ) if file[:success] if result && result.class == Array && result[1] assert( true ) @@ -2148,7 +2148,7 @@ Some Text', # verify if users are created if file[:verify][:users] file[:verify][:users].each { |user_result| - user = User.where(:email => user_result[:email]).first + user = User.where(email: user_result[:email]).first if !user assert( false, "No user '#{user_result[:email]}' found!" ) return diff --git a/test/unit/history_test.rb b/test/unit/history_test.rb index f8c3e5226..09b54c7a6 100644 --- a/test/unit/history_test.rb +++ b/test/unit/history_test.rb @@ -2,147 +2,147 @@ require 'test_helper' class HistoryTest < ActiveSupport::TestCase - current_user = User.lookup( :login => 'nicole.braun@zammad.org' ) + current_user = User.lookup( login: 'nicole.braun@zammad.org' ) test 'ticket' do tests = [ # test 1 { - :ticket_create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => current_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 1 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + ticket_create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: current_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: current_user.id, + created_by_id: current_user.id, }, - :article => { - :updated_by_id => current_user.id, - :created_by_id => current_user.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: current_user.id, + created_by_id: current_user.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, }, - :ticket_update => { - :ticket => { - :title => 'Unit Test 1 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, + ticket_update: { + ticket: { + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, }, }, - :history_check => [ + history_check: [ { - :result => true, - :history_object => 'Ticket', - :history_type => 'created', + result: true, + history_object: 'Ticket', + history_type: 'created', }, { - :result => true, - :history_object => 'Ticket', - :history_type => 'updated', - :history_attribute => 'title', - :value_from => 'Unit Test 1 (äöüß)!', - :value_to => 'Unit Test 1 (äöüß) - update!', + result: true, + history_object: 'Ticket', + history_type: 'updated', + history_attribute: 'title', + value_from: 'Unit Test 1 (äöüß)!', + value_to: 'Unit Test 1 (äöüß) - update!', }, { - :result => true, - :history_object => 'Ticket', - :history_type => 'updated', - :history_attribute => 'state', - :value_from => 'new', - :value_to => 'open', - :id_from => Ticket::State.lookup( :name => 'new' ).id, - :id_to => Ticket::State.lookup( :name => 'open' ).id, + result: true, + history_object: 'Ticket', + history_type: 'updated', + history_attribute: 'state', + value_from: 'new', + value_to: 'open', + id_from: Ticket::State.lookup( name: 'new' ).id, + id_to: Ticket::State.lookup( name: 'open' ).id, }, { - :result => true, - :history_object => 'Ticket::Article', - :history_type => 'created', + result: true, + history_object: 'Ticket::Article', + history_type: 'created', }, { - :result => false, - :history_object => 'User', - :history_type => 'updated', + result: false, + history_object: 'User', + history_type: 'updated', }, ] }, # test 2 { - :ticket_create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => current_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 2 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + ticket_create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: current_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 2 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: current_user.id, + created_by_id: current_user.id, }, - :article => { - :created_by_id => current_user.id, - :updated_by_id => current_user.id, - :type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup(:name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + created_by_id: current_user.id, + updated_by_id: current_user.id, + type_id: Ticket::Article::Type.lookup(name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, }, - :ticket_update => { - :ticket => { - :title => 'Unit Test 2 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :owner_id => current_user.id, + ticket_update: { + ticket: { + title: 'Unit Test 2 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + owner_id: current_user.id, }, - :article => { - :from => 'Unit 2 Test 2 ', + article: { + from: 'Unit 2 Test 2 ', }, }, - :history_check => [ + history_check: [ { - :result => true, - :history_object => 'Ticket', - :history_type => 'created', + result: true, + history_object: 'Ticket', + history_type: 'created', }, { - :result => true, - :history_object => 'Ticket', - :history_type => 'updated', - :history_attribute => 'title', - :value_from => 'Unit Test 2 (äöüß)!', - :value_to => 'Unit Test 2 (äöüß) - update!', + result: true, + history_object: 'Ticket', + history_type: 'updated', + history_attribute: 'title', + value_from: 'Unit Test 2 (äöüß)!', + value_to: 'Unit Test 2 (äöüß) - update!', }, { - :result => true, - :history_object => 'Ticket', - :history_type => 'updated', - :history_attribute => 'owner', - :value_from => '-', - :value_to => 'Nicole Braun', - :id_from => User.lookup( :login => '-' ).id, - :id_to => current_user.id, + result: true, + history_object: 'Ticket', + history_type: 'updated', + history_attribute: 'owner', + value_from: '-', + value_to: 'Nicole Braun', + id_from: User.lookup( login: '-' ).id, + id_to: current_user.id, }, { - :result => true, - :history_object => 'Ticket::Article', - :history_type => 'created', + result: true, + history_object: 'Ticket::Article', + history_type: 'created', }, { - :result => true, - :history_object => 'Ticket::Article', - :history_type => 'updated', - :history_attribute => 'from', - :value_from => 'Unit Test ', - :value_to => 'Unit 2 Test 2 ', + result: true, + history_object: 'Ticket::Article', + history_type: 'updated', + history_attribute: 'from', + value_from: 'Unit Test ', + value_to: 'Unit 2 Test 2 ', }, ] }, @@ -188,7 +188,7 @@ class HistoryTest < ActiveSupport::TestCase tickets.each { |ticket| ticket_id = ticket.id ticket.destroy - found = Ticket.where( :id => ticket_id ).first + found = Ticket.where( id: ticket_id ).first assert( !found, 'Ticket destroyed') } end @@ -198,53 +198,53 @@ class HistoryTest < ActiveSupport::TestCase # test 1 { - :user_create => { - :user => { - :login => 'some_login_test', - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'somebody@example.com', - :active => true, - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + user_create: { + user: { + login: 'some_login_test', + firstname: 'Bob', + lastname: 'Smith', + email: 'somebody@example.com', + active: true, + updated_by_id: current_user.id, + created_by_id: current_user.id, }, }, - :user_update => { - :user => { - :firstname => 'Bob', - :lastname => 'Master', - :email => 'master@example.com', }, - :active => false, + user_update: { + user: { + firstname: 'Bob', + lastname: 'Master', + email: 'master@example.com', }, + active: false, }, - :history_check => [ + history_check: [ { - :result => true, - :history_object => 'User', - :history_type => 'created', + result: true, + history_object: 'User', + history_type: 'created', }, { - :result => true, - :history_object => 'User', - :history_type => 'updated', - :history_attribute => 'lastname', - :value_from => 'Smith', - :value_to => 'Master', + result: true, + history_object: 'User', + history_type: 'updated', + history_attribute: 'lastname', + value_from: 'Smith', + value_to: 'Master', }, { - :result => true, - :history_object => 'User', - :history_type => 'updated', - :history_attribute => 'email', - :value_from => 'somebody@example.com', - :value_to => 'master@example.com', + result: true, + history_object: 'User', + history_type: 'updated', + history_attribute: 'email', + value_from: 'somebody@example.com', + value_to: 'master@example.com', }, { - :result => true, - :history_object => 'User', - :history_type => 'updated', - :history_attribute => 'active', - :value_from => 'true', - :value_to => 'false', + result: true, + history_object: 'User', + history_type: 'updated', + history_attribute: 'active', + value_from: 'true', + value_to: 'false', }, ], }, @@ -279,7 +279,7 @@ class HistoryTest < ActiveSupport::TestCase users.each { |user| user_id = user.id user.destroy - found = User.where( :id => user_id ).first + found = User.where( id: user_id ).first assert( !found, 'User destroyed') } end @@ -289,33 +289,33 @@ class HistoryTest < ActiveSupport::TestCase # test 1 { - :organization_create => { - :organization => { - :name => 'Org äöüß', - :note => 'some note', - :updated_by_id => current_user.id, - :created_by_id => current_user.id, + organization_create: { + organization: { + name: 'Org äöüß', + note: 'some note', + updated_by_id: current_user.id, + created_by_id: current_user.id, }, }, - :organization_update => { - :organization => { - :name => 'Org 123', - :note => 'some note', + organization_update: { + organization: { + name: 'Org 123', + note: 'some note', }, }, - :history_check => [ + history_check: [ { - :result => true, - :history_object => 'Organization', - :history_type => 'created', + result: true, + history_object: 'Organization', + history_type: 'created', }, { - :result => true, - :history_object => 'Organization', - :history_type => 'updated', - :history_attribute => 'name', - :value_from => 'Org äöüß', - :value_to => 'Org 123', + result: true, + history_object: 'Organization', + history_type: 'updated', + history_attribute: 'name', + value_from: 'Org äöüß', + value_to: 'Org 123', }, ], }, @@ -348,7 +348,7 @@ class HistoryTest < ActiveSupport::TestCase organizations.each { |organization| organization_id = organization.id organization.destroy - found = Organization.where( :id => organization_id ).first + found = Organization.where( id: organization_id ).first assert( !found, 'Organization destroyed') } end diff --git a/test/unit/notification_factory_test.rb b/test/unit/notification_factory_test.rb index 64bfb652c..4f1ebbfb8 100644 --- a/test/unit/notification_factory_test.rb +++ b/test/unit/notification_factory_test.rb @@ -4,30 +4,30 @@ require 'test_helper' class NotificationFactoryTest < ActiveSupport::TestCase test 'notifications send' do result = NotificationFactory.send( - :recipient => User.find(2), - :subject => 'sime subject', - :body => 'some body', - :content_type => '', + recipient: User.find(2), + subject: 'sime subject', + body: 'some body', + content_type: '', ) assert_match('some body', result.to_s) assert_match('text/plain', result.to_s) assert_no_match('text/html', result.to_s) result = NotificationFactory.send( - :recipient => User.find(2), - :subject => 'sime subject', - :body => 'some body', - :content_type => 'text/plain', + recipient: User.find(2), + subject: 'sime subject', + body: 'some body', + content_type: 'text/plain', ) assert_match('some body', result.to_s) assert_match('text/plain', result.to_s) assert_no_match('text/html', result.to_s) result = NotificationFactory.send( - :recipient => User.find(2), - :subject => 'sime subject', - :body => 'some body', - :content_type => 'text/html', + recipient: User.find(2), + subject: 'sime subject', + body: 'some body', + content_type: 'text/html', ) assert_match('some body', result.to_s) assert_match('text/plain', result.to_s) @@ -37,120 +37,120 @@ class NotificationFactoryTest < ActiveSupport::TestCase test 'notifications base' do ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 2, - :created_by_id => 2, + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 2, + created_by_id: 2, ) article_plain = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id, - :sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id, - :from => 'Zammad Feedback ', - :body => 'some text', - :internal => false, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where(name: 'phone' ).first.id, + sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id, + from: 'Zammad Feedback ', + body: 'some text', + internal: false, + updated_by_id: 1, + created_by_id: 1, ) tests = [ { - :locale => 'en', - :string => 'Hi #{recipient.firstname},', - :result => 'Hi Nicole,', + locale: 'en', + string: 'Hi #{recipient.firstname},', + result: 'Hi Nicole,', }, { - :locale => 'de-de', - :string => 'Hi #{recipient.firstname},', - :result => 'Hi Nicole,', + locale: 'de-de', + string: 'Hi #{recipient.firstname},', + result: 'Hi Nicole,', }, { - :locale => 'de-de', - :string => 'Hi #{recipient.firstname}, Group: #{ticket.group.name}', - :result => 'Hi Nicole, Group: Users', + locale: 'de-de', + string: 'Hi #{recipient.firstname}, Group: #{ticket.group.name}', + result: 'Hi Nicole, Group: Users', }, { - :locale => 'de-de', - :string => '#{config.http_type} some text', - :result => 'http some text', + locale: 'de-de', + string: '#{config.http_type} some text', + result: 'http some text', }, { - :locale => 'de-de', - :string => 'i18n(New) some text', - :result => 'Neu some text', + locale: 'de-de', + string: 'i18n(New) some text', + result: 'Neu some text', }, { - :locale => 'de-de', - :string => '\'i18n(#{ticket.state.name})\' ticket state', - :result => '\'neu\' ticket state', + locale: 'de-de', + string: '\'i18n(#{ticket.state.name})\' ticket state', + result: '\'neu\' ticket state', }, { - :locale => 'de-de', - :string => 'a #{not_existing_object.test}', - :result => 'a #{not_existing_object / no such object}', + locale: 'de-de', + string: 'a #{not_existing_object.test}', + result: 'a #{not_existing_object / no such object}', }, { - :locale => 'de-de', - :string => 'a #{ticket.level1}', - :result => 'a #{ticket.level1 / no such method}', + locale: 'de-de', + string: 'a #{ticket.level1}', + result: 'a #{ticket.level1 / no such method}', }, { - :locale => 'de-de', - :string => 'a #{ticket.level1.level2}', - :result => 'a #{ticket.level1 / no such method}', + locale: 'de-de', + string: 'a #{ticket.level1.level2}', + result: 'a #{ticket.level1 / no such method}', }, { - :locale => 'de-de', - :string => 'a #{ticket.title.level2}', - :result => 'a #{ticket.title.level2 / no such method}', + locale: 'de-de', + string: 'a #{ticket.title.level2}', + result: 'a #{ticket.title.level2 / no such method}', }, { - :locale => 'de-de', - :string => 'by #{ticket.updated_by.fullname}', - :result => 'by Nicole Braun', + locale: 'de-de', + string: 'by #{ticket.updated_by.fullname}', + result: 'by Nicole Braun', }, { - :locale => 'de-de', - :string => 'Subject #{article.from}, Group: #{ticket.group.name}', - :result => 'Subject Zammad Feedback , Group: Users', + locale: 'de-de', + string: 'Subject #{article.from}, Group: #{ticket.group.name}', + result: 'Subject Zammad Feedback , Group: Users', }, { - :locale => 'de-de', - :string => 'Body #{article.body}, Group: #{ticket.group.name}', - :result => 'Body some text, Group: Users', + locale: 'de-de', + string: 'Body #{article.body}, Group: #{ticket.group.name}', + result: 'Body some text, Group: Users', }, { - :locale => 'de-de', - :string => '\#{puts `ls`}', - :result => '\#{puts `ls`} (not allowed)', + locale: 'de-de', + string: '\#{puts `ls`}', + result: '\#{puts `ls`} (not allowed)', }, { - :locale => 'de-de', - :string => 'test i18n(new)', - :result => 'test neu', + locale: 'de-de', + string: 'test i18n(new)', + result: 'test neu', }, { - :locale => 'de-de', - :string => 'test i18n()', - :result => 'test ', + locale: 'de-de', + string: 'test i18n()', + result: 'test ', }, { - :locale => 'de-de', - :string => 'test i18n(new) i18n(open)', - :result => 'test neu offen', + locale: 'de-de', + string: 'test i18n(new) i18n(open)', + result: 'test neu offen', }, ] tests.each { |test| result = NotificationFactory.build( - :string => test[:string], - :objects => { - :ticket => ticket, - :article => article_plain, - :recipient => User.find(2), + string: test[:string], + objects: { + ticket: ticket, + article: article_plain, + recipient: User.find(2), }, - :locale => test[:locale] + locale: test[:locale] ) assert_equal( test[:result], result, 'verify result' ) } @@ -160,52 +160,52 @@ class NotificationFactoryTest < ActiveSupport::TestCase test 'notifications html' do ticket = Ticket.create( - :title => 'some title äöüß 2', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß 2', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) article_html = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id, - :sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id, - :from => 'Zammad Feedback ', - :body => 'some text
next line', - :content_type => 'text/html', - :internal => false, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where(name: 'phone' ).first.id, + sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id, + from: 'Zammad Feedback ', + body: 'some text
next line', + content_type: 'text/html', + internal: false, + updated_by_id: 1, + created_by_id: 1, ) tests = [ { - :locale => 'de-de', - :string => 'Subject #{ticket.title}', - :result => 'Subject some title äöüß 2', + locale: 'de-de', + string: 'Subject #{ticket.title}', + result: 'Subject some title äöüß 2', }, { - :locale => 'de-de', - :string => 'Subject #{article.from}, Group: #{ticket.group.name}', - :result => 'Subject Zammad Feedback , Group: Users', + locale: 'de-de', + string: 'Subject #{article.from}, Group: #{ticket.group.name}', + result: 'Subject Zammad Feedback , Group: Users', }, { - :locale => 'de-de', - :string => 'Body #{article.body}, Group: #{ticket.group.name}', - :result => 'Body some text + locale: 'de-de', + string: 'Body #{article.body}, Group: #{ticket.group.name}', + result: 'Body some text next line, Group: Users', }, ] tests.each { |test| result = NotificationFactory.build( - :string => test[:string], - :objects => { - :ticket => ticket, - :article => article_html, - :recipient => User.find(2), + string: test[:string], + objects: { + ticket: ticket, + article: article_html, + recipient: User.find(2), }, - :locale => test[:locale] + locale: test[:locale] ) assert_equal( test[:result], result, 'verify result' ) } @@ -215,78 +215,78 @@ next line, Group: Users', test 'notifications attack' do ticket = Ticket.create( - :title => 'some title äöüß 3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß 3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) article_html = Ticket::Article.create( - :ticket_id => ticket.id, - :type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id, - :sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id, - :from => 'Zammad Feedback ', - :body => 'some text
next line', - :content_type => 'text/html', - :internal => false, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.where(name: 'phone' ).first.id, + sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id, + from: 'Zammad Feedback ', + body: 'some text
next line', + content_type: 'text/html', + internal: false, + updated_by_id: 1, + created_by_id: 1, ) tests = [ { - :locale => 'de-de', - :string => '\#{puts `ls`}', - :result => '\#{puts `ls`} (not allowed)', + locale: 'de-de', + string: '\#{puts `ls`}', + result: '\#{puts `ls`} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article.destroy}', - :result => 'attack#1 #{article.destroy} (not allowed)', + locale: 'de-de', + string: 'attack#1 #{article.destroy}', + result: 'attack#1 #{article.destroy} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#2 #{Article.where}', - :result => 'attack#2 #{Article.where} (not allowed)', + locale: 'de-de', + string: 'attack#2 #{Article.where}', + result: 'attack#2 #{Article.where} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article. + locale: 'de-de', + string: 'attack#1 #{article. destroy}', - :result => 'attack#1 #{article. + result: 'attack#1 #{article. destroy} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article.find}', - :result => 'attack#1 #{article.find} (not allowed)', + locale: 'de-de', + string: 'attack#1 #{article.find}', + result: 'attack#1 #{article.find} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article.update(:name => "test")}', - :result => 'attack#1 #{article.update(:name => "test")} (not allowed)', + locale: 'de-de', + string: 'attack#1 #{article.update(:name => "test")}', + result: 'attack#1 #{article.update(:name => "test")} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article.all}', - :result => 'attack#1 #{article.all} (not allowed)', + locale: 'de-de', + string: 'attack#1 #{article.all}', + result: 'attack#1 #{article.all} (not allowed)', }, { - :locale => 'de-de', - :string => 'attack#1 #{article.delete}', - :result => 'attack#1 #{article.delete} (not allowed)', + locale: 'de-de', + string: 'attack#1 #{article.delete}', + result: 'attack#1 #{article.delete} (not allowed)', }, ] tests.each { |test| result = NotificationFactory.build( - :string => test[:string], - :objects => { - :ticket => ticket, - :article => article_html, - :recipient => User.find(2), + string: test[:string], + objects: { + ticket: ticket, + article: article_html, + recipient: User.find(2), }, - :locale => test[:locale] + locale: test[:locale] ) assert_equal( test[:result], result, 'verify result' ) } diff --git a/test/unit/object_cache_test.rb b/test/unit/object_cache_test.rb index d0fbc09bc..93280cda6 100644 --- a/test/unit/object_cache_test.rb +++ b/test/unit/object_cache_test.rb @@ -6,53 +6,53 @@ class ObjectCacheTest < ActiveSupport::TestCase name = 'object cache test ' + rand(9_999_999).to_s group = Group.create( - :name => name, - :updated_by_id => 1, - :created_by_id => 1, + name: name, + updated_by_id: 1, + created_by_id: 1, ) - group_where = Group.where( :name => name ).first + group_where = Group.where( name: name ).first assert_equal( name, group_where[:name], 'verify by where' ) - group_lookup_name = Group.lookup( :name => name ) + group_lookup_name = Group.lookup( name: name ) assert_equal( name, group_lookup_name[:name], 'verify by lookup.name' ) - group_lookup_id = Group.lookup( :id => group.id ) + group_lookup_id = Group.lookup( id: group.id ) assert_equal( name, group_lookup_id[:name], 'verify by lookup.id' ) name_new = name + ' next' group.name = name_new group.save - group_where = Group.where( :name => name ).first + group_where = Group.where( name: name ).first assert_equal( nil, group_where, 'verify by where name_old' ) - group_where = Group.where( :name => name_new ).first + group_where = Group.where( name: name_new ).first assert_equal( name_new, group_where[:name], 'verify by where name_new' ) - group_lookup_name = Group.lookup( :name => name ) + group_lookup_name = Group.lookup( name: name ) assert_equal( nil, group_lookup_name, 'verify by lookup.name name_old' ) - group_lookup_name = Group.lookup( :name => name_new ) + group_lookup_name = Group.lookup( name: name_new ) assert_equal( name_new, group_lookup_name[:name], 'verify by lookup.name name_new' ) - group_lookup_id = Group.lookup( :id => group.id ) + group_lookup_id = Group.lookup( id: group.id ) assert_equal( name_new, group_lookup_id[:name], 'verify by lookup.id' ) group.destroy - group_where = Group.where( :name => name ).first + group_where = Group.where( name: name ).first assert_equal( nil, group_where, 'verify by where name_old' ) - group_where = Group.where( :name => name_new ).first + group_where = Group.where( name: name_new ).first assert_equal( nil, group_where, 'verify by where name_new' ) - group_lookup_name = Group.lookup( :name => name ) + group_lookup_name = Group.lookup( name: name ) assert_equal( nil, group_lookup_name, 'verify by lookup.name name_old' ) - group_lookup_name = Group.lookup( :name => name_new ) + group_lookup_name = Group.lookup( name: name_new ) assert_equal( nil, group_lookup_name, 'verify by lookup.name name_new' ) - group_lookup_id = Group.lookup( :id => group.id ) + group_lookup_id = Group.lookup( id: group.id ) assert_equal( nil, group_lookup_id, 'verify by lookup.id' ) end diff --git a/test/unit/online_notifiaction_test.rb b/test/unit/online_notifiaction_test.rb index f970d1a6a..172001f3f 100644 --- a/test/unit/online_notifiaction_test.rb +++ b/test/unit/online_notifiaction_test.rb @@ -2,237 +2,237 @@ require 'test_helper' class OnlineNotificationTest < ActiveSupport::TestCase - role = Role.lookup( :name => 'Agent' ) - group = Group.lookup( :name => 'Users' ) + role = Role.lookup( name: 'Agent' ) + group = Group.lookup( name: 'Users' ) agent_user1 = User.create_or_update( - :login => 'agent_online_notify1', - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'agent_online_notify1@example.com', - :password => 'some_pass', - :active => true, - :role_ids => [role.id], - :group_ids => [group.id], - :updated_by_id => 1, - :created_by_id => 1 + login: 'agent_online_notify1', + firstname: 'Bob', + lastname: 'Smith', + email: 'agent_online_notify1@example.com', + password: 'some_pass', + active: true, + role_ids: [role.id], + group_ids: [group.id], + updated_by_id: 1, + created_by_id: 1 ) agent_user2 = User.create_or_update( - :login => 'agent_online_notify2', - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'agent_online_notify2@example.com', - :password => 'some_pass', - :active => true, - :role_ids => [role.id], - :group_ids => [group.id], - :updated_by_id => 1, - :created_by_id => 1 + login: 'agent_online_notify2', + firstname: 'Bob', + lastname: 'Smith', + email: 'agent_online_notify2@example.com', + password: 'some_pass', + active: true, + role_ids: [role.id], + group_ids: [group.id], + updated_by_id: 1, + created_by_id: 1 ) - customer_user = User.lookup( :login => 'nicole.braun@zammad.org' ) + customer_user = User.lookup( login: 'nicole.braun@zammad.org' ) test 'ticket notifiaction' do tests = [ # test 1 { - :create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => customer_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 1 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'closed' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, + create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: customer_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup( name: 'closed' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, }, - :article => { - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, - :online_notification => { - :seen_only_exists => true, + online_notification: { + seen_only_exists: true, }, }, - :update => { - :ticket => { - :title => 'Unit Test 1 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, - :updated_by_id => customer_user.id, + update: { + ticket: { + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, + updated_by_id: customer_user.id, }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :check => [ + check: [ { - :type => 'create', - :object => 'Ticket', - :created_by_id => agent_user1.id, + type: 'create', + object: 'Ticket', + created_by_id: agent_user1.id, }, { - :type => 'update', - :object => 'Ticket', - :created_by_id => customer_user.id, + type: 'update', + object: 'Ticket', + created_by_id: customer_user.id, }, ], }, # test 2 { - :create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => customer_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 2 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, + create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: customer_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 2 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, }, - :article => { - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :update => { - :ticket => { - :title => 'Unit Test 2 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'closed' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, - :updated_by_id => customer_user.id, + update: { + ticket: { + title: 'Unit Test 2 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'closed' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, + updated_by_id: customer_user.id, }, - :online_notification => { - :seen_only_exists => true, + online_notification: { + seen_only_exists: true, }, }, - :check => [ + check: [ { - :type => 'create', - :object => 'Ticket', - :created_by_id => agent_user1.id, + type: 'create', + object: 'Ticket', + created_by_id: agent_user1.id, }, { - :type => 'update', - :object => 'Ticket', - :created_by_id => customer_user.id, + type: 'update', + object: 'Ticket', + created_by_id: customer_user.id, }, ], }, # test 3 { - :create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => customer_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 3 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, + create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: customer_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 3 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, }, - :article => { - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :update => { - :ticket => { - :title => 'Unit Test 3 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, - :updated_by_id => customer_user.id, + update: { + ticket: { + title: 'Unit Test 3 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, + updated_by_id: customer_user.id, }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :check => [ + check: [ { - :type => 'create', - :object => 'Ticket', - :created_by_id => agent_user1.id, + type: 'create', + object: 'Ticket', + created_by_id: agent_user1.id, }, { - :type => 'update', - :object => 'Ticket', - :created_by_id => customer_user.id, + type: 'update', + object: 'Ticket', + created_by_id: customer_user.id, }, ], }, # test 4 { - :create => { - :ticket => { - :group_id => Group.lookup( :name => 'Users' ).id, - :customer_id => customer_user.id, - :owner_id => User.lookup( :login => '-' ).id, - :title => 'Unit Test 4 (äöüß)!', - :state_id => Ticket::State.lookup( :name => 'new' ).id, - :priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id, - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, + create: { + ticket: { + group_id: Group.lookup( name: 'Users' ).id, + customer_id: customer_user.id, + owner_id: User.lookup( login: '-' ).id, + title: 'Unit Test 4 (äöüß)!', + state_id: Ticket::State.lookup( name: 'new' ).id, + priority_id: Ticket::Priority.lookup( name: '2 normal' ).id, + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, }, - :article => { - :updated_by_id => agent_user1.id, - :created_by_id => agent_user1.id, - :type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id, - :sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id, - :from => 'Unit Test ', - :body => 'Unit Test 123', - :internal => false + article: { + updated_by_id: agent_user1.id, + created_by_id: agent_user1.id, + type_id: Ticket::Article::Type.lookup( name: 'phone' ).id, + sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :update => { - :ticket => { - :title => 'Unit Test 4 (äöüß) - update!', - :state_id => Ticket::State.lookup( :name => 'open' ).id, - :priority_id => Ticket::Priority.lookup( :name => '1 low' ).id, - :updated_by_id => customer_user.id, + update: { + ticket: { + title: 'Unit Test 4 (äöüß) - update!', + state_id: Ticket::State.lookup( name: 'open' ).id, + priority_id: Ticket::Priority.lookup( name: '1 low' ).id, + updated_by_id: customer_user.id, }, - :online_notification => { - :seen_only_exists => false, + online_notification: { + seen_only_exists: false, }, }, - :check => [ + check: [ { - :type => 'create', - :object => 'Ticket', - :created_by_id => agent_user1.id, + type: 'create', + object: 'Ticket', + created_by_id: agent_user1.id, }, { - :type => 'update', - :object => 'Ticket', - :created_by_id => customer_user.id, + type: 'update', + object: 'Ticket', + created_by_id: customer_user.id, }, ], }, @@ -295,8 +295,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # merge tickets - also remove notifications of merged tickets tickets[2].merge_to( - :ticket_id => tickets[3].id, - :user_id => 1, + ticket_id: tickets[3].id, + user_id: 1, ) notifications = OnlineNotification.list_by_object( 'Ticket', tickets[2].id ) assert( !notifications.empty?, 'should have notifications') @@ -310,7 +310,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase tickets.each { |ticket| ticket_id = ticket.id ticket.destroy - found = Ticket.where( :id => ticket_id ).first + found = Ticket.where( id: ticket_id ).first assert( !found, 'Ticket destroyed') # check if notifications for ticket still exist diff --git a/test/unit/organization_ref_object_touch_test.rb b/test/unit/organization_ref_object_touch_test.rb index 567c4a165..0627dcc0a 100644 --- a/test/unit/organization_ref_object_touch_test.rb +++ b/test/unit/organization_ref_object_touch_test.rb @@ -4,72 +4,72 @@ require 'test_helper' class OrganizationRefObjectTouchTest < ActiveSupport::TestCase # create base - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent1 = User.create_or_update( - :login => 'organization-ref-object-update-agent1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'organization-ref-object-update-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'organization-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) organization1 = Organization.create_if_not_exists( - :name => 'Ref Object Update Org 1', - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Ref Object Update Org 1', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) organization2 = Organization.create_if_not_exists( - :name => 'Ref Object Update Org 2', - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Ref Object Update Org 2', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer1 = User.create_or_update( - :login => 'organization-ref-object-update-customer1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'organization-ref-object-update-customer1@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'organization-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - :login => 'organization-ref-object-update-customer2@example.com', - :firstname => 'Notification', - :lastname => 'Agent2', - :email => 'organization-ref-object-update-customer2@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization2.id, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'organization-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'organization-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, + organization_id: organization2.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) test 'a - check if ticket and customer has been updated' do ticket = Ticket.create( - :title => "some title1\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer1.id, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title1\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.customer.id, customer1.id ) diff --git a/test/unit/package_test.rb b/test/unit/package_test.rb index 8a61c38fd..75d263a35 100644 --- a/test/unit/package_test.rb +++ b/test/unit/package_test.rb @@ -7,7 +7,7 @@ class PackageTest < ActiveSupport::TestCase # test 1 - normal install { - :zpm => ' + zpm: ' UnitTestSample 1.0.1 @@ -26,25 +26,25 @@ bnVsbCA9PiB0cnVlDQogICAgZW5kDQogIGVuZA0KDQogIGRlZiBzZWxmLmRvd24NCiAgICBkcm9w X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k ', - :action => 'install', - :result => true, - :verify => { - :package => { - :name => 'UnitTestSample', - :version => '1.0.1', + action: 'install', + result: true, + verify: { + package: { + name: 'UnitTestSample', + version: '1.0.1', }, - :check_files => [ + check_files: [ { - :location => 'test.txt', - :result => true, + location: 'test.txt', + result: true, }, { - :location => 'test2.txt', - :result => false, + location: 'test2.txt', + result: false, }, { - :location => 'some/dir/test.txt', - :result => true, + location: 'some/dir/test.txt', + result: true, }, ], }, @@ -52,7 +52,7 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k # test 2 - try to install same package again / should not work { - :zpm => ' + zpm: ' UnitTestSample 1.0.1 @@ -64,13 +64,13 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k YWJjw6TDtsO8w58= ', - :action => 'install', - :result => false, + action: 'install', + result: false, }, # test 3 - try to install lower version / should not work { - :zpm => ' + zpm: ' UnitTestSample 1.0.0 @@ -82,13 +82,13 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k YWJjw6TDtsO8w58= ', - :action => 'install', - :result => false, + action: 'install', + result: false, }, # test 4 - upgrade 7 should work { - :zpm => ' + zpm: ' UnitTestSample 1.0.2 @@ -107,29 +107,29 @@ bnVsbCA9PiB0cnVlDQogICAgZW5kDQogIGVuZA0KDQogIGRlZiBzZWxmLmRvd24NCiAgICBkcm9w X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k ', - :action => 'install', - :result => true, - :verify => { - :package => { - :name => 'UnitTestSample', - :version => '1.0.2', + action: 'install', + result: true, + verify: { + package: { + name: 'UnitTestSample', + version: '1.0.2', }, - :check_files => [ + check_files: [ { - :location => 'test.txt2', - :result => true, + location: 'test.txt2', + result: true, }, { - :location => 'test.txt', - :result => false, + location: 'test.txt', + result: false, }, { - :location => 'test2.txt', - :result => false, + location: 'test2.txt', + result: false, }, { - :location => 'some/dir/test.txt2', - :result => true, + location: 'some/dir/test.txt2', + result: true, }, ], }, @@ -137,19 +137,19 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k # test 4 - uninstall package / should work { - :name => 'UnitTestSample', - :version => '1.0.2', - :action => 'uninstall', - :result => true, - :verify => { - :check_files => [ + name: 'UnitTestSample', + version: '1.0.2', + action: 'uninstall', + result: true, + verify: { + check_files: [ { - :location => 'test.txt', - :result => false, + location: 'test.txt', + result: false, }, { - :location => 'test2.txt', - :result => false, + location: 'test2.txt', + result: false, }, ], }, @@ -157,7 +157,7 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k # test 5 - check auto_install mechanism { - :zpm => ' + zpm: ' UnitTestSample 1.0.2 @@ -176,29 +176,29 @@ bnVsbCA9PiB0cnVlDQogICAgZW5kDQogIGVuZA0KDQogIGRlZiBzZWxmLmRvd24NCiAgICBkcm9w X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k ', - :action => 'auto_install', - :result => true, - :verify => { - :package => { - :name => 'UnitTestSample', - :version => '1.0.2', + action: 'auto_install', + result: true, + verify: { + package: { + name: 'UnitTestSample', + version: '1.0.2', }, - :check_files => [ + check_files: [ { - :location => 'test.txt2', - :result => true, + location: 'test.txt2', + result: true, }, { - :location => 'test.txt', - :result => false, + location: 'test.txt', + result: false, }, { - :location => 'test2.txt', - :result => false, + location: 'test2.txt', + result: false, }, { - :location => 'some/dir/test.txt2', - :result => true, + location: 'some/dir/test.txt2', + result: true, }, ], }, @@ -206,19 +206,19 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k # test 6 - check uninstall / should work { - :name => 'UnitTestSample', - :version => '1.0.2', - :action => 'uninstall', - :result => true, - :verify => { - :check_files => [ + name: 'UnitTestSample', + version: '1.0.2', + action: 'uninstall', + result: true, + verify: { + check_files: [ { - :location => 'test.txt', - :result => false, + location: 'test.txt', + result: false, }, { - :location => 'test2.txt', - :result => false, + location: 'test2.txt', + result: false, }, ], }, @@ -228,7 +228,7 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k tests.each { |test| if test[:action] == 'install' begin - success = Package.install( :string => test[:zpm] ) + success = Package.install( string: test[:zpm] ) rescue => e puts 'ERROR: ' + e.inspect success = false @@ -241,13 +241,13 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k elsif test[:action] == 'uninstall' if test[:zpm] begin - success = Package.uninstall( :string => test[:zpm] ) + success = Package.uninstall( string: test[:zpm] ) rescue success = false end else begin - success = Package.uninstall( :name => test[:name], :version => test[:version] ) + success = Package.uninstall( name: test[:name], version: test[:version] ) rescue success = false end @@ -277,7 +277,7 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k end end if test[:verify] && test[:verify][:package] - exists = Package.where( :name => test[:verify][:package][:name], :version => test[:verify][:package][:version] ).first + exists = Package.where( name: test[:verify][:package][:name], version: test[:verify][:package][:version] ).first assert( exists, "package '#{test[:verify][:package][:name]}' is not installed" ) end if test[:verify] && test[:verify][:check_files] diff --git a/test/unit/recent_view_test.rb b/test/unit/recent_view_test.rb index 5cfad3ada..9e4879865 100644 --- a/test/unit/recent_view_test.rb +++ b/test/unit/recent_view_test.rb @@ -6,23 +6,23 @@ class RecentViewTest < ActiveSupport::TestCase test 'simple tests' do ticket1 = Ticket.create( - :title => 'RecentViewTest 1 some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'RecentViewTest 1 some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket1, 'ticket created' ) ticket2 = Ticket.create( - :title => 'RecentViewTest 2 some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'RecentViewTest 2 some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket2, 'ticket created' ) user1 = User.find(2) @@ -90,36 +90,36 @@ class RecentViewTest < ActiveSupport::TestCase test 'permission tests' do customer = User.find(2) - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent = User.create_or_update( - :login => 'recent-viewed-agent@example.com', - :firstname => 'RecentViewed', - :lastname => 'Agent', - :email => 'recent-viewed-agent@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_by_id => 1, - :created_by_id => 1, + login: 'recent-viewed-agent@example.com', + firstname: 'RecentViewed', + lastname: 'Agent', + email: 'recent-viewed-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_by_id: 1, + created_by_id: 1, ) Group.create_if_not_exists( - :name => 'WithoutAccess', - :note => 'Test for not access check.', - :updated_by_id => 1, - :created_by_id => 1 + name: 'WithoutAccess', + note: 'Test for not access check.', + updated_by_id: 1, + created_by_id: 1 ) # no access for customer ticket1 = Ticket.create( - :title => 'RecentViewTest 1 some title äöüß', - :group => Group.lookup( :name => 'WithoutAccess'), - :customer_id => 1, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'RecentViewTest 1 some title äöüß', + group: Group.lookup( name: 'WithoutAccess'), + customer_id: 1, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket1, 'ticket created' ) @@ -142,13 +142,13 @@ class RecentViewTest < ActiveSupport::TestCase # access for customer via customer id ticket1 = Ticket.create( - :title => 'RecentViewTest 1 some title äöüß', - :group => Group.lookup( :name => 'WithoutAccess'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'RecentViewTest 1 some title äöüß', + group: Group.lookup( name: 'WithoutAccess'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket1, 'ticket created' ) diff --git a/test/unit/rest_test.rb b/test/unit/rest_test.rb index 48432f2de..31f4cb1ea 100644 --- a/test/unit/rest_test.rb +++ b/test/unit/rest_test.rb @@ -11,67 +11,67 @@ class RestTest < ActiveSupport::TestCase end # create agent - roles = Role.where( :name => ['Admin', 'Agent'] ) + roles = Role.where( name: ['Admin', 'Agent'] ) groups = Group.all UserInfo.current_user_id = 1 admin = User.create_or_update( - :login => 'rest-admin', - :firstname => 'Rest', - :lastname => 'Agent', - :email => 'rest-admin@example.com', - :password => 'adminpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'rest-admin', + firstname: 'Rest', + lastname: 'Agent', + email: 'rest-admin@example.com', + password: 'adminpw', + active: true, + roles: roles, + groups: groups, ) # create agent - roles = Role.where( :name => 'Agent' ) + roles = Role.where( name: 'Agent' ) agent = User.create_or_update( - :login => 'rest-agent@example.com', - :firstname => 'Rest', - :lastname => 'Agent', - :email => 'rest-agent@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'rest-agent@example.com', + firstname: 'Rest', + lastname: 'Agent', + email: 'rest-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) # create customer without org - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) customer_without_org = User.create_or_update( - :login => 'rest-customer1@example.com', - :firstname => 'Rest', - :lastname => 'Customer1', - :email => 'rest-customer1@example.com', - :password => 'customer1pw', - :active => true, - :roles => roles, + login: 'rest-customer1@example.com', + firstname: 'Rest', + lastname: 'Customer1', + email: 'rest-customer1@example.com', + password: 'customer1pw', + active: true, + roles: roles, ) # create orgs organization = Organization.create_or_update( - :name => 'Rest Org', + name: 'Rest Org', ) organization2 = Organization.create_or_update( - :name => 'Rest Org #2', + name: 'Rest Org #2', ) organization3 = Organization.create_or_update( - :name => 'Rest Org #3', + name: 'Rest Org #3', ) # create customer with org customer_with_org = User.create_or_update( - :login => 'rest-customer2@example.com', - :firstname => 'Rest', - :lastname => 'Customer2', - :email => 'rest-customer2@example.com', - :password => 'customer2pw', - :active => true, - :roles => roles, - :organization_id => organization.id, + login: 'rest-customer2@example.com', + firstname: 'Rest', + lastname: 'Customer2', + email: 'rest-customer2@example.com', + password: 'customer2pw', + active: true, + roles: roles, + organization_id: organization.id, ) # not existing user @@ -233,15 +233,15 @@ class RestTest < ActiveSupport::TestCase "#{ENV['BROWSER_URL']}#{url}", {}, { - :json => true, - :user => user, - :password => pw, + json: true, + user: user, + password: pw, } ) #puts 'URL: ' + url #puts response.code.to_s #puts response.body.to_s - return { :data => response.data, :response => response } + return { data: response.data, response: response } end end diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb index 7b12e562d..2fc126158 100644 --- a/test/unit/session_basic_test.rb +++ b/test/unit/session_basic_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class SessionBasicTest < ActiveSupport::TestCase test 'a cache' do - Sessions::CacheIn.set( 'last_run_test' , true, { :expires_in => 2.seconds } ) + Sessions::CacheIn.set( 'last_run_test' , true, { expires_in: 2.seconds } ) result = Sessions::CacheIn.get( 'last_run_test' ) assert_equal( true, result, 'check 1' ) @@ -17,7 +17,7 @@ class SessionBasicTest < ActiveSupport::TestCase assert_equal( true, result, 'check 1 - expired' ) # renew expire - result = Sessions::CacheIn.get( 'last_run_test', :re_expire => true ) + result = Sessions::CacheIn.get( 'last_run_test', re_expire: true ) assert_equal( true, result, 'check 1 - re_expire' ) # should not be expired @@ -26,7 +26,7 @@ class SessionBasicTest < ActiveSupport::TestCase # ignore expired sleep 3 - result = Sessions::CacheIn.get( 'last_run_test', :ignore_expire => true ) + result = Sessions::CacheIn.get( 'last_run_test', ignore_expire: true ) assert_equal( true, result, 'check 1 - ignore_expire' ) # should be expired @@ -37,7 +37,7 @@ class SessionBasicTest < ActiveSupport::TestCase assert_equal( nil, result, 'check 2' ) # check delete cache - Sessions::CacheIn.set( 'last_run_delete' , true, { :expires_in => 5.seconds } ) + Sessions::CacheIn.set( 'last_run_delete' , true, { expires_in: 5.seconds } ) result = Sessions::CacheIn.get( 'last_run_delete' ) assert_equal( true, result, 'check 1' ) Sessions::CacheIn.delete( 'last_run_delete' ) @@ -49,7 +49,7 @@ class SessionBasicTest < ActiveSupport::TestCase require 'sessions/backend/collections/group.rb' UserInfo.current_user_id = 2 - user = User.lookup(:id => 1) + user = User.lookup(id: 1) collection_client1 = Sessions::Backend::Collections::Group.new(user, false, '123-1', 3) collection_client2 = Sessions::Backend::Collections::Group.new(user, false, '234-2', 3) @@ -88,7 +88,7 @@ class SessionBasicTest < ActiveSupport::TestCase assert_equal( result1, result2, 'check collections' ) # change collection - group = Group.create( :name => 'SomeGroup::' + rand(999_999).to_s, :active => true ) + group = Group.create( name: 'SomeGroup::' + rand(999_999).to_s, active: true ) sleep 4 # get whole collections @@ -126,16 +126,16 @@ class SessionBasicTest < ActiveSupport::TestCase assert_equal( result1, result2, 'check collections' ) end - user = User.lookup(:id => 1) - roles = Role.where( :name => [ 'Agent', 'Admin'] ) + user = User.lookup(id: 1) + roles = Role.where( name: [ 'Agent', 'Admin'] ) user.roles = roles user.save test 'b collections organization' do require 'sessions/backend/collections/organization.rb' UserInfo.current_user_id = 2 - user = User.lookup(:id => 1) - org = Organization.create( :name => 'SomeOrg1::' + rand(999_999).to_s, :active => true ) + user = User.lookup(id: 1) + 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(999_999).to_s, :active => true ) + org = Organization.create( name: 'SomeOrg2::' + rand(999_999).to_s, active: true ) sleep 4 # get whole collections @@ -186,7 +186,7 @@ class SessionBasicTest < ActiveSupport::TestCase end test 'b rss' do - user = User.lookup(:id => 1) + user = User.lookup(id: 1) collection_client1 = Sessions::Backend::Rss.new(user, false, '123-1') # get whole collections @@ -204,19 +204,19 @@ class SessionBasicTest < ActiveSupport::TestCase test 'b activity stream' do # create users - roles = Role.where( :name => [ 'Agent', 'Admin'] ) + roles = Role.where( name: [ 'Agent', 'Admin'] ) groups = Group.all UserInfo.current_user_id = 2 agent1 = User.create_or_update( - :login => 'activity-stream-agent-1', - :firstname => 'Session', - :lastname => 'activity stream ' + rand(99_999).to_s, - :email => 'activity-stream-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'activity-stream-agent-1', + firstname: 'Session', + lastname: 'activity stream ' + rand(99_999).to_s, + email: 'activity-stream-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles assert( agent1.save, 'create/update agent1' ) @@ -238,7 +238,7 @@ class SessionBasicTest < ActiveSupport::TestCase assert( !result1, 'check as agent1 - recall 2' ) agent1.update_attribute( :email, 'activity-stream-agent11@example.com' ) - ticket = Ticket.create(:title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) + ticket = Ticket.create(title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 ) sleep 4 @@ -250,7 +250,7 @@ class SessionBasicTest < ActiveSupport::TestCase test 'b ticket_create' do UserInfo.current_user_id = 2 - user = User.lookup(:id => 1) + user = User.lookup(id: 1) ticket_create_client1 = Sessions::Backend::TicketCreate.new(user, false, '123-1', 3) # get as stream @@ -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(999_999).to_s, :active => true ) + Group.create( name: 'SomeTicketCreateGroup::' + rand(999_999).to_s, active: true ) sleep 4 diff --git a/test/unit/session_basic_ticket_test.rb b/test/unit/session_basic_ticket_test.rb index a98b9e12a..c015429ef 100644 --- a/test/unit/session_basic_ticket_test.rb +++ b/test/unit/session_basic_ticket_test.rb @@ -7,23 +7,23 @@ class SessionBasicTicketTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 # create users - roles = Role.where( :name => [ 'Agent' ] ) + roles = Role.where( name: [ 'Agent' ] ) groups = Group.all agent1 = User.create_or_update( - :login => 'activity-stream-agent-1', - :firstname => 'Session', - :lastname => 'activity stream ' + rand(99_999).to_s, - :email => 'activity-stream-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'activity-stream-agent-1', + firstname: 'Session', + lastname: 'activity stream ' + rand(99_999).to_s, + email: 'activity-stream-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles assert( agent1.save, 'create/update agent1' ) - user = User.lookup( :id => agent1.id ) + user = User.lookup( id: agent1.id ) client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1', 3) # get as stream @@ -40,7 +40,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase assert( !result1, 'check ticket_overview_index - recall 2' ) # create ticket - ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) + ticket = Ticket.create( title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 ) sleep 4 # get as stream @@ -53,23 +53,23 @@ class SessionBasicTicketTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 # create users - roles = Role.where( :name => [ 'Agent' ] ) + roles = Role.where( name: [ 'Agent' ] ) groups = Group.all agent1 = User.create_or_update( - :login => 'activity-stream-agent-1', - :firstname => 'Session', - :lastname => 'activity stream ' + rand(99_999).to_s, - :email => 'activity-stream-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'activity-stream-agent-1', + firstname: 'Session', + lastname: 'activity stream ' + rand(99_999).to_s, + email: 'activity-stream-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles assert( agent1.save, 'create/update agent1' ) - user = User.lookup( :id => agent1.id ) + user = User.lookup( id: agent1.id ) client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1', 3) @@ -87,7 +87,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase assert( !result1, 'check ticket_overview_list - recall 2' ) # create ticket - ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 ) + ticket = Ticket.create( title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1 ) sleep 4 # get as stream diff --git a/test/unit/session_collections_test.rb b/test/unit/session_collections_test.rb index 4e125e5dc..05762ce83 100644 --- a/test/unit/session_collections_test.rb +++ b/test/unit/session_collections_test.rb @@ -8,48 +8,48 @@ class SessionCollectionsTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 # create users - roles = Role.where( :name => [ 'Agent', 'Admin'] ) + roles = Role.where( name: [ 'Agent', 'Admin'] ) groups = Group.all agent1 = User.create_or_update( - :login => 'session-collections-agent-1', - :firstname => 'Session', - :lastname => 'collections 1', - :email => 'session-collections-agent-1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-collections-agent-1', + firstname: 'Session', + lastname: 'collections 1', + email: 'session-collections-agent-1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles agent1.save - roles = Role.where( :name => [ 'Agent' ] ) + roles = Role.where( name: [ 'Agent' ] ) groups = Group.all agent2 = User.create_or_update( - :login => 'session-collections-agent-2', - :firstname => 'Session', - :lastname => 'collections 2', - :email => 'session-collections-agent-2@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-collections-agent-2', + firstname: 'Session', + lastname: 'collections 2', + email: 'session-collections-agent-2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent2.roles = roles agent2.save - roles = Role.where( :name => [ 'Customer'] ) + roles = Role.where( name: [ 'Customer'] ) customer1 = User.create_or_update( - :login => 'session-collections-customer-1', - :firstname => 'Session', - :lastname => 'collections 2', - :email => 'session-collections-customer-1@example.com', - :password => 'customerpw', - :organization_id => nil, - :active => true, - :roles => roles, + login: 'session-collections-customer-1', + firstname: 'Session', + lastname: 'collections 2', + email: 'session-collections-customer-1@example.com', + password: 'customerpw', + organization_id: nil, + active: true, + roles: roles, ) customer1.roles = roles customer1.save @@ -108,13 +108,13 @@ class SessionCollectionsTest < ActiveSupport::TestCase assert( check_if_collection_exists(result3, :Group), 'check collections - after touch' ) # change collection - org = Organization.create( :name => 'SomeOrg::' + rand(999_999).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 result1 = collection_client1.push assert( result1, 'check collections - after create' ) - assert( check_if_collection_exists(result1, :Organization, { :id => org.id, :member_ids => [customer1.id] } ), 'check collections - after create with attributes' ) + assert( check_if_collection_exists(result1, :Organization, { id: org.id, member_ids: [customer1.id] } ), 'check collections - after create with attributes' ) sleep 0.3 result2 = collection_client2.push assert( result2, 'check collections - after create' ) diff --git a/test/unit/session_enhanced_test.rb b/test/unit/session_enhanced_test.rb index d559f3e1c..5a350444b 100644 --- a/test/unit/session_enhanced_test.rb +++ b/test/unit/session_enhanced_test.rb @@ -5,43 +5,43 @@ class SessionEnhancedTest < ActiveSupport::TestCase test 'a check clients and send messages' do # create users - roles = Role.where( :name => [ 'Agent'] ) + roles = Role.where( name: [ 'Agent'] ) groups = Group.all UserInfo.current_user_id = 1 agent1 = User.create_or_update( - :login => 'session-agent-1', - :firstname => 'Session', - :lastname => 'Agent 1', - :email => 'session-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-agent-1', + firstname: 'Session', + lastname: 'Agent 1', + email: 'session-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles agent1.save agent2 = User.create_or_update( - :login => 'session-agent-2', - :firstname => 'Session', - :lastname => 'Agent 2', - :email => 'session-agent2@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-agent-2', + firstname: 'Session', + lastname: 'Agent 2', + email: 'session-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent2.roles = roles agent2.save agent3 = User.create_or_update( - :login => 'session-agent-3', - :firstname => 'Session', - :lastname => 'Agent 3', - :email => 'session-agent3@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-agent-3', + firstname: 'Session', + lastname: 'Agent 3', + email: 'session-agent3@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent3.roles = roles agent3.save @@ -53,9 +53,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase Sessions.destory(client_id1) Sessions.destory(client_id2) Sessions.destory(client_id3) - Sessions.create( client_id1, agent1.attributes, { :type => 'websocket' } ) - Sessions.create( client_id2, agent2.attributes, { :type => 'ajax' } ) - Sessions.create( client_id3, agent3.attributes, { :type => 'ajax' } ) + Sessions.create( client_id1, agent1.attributes, { type: 'websocket' } ) + Sessions.create( client_id2, agent2.attributes, { type: 'ajax' } ) + Sessions.create( client_id3, agent3.attributes, { type: 'ajax' } ) # check if session exists assert( Sessions.session_exists?(client_id1), 'check if session exists' ) @@ -96,8 +96,8 @@ class SessionEnhancedTest < ActiveSupport::TestCase assert_equal( data[:user]['id'], agent3.id, 'check if user id is correct' ) # send data to one client - Sessions.send( client_id1, { :msg => 'äöüß123' } ) - Sessions.send( client_id1, { :msg => 'äöüß1234' } ) + Sessions.send( client_id1, { msg: 'äöüß123' } ) + Sessions.send( client_id1, { msg: 'äöüß1234' } ) messages = Sessions.queue(client_id1) assert_equal( 3, messages.count, 'messages count') assert_equal( 'ws:login', messages[0]['event'], 'messages 1') @@ -117,7 +117,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase # broadcast to all clients - Sessions.broadcast( { :msg => 'ooo123123123123123123'} ) + Sessions.broadcast( { msg: 'ooo123123123123123123'} ) messages = Sessions.queue(client_id1) assert_equal( messages.count, 1, 'messages count') assert_equal( 'ooo123123123123123123', messages[0]['msg'], 'messages broadcast 1') @@ -131,7 +131,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase assert_equal( 'ooo123123123123123123', messages[0]['msg'], 'messages broadcast 1') # send dedicated message to user - Sessions.send_to( agent1.id, { :msg => 'ooo1231231231231231234'} ) + Sessions.send_to( agent1.id, { msg: 'ooo1231231231231231234'} ) messages = Sessions.queue(client_id1) assert_equal( messages.count, 1, 'messages count') assert_equal( 'ooo1231231231231231234', messages[0]['msg'], 'messages send 1') @@ -177,35 +177,35 @@ class SessionEnhancedTest < ActiveSupport::TestCase test 'b check client and backends' do # create users - roles = Role.where( :name => [ 'Agent'] ) + roles = Role.where( name: [ 'Agent'] ) groups = Group.all UserInfo.current_user_id = 1 agent1 = User.create_or_update( - :login => 'session-agent-1', - :firstname => 'Session', - :lastname => 'Agent 1', - :email => 'session-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-agent-1', + firstname: 'Session', + lastname: 'Agent 1', + email: 'session-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.roles = roles agent1.save agent2 = User.create_or_update( - :login => 'session-agent-2', - :firstname => 'Session', - :lastname => 'Agent 2', - :email => 'session-agent2@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, + login: 'session-agent-2', + firstname: 'Session', + lastname: 'Agent 2', + email: 'session-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent2.roles = roles agent2.save - org = Organization.create( :name => 'SomeOrg::' + rand(999_999).to_s, :active => true ) + org = Organization.create( name: 'SomeOrg::' + rand(999_999).to_s, active: true ) # create sessions client_id1_0 = '1234-1' @@ -220,11 +220,11 @@ class SessionEnhancedTest < ActiveSupport::TestCase Sessions.jobs } sleep 5 - Sessions.create( client_id1_0, agent1.attributes, { :type => 'websocket' } ) + Sessions.create( client_id1_0, agent1.attributes, { type: 'websocket' } ) sleep 6.5 - Sessions.create( client_id1_1, agent1.attributes, { :type => 'websocket' } ) + Sessions.create( client_id1_1, agent1.attributes, { type: 'websocket' } ) sleep 3.2 - Sessions.create( client_id2, agent2.attributes, { :type => 'ajax' } ) + Sessions.create( client_id2, agent2.attributes, { type: 'ajax' } ) # check if session exists assert( Sessions.session_exists?(client_id1_0), 'check if session exists' ) diff --git a/test/unit/store_test.rb b/test/unit/store_test.rb index 82eee141a..b49a843ed 100644 --- a/test/unit/store_test.rb +++ b/test/unit/store_test.rb @@ -5,24 +5,24 @@ class StoreTest < ActiveSupport::TestCase test 'store attachment' do files = [ { - :data => 'hello world', - :filename => 'test.txt', - :o_id => 1, + data: 'hello world', + filename: 'test.txt', + o_id: 1, }, { - :data => 'hello world äöüß', - :filename => 'testäöüß.txt', - :o_id => 2, + data: 'hello world äöüß', + filename: 'testäöüß.txt', + o_id: 2, }, { - :data => IO.read('test/fixtures/test1.pdf'), - :filename => 'test.pdf', - :o_id => 3, + data: IO.read('test/fixtures/test1.pdf'), + filename: 'test.pdf', + o_id: 3, }, { - :data => IO.read('test/fixtures/test1.pdf'), - :filename => 'test-again.pdf', - :o_id => 4, + data: IO.read('test/fixtures/test1.pdf'), + filename: 'test-again.pdf', + o_id: 4, }, ] @@ -31,19 +31,19 @@ class StoreTest < ActiveSupport::TestCase # add attachments store = Store.add( - :object => 'Test', - :o_id => file[:o_id], - :data => file[:data], - :filename => file[:filename], - :preferences => {}, - :created_by_id => 1, + object: 'Test', + o_id: file[:o_id], + data: file[:data], + filename: file[:filename], + preferences: {}, + created_by_id: 1, ) assert store # get list of attachments attachments = Store.list( - :object => 'Test', - :o_id => file[:o_id], + object: 'Test', + o_id: file[:o_id], ) assert attachments @@ -68,8 +68,8 @@ class StoreTest < ActiveSupport::TestCase # get list of attachments attachments = Store.list( - :object => 'Test', - :o_id => file[:o_id], + object: 'Test', + o_id: file[:o_id], ) assert attachments @@ -94,8 +94,8 @@ class StoreTest < ActiveSupport::TestCase # get list of attachments attachments = Store.list( - :object => 'Test', - :o_id => file[:o_id], + object: 'Test', + o_id: file[:o_id], ) assert attachments @@ -111,15 +111,15 @@ class StoreTest < ActiveSupport::TestCase # delete attachments success = Store.remove( - :object => 'Test', - :o_id => file[:o_id], + object: 'Test', + o_id: file[:o_id], ) assert success # check attachments again attachments = Store.list( - :object => 'Test', - :o_id => file[:o_id], + object: 'Test', + o_id: file[:o_id], ) assert !attachments[0] } diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index 8f16a9d3e..7a290f453 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -7,15 +7,15 @@ class TagTest < ActiveSupport::TestCase # test 1 { - :tag_add => { - :item => 'tag1', - :object => 'Object1', - :o_id => 123, - :created_by_id => 1 + tag_add: { + item: 'tag1', + object: 'Object1', + o_id: 123, + created_by_id: 1 }, - :verify => { - :object => 'Object1', - :items => { + verify: { + object: 'Object1', + items: { 'tag1' => true, 'tag2' => false, }, @@ -24,15 +24,15 @@ class TagTest < ActiveSupport::TestCase # test 2 { - :tag_add => { - :item => 'tag2', - :object => 'Object1', - :o_id => 123, - :created_by_id => 1 + tag_add: { + item: 'tag2', + object: 'Object1', + o_id: 123, + created_by_id: 1 }, - :verify => { - :object => 'Object1', - :items => { + verify: { + object: 'Object1', + items: { 'tag1' => true, 'tag2' => true, }, @@ -41,15 +41,15 @@ class TagTest < ActiveSupport::TestCase # test 2 { - :tag_add => { - :item => 'tagöäüß1', - :object => 'Object2', - :o_id => 123, - :created_by_id => 1 + tag_add: { + item: 'tagöäüß1', + object: 'Object2', + o_id: 123, + created_by_id: 1 }, - :verify => { - :object => 'Object2', - :items => { + verify: { + object: 'Object2', + items: { 'tagöäüß1' => true, 'tag2' => false, }, @@ -58,15 +58,15 @@ class TagTest < ActiveSupport::TestCase # test 4 { - :tag_add => { - :item => 'Tagöäüß2', - :object => 'Object2', - :o_id => 123, - :created_by_id => 1 + tag_add: { + item: 'Tagöäüß2', + object: 'Object2', + o_id: 123, + created_by_id: 1 }, - :verify => { - :object => 'Object2', - :items => { + verify: { + object: 'Object2', + items: { 'tagöäüß1' => true, 'tagöäüß2' => true, 'tagöäüß3' => false, @@ -76,15 +76,15 @@ class TagTest < ActiveSupport::TestCase # test 5 { - :tag_remove => { - :item => 'tag1', - :object => 'Object1', - :o_id => 123, - :created_by_id => 1 + tag_remove: { + item: 'tag1', + object: 'Object1', + o_id: 123, + created_by_id: 1 }, - :verify => { - :object => 'Object1', - :items => { + verify: { + object: 'Object1', + items: { 'tag1' => false, 'tag2' => true, }, diff --git a/test/unit/ticket_customer_organization_update_test.rb b/test/unit/ticket_customer_organization_update_test.rb index 8f1572574..629507e09 100644 --- a/test/unit/ticket_customer_organization_update_test.rb +++ b/test/unit/ticket_customer_organization_update_test.rb @@ -4,53 +4,53 @@ require 'test_helper' class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase # create base - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent1 = User.create_or_update( - :login => 'ticket-customer-organization-update-agent1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'ticket-customer-organization-update-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-customer-organization-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-customer-organization-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) organization1 = Organization.create_if_not_exists( - :name => 'Customer Organization Update', - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Customer Organization Update', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer1 = User.create_or_update( - :login => 'ticket-customer-organization-update-customer1@example.com', - :firstname => 'Notification', - :lastname => 'Customer1', - :email => 'ticket-customer-organization-update-customer1@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-customer-organization-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-customer-organization-update-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) test 'create ticket, update customers organization later' do ticket = Ticket.create( - :title => "some title1\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer1.id, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title1\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( customer1.id, ticket.customer.id ) diff --git a/test/unit/ticket_notification_test.rb b/test/unit/ticket_notification_test.rb index b334b60d6..a8264ad4d 100644 --- a/test/unit/ticket_notification_test.rb +++ b/test/unit/ticket_notification_test.rb @@ -4,84 +4,84 @@ require 'test_helper' class TicketNotificationTest < ActiveSupport::TestCase # create agent1 & agent2 - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent1 = User.create_or_update( - :login => 'ticket-notification-agent1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'ticket-notification-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :preferences => { - :locale => 'de-de', + login: 'ticket-notification-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-notification-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { + locale: 'de-de', }, - :updated_by_id => 1, - :created_by_id => 1, + updated_by_id: 1, + created_by_id: 1, ) agent2 = User.create_or_update( - :login => 'ticket-notification-agent2@example.com', - :firstname => 'Notification', - :lastname => 'Agent2', - :email => 'ticket-notification-agent2@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :preferences => { - :locale => 'en-ca', + login: 'ticket-notification-agent2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'ticket-notification-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { + locale: 'en-ca', }, - :updated_by_id => 1, - :created_by_id => 1, + updated_by_id: 1, + created_by_id: 1, ) Group.create_if_not_exists( - :name => 'WithoutAccess', - :note => 'Test for notification check.', - :updated_by_id => 1, - :created_by_id => 1 + name: 'WithoutAccess', + note: 'Test for notification check.', + updated_by_id: 1, + created_by_id: 1 ) # create customer - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) customer = User.create_or_update( - :login => 'ticket-notification-customer@example.com', - :firstname => 'Notification', - :lastname => 'Customer', - :email => 'ticket-notification-customer@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-notification-customer@example.com', + firstname: 'Notification', + lastname: 'Customer', + email: 'ticket-notification-customer@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_by_id: 1, + created_by_id: 1, ) test 'ticket notification simple' do # create ticket in group ticket1 = Ticket.create( - :title => 'some notification test 1', - :group => Group.lookup( :name => 'Users'), - :customer => customer, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => customer.id, - :created_by_id => customer.id, + title: 'some notification test 1', + group: Group.lookup( name: 'Users'), + customer: customer, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: customer.id, + created_by_id: customer.id, ) article_inbound = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => customer.id, - :created_by_id => customer.id, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: customer.id, + created_by_id: customer.id, ) assert( ticket1, 'ticket created - ticket notification simple' ) @@ -96,7 +96,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket attributes ticket1.title = "#{ticket1.title} - #2" - ticket1.priority = Ticket::Priority.lookup( :name => '3 high' ) + ticket1.priority = Ticket::Priority.lookup( name: '3 high' ) ticket1.save # execute ticket events @@ -110,15 +110,15 @@ class TicketNotificationTest < ActiveSupport::TestCase # add article to ticket article_note = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some person', - :subject => 'some note', - :body => 'some message', - :internal => true, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'note').first, - :updated_by_id => agent1.id, - :created_by_id => agent1.id, + ticket_id: ticket1.id, + from: 'some person', + subject: 'some note', + body: 'some message', + internal: true, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, + updated_by_id: agent1.id, + created_by_id: agent1.id, ) # execute ticket events @@ -135,15 +135,15 @@ class TicketNotificationTest < ActiveSupport::TestCase ticket1.updated_by_id = agent1.id ticket1.save article_note = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some person', - :subject => 'some note', - :body => 'some message', - :internal => true, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'note').first, - :updated_by_id => agent1.id, - :created_by_id => agent1.id, + ticket_id: ticket1.id, + from: 'some person', + subject: 'some note', + body: 'some message', + internal: true, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, + updated_by_id: agent1.id, + created_by_id: agent1.id, ) # execute ticket events @@ -157,27 +157,27 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket with agent1 as owner ticket2 = Ticket.create( - :title => 'some notification test 2', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => agent1.id, - :created_by_id => agent1.id, + title: 'some notification test 2', + group: Group.lookup( name: 'Users'), + customer_id: 2, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: agent1.id, + created_by_id: agent1.id, ) article_inbound = Ticket::Article.create( - :ticket_id => ticket2.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'phone').first, - :updated_by_id => agent1.id, - :created_by_id => agent1.id, + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, + updated_by_id: agent1.id, + created_by_id: agent1.id, ) # execute ticket events @@ -193,7 +193,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket ticket2.title = "#{ticket2.title} - #2" ticket2.updated_by_id = agent1.id - ticket2.priority = Ticket::Priority.lookup( :name => '3 high' ) + ticket2.priority = Ticket::Priority.lookup( name: '3 high' ) ticket2.save # execute ticket events @@ -208,7 +208,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket ticket2.title = "#{ticket2.title} - #3" ticket2.updated_by_id = agent2.id - ticket2.priority = Ticket::Priority.lookup( :name => '2 normal' ) + ticket2.priority = Ticket::Priority.lookup( name: '2 normal' ) ticket2.save # execute ticket events @@ -224,27 +224,27 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket with agent2 and agent1 as owner ticket3 = Ticket.create( - :title => 'some notification test 3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => agent2.id, - :created_by_id => agent2.id, + title: 'some notification test 3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: agent2.id, + created_by_id: agent2.id, ) article_inbound = Ticket::Article.create( - :ticket_id => ticket3.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'phone').first, - :updated_by_id => agent2.id, - :created_by_id => agent2.id, + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, + updated_by_id: agent2.id, + created_by_id: agent2.id, ) # execute ticket events @@ -260,7 +260,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket ticket3.title = "#{ticket3.title} - #2" ticket3.updated_by_id = agent1.id - ticket3.priority = Ticket::Priority.lookup( :name => '3 high' ) + ticket3.priority = Ticket::Priority.lookup( name: '3 high' ) ticket3.save # execute ticket events @@ -275,7 +275,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket ticket3.title = "#{ticket3.title} - #3" ticket3.updated_by_id = agent2.id - ticket3.priority = Ticket::Priority.lookup( :name => '2 normal' ) + ticket3.priority = Ticket::Priority.lookup( name: '2 normal' ) ticket3.save # execute ticket events @@ -317,26 +317,26 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create( - :title => 'some notification event test 1', - :group => Group.lookup( :name => 'Users'), - :customer => customer, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => customer.id, - :created_by_id => customer.id, + title: 'some notification event test 1', + group: Group.lookup( name: 'Users'), + customer: customer, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: customer.id, + created_by_id: customer.id, ) article_inbound = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => customer.id, - :created_by_id => customer.id, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: customer.id, + created_by_id: customer.id, ) assert( ticket1, 'ticket created' ) @@ -345,7 +345,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket attributes ticket1.title = "#{ticket1.title} - #2" - ticket1.priority = Ticket::Priority.lookup( :name => '3 high' ) + ticket1.priority = Ticket::Priority.lookup( name: '3 high' ) ticket1.save list = EventBuffer.list @@ -359,7 +359,7 @@ class TicketNotificationTest < ActiveSupport::TestCase # update ticket attributes ticket1.title = "#{ticket1.title} - #3" - ticket1.priority = Ticket::Priority.lookup( :name => '1 low' ) + ticket1.priority = Ticket::Priority.lookup( name: '1 low' ) ticket1.save list = EventBuffer.list @@ -378,34 +378,34 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create( - :title => 'some notification template test 1 Bobs\'s resumé', - :group => Group.lookup( :name => 'Users'), - :customer => customer, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => customer.id, - :created_by_id => customer.id, + title: 'some notification template test 1 Bobs\'s resumé', + group: Group.lookup( name: 'Users'), + customer: customer, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: customer.id, + created_by_id: customer.id, ) article = Ticket::Article.create( - :ticket_id => ticket1.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => "some message\nnewline1 abc\nnewline2", - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => customer.id, - :created_by_id => customer.id, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nnewline1 abc\nnewline2", + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: customer.id, + created_by_id: customer.id, ) assert( ticket1, 'ticket created - ticket notification template' ) bg = Observer::Ticket::Notification::BackgroundJob.new( - :ticket_id => ticket1.id, - :article_id => article.id, - :type => 'update', - :changes => { + ticket_id: ticket1.id, + article_id: article.id, + type: 'update', + changes: { 'priority_id' => [1, 2], 'pending_time' => [nil, Time.parse('2015-01-11 23:33:47 UTC')], }, @@ -436,22 +436,22 @@ class TicketNotificationTest < ActiveSupport::TestCase # en notification subject = NotificationFactory.build( - :locale => agent2.preferences[:locale], - :string => template[:subject], - :objects => { - :ticket => ticket1, - :article => article, - :recipient => agent2, + locale: agent2.preferences[:locale], + string: template[:subject], + objects: { + ticket: ticket1, + article: article, + recipient: agent2, } ) assert_match( /Bobs's resumé/, subject ) body = NotificationFactory.build( - :locale => agent2.preferences[:locale], - :string => template[:body], - :objects => { - :ticket => ticket1, - :article => article, - :recipient => agent2, + locale: agent2.preferences[:locale], + string: template[:body], + objects: { + ticket: ticket1, + article: article, + recipient: agent2, } ) assert_match( /Priority/, body ) @@ -476,22 +476,22 @@ class TicketNotificationTest < ActiveSupport::TestCase # de notification subject = NotificationFactory.build( - :locale => agent1.preferences[:locale], - :string => template[:subject], - :objects => { - :ticket => ticket1, - :article => article, - :recipient => agent2, + locale: agent1.preferences[:locale], + string: template[:subject], + objects: { + ticket: ticket1, + article: article, + recipient: agent2, } ) assert_match( /Bobs's resumé/, subject ) body = NotificationFactory.build( - :locale => agent1.preferences[:locale], - :string => template[:body], - :objects => { - :ticket => ticket1, - :article => article, - :recipient => agent1, + locale: agent1.preferences[:locale], + string: template[:body], + objects: { + ticket: ticket1, + article: article, + recipient: agent1, } ) @@ -505,12 +505,12 @@ class TicketNotificationTest < ActiveSupport::TestCase assert_no_match( /i18n/, body ) bg = Observer::Ticket::Notification::BackgroundJob.new( - :ticket_id => ticket1.id, - :article_id => article.id, - :type => 'update', - :changes => { - :title => ['some notification template test 1', 'some notification template test 1 #2'], - :priority_id => [2, 3], + ticket_id: ticket1.id, + article_id: article.id, + type: 'update', + changes: { + title: ['some notification template test 1', 'some notification template test 1 #2'], + priority_id: [2, 3], }, ) diff --git a/test/unit/ticket_ref_object_touch_test.rb b/test/unit/ticket_ref_object_touch_test.rb index fa090bacb..c8122fe47 100644 --- a/test/unit/ticket_ref_object_touch_test.rb +++ b/test/unit/ticket_ref_object_touch_test.rb @@ -4,66 +4,66 @@ require 'test_helper' class TicketRefObjectTouchTest < ActiveSupport::TestCase # create base - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent1 = User.create_or_update( - :login => 'ticket-ref-object-update-agent1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'ticket-ref-object-update-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) organization1 = Organization.create_if_not_exists( - :name => 'Ref Object Update Org', - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Ref Object Update Org', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer1 = User.create_or_update( - :login => 'ticket-ref-object-update-customer1@example.com', - :firstname => 'Notification', - :lastname => 'Customer1', - :email => 'ticket-ref-object-update-customer1@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - :login => 'ticket-ref-object-update-customer2@example.com', - :firstname => 'Notification', - :lastname => 'Customer2', - :email => 'ticket-ref-object-update-customer2@example.com', - :password => 'customerpw', - :active => true, - :organization_id => nil, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'ticket-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, + organization_id: nil, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) test 'a - check if customer and organization has been updated' do ticket = Ticket.create( - :title => "some title1\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer1.id, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title1\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.customer.id, customer1.id ) @@ -109,14 +109,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase sleep 3 ticket = Ticket.create( - :title => "some title2\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer2.id, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title2\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer2.id, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.customer.id, customer2.id ) diff --git a/test/unit/ticket_sla_test.rb b/test/unit/ticket_sla_test.rb index f014c00e9..e7688a987 100644 --- a/test/unit/ticket_sla_test.rb +++ b/test/unit/ticket_sla_test.rb @@ -11,33 +11,33 @@ class TicketSlaTest < ActiveSupport::TestCase assert( delete, 'ticket destroy_all' ) ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-03-21 09:30:00 UTC', - :updated_at => '2013-03-21 09:30:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-03-21 09:30:00 UTC', + updated_at: '2013-03-21 09:30:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '8:00', 'end_of_workday' => '18:00', }, - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) @@ -48,19 +48,19 @@ class TicketSlaTest < ActiveSupport::TestCase assert( delete, 'sla destroy 1' ) sla = Sla.create( - :name => 'test sla 2', - :condition => { 'tickets.priority_id' =>['1', '2', '3'] }, - :data => { + name: 'test sla 2', + condition: { 'tickets.priority_id' =>['1', '2', '3'] }, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '8:00', 'end_of_workday' => '18:00', }, - :first_response_time => 60, - :update_time => 120, - :close_time => 180, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + first_response_time: 60, + update_time: 120, + close_time: 180, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2' ) @@ -79,7 +79,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set first response in time ticket.update_attributes( - :first_response => '2013-03-21 10:00:00 UTC', + first_response: '2013-03-21 10:00:00 UTC', ) puts ticket.inspect @@ -99,7 +99,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set first reponse over time ticket.update_attributes( - :first_response => '2013-03-21 14:00:00 UTC', + first_response: '2013-03-21 14:00:00 UTC', ) puts ticket.inspect @@ -119,7 +119,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set update time in time ticket.update_attributes( - :last_contact_agent => '2013-03-21 11:00:00 UTC', + last_contact_agent: '2013-03-21 11:00:00 UTC', ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 5' ) @@ -138,7 +138,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set update time over time ticket.update_attributes( - :last_contact_agent => '2013-03-21 12:00:00 UTC', + last_contact_agent: '2013-03-21 12:00:00 UTC', ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 6' ) @@ -157,7 +157,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set close time in time ticket.update_attributes( - :close_time => '2013-03-21 11:30:00 UTC', + close_time: '2013-03-21 11:30:00 UTC', ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 7' ) @@ -176,7 +176,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set close time over time ticket.update_attributes( - :close_time => '2013-03-21 13:00:00 UTC', + close_time: '2013-03-21 13:00:00 UTC', ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 8' ) @@ -195,7 +195,7 @@ class TicketSlaTest < ActiveSupport::TestCase # set close time over time ticket.update_attributes( - :state => Ticket::State.lookup( :name => 'closed' ) + state: Ticket::State.lookup( name: 'closed' ) ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 9' ) @@ -216,15 +216,15 @@ class TicketSlaTest < ActiveSupport::TestCase assert( delete, 'ticket destroy' ) ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, - :created_at => '2013-03-28 23:49:00 UTC', - :updated_at => '2013-03-28 23:49:00 UTC', + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) assert( ticket, 'ticket created' ) @@ -234,19 +234,19 @@ class TicketSlaTest < ActiveSupport::TestCase # create inbound article article_inbound = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, - :created_at => '2013-03-28 23:49:00 UTC', - :updated_at => '2013-03-28 23:49:00 UTC', + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' ) @@ -258,19 +258,19 @@ class TicketSlaTest < ActiveSupport::TestCase # create outbound article article_outbound = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some_recipient@example.com', - :to => 'some_sender@example.com', - :subject => 'some subject', - :message_id => 'some@id2', - :body => 'some message 2', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, - :created_at => '2013-03-29 08:00:03 UTC', - :updated_at => '2013-03-29 08:00:03 UTC', + ticket_id: ticket.id, + from: 'some_recipient@example.com', + to: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id2', + body: 'some message 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, + created_at: '2013-03-29 08:00:03 UTC', + updated_at: '2013-03-29 08:00:03 UTC', ) ticket = Ticket.find(ticket.id) @@ -288,15 +288,15 @@ class TicketSlaTest < ActiveSupport::TestCase ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, - :created_at => '2013-03-28 23:49:00 UTC', - :updated_at => '2013-03-28 23:49:00 UTC', + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) assert( ticket, 'ticket created' ) @@ -306,18 +306,18 @@ class TicketSlaTest < ActiveSupport::TestCase # create inbound article article_inbound = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some_sender@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'phone').first, - :updated_by_id => 1, - :created_by_id => 1, - :created_at => '2013-03-28 23:49:00 UTC', - :updated_at => '2013-03-28 23:49:00 UTC', + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, + updated_by_id: 1, + created_by_id: 1, + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' ) @@ -343,35 +343,35 @@ class TicketSlaTest < ActiveSupport::TestCase assert( delete, 'ticket destroy_all' ) ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-03-21 09:30:00 UTC', - :updated_at => '2013-03-21 09:30:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-03-21 09:30:00 UTC', + updated_at: '2013-03-21 09:30:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 8:00-17:00 sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :timezone => 'Europe/Berlin', - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + timezone: 'Europe/Berlin', + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) @@ -385,35 +385,35 @@ class TicketSlaTest < ActiveSupport::TestCase delete = ticket.destroy assert( delete, 'ticket destroy' ) ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-10-21 09:30:00 UTC', - :updated_at => '2013-10-21 09:30:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-10-21 09:30:00 UTC', + updated_at: '2013-10-21 09:30:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :timezone => 'Europe/Berlin', - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + timezone: 'Europe/Berlin', + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) @@ -428,35 +428,35 @@ class TicketSlaTest < ActiveSupport::TestCase assert( delete, 'sla destroy' ) ticket = Ticket.create( - :title => 'some title äöüß', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-10-21 06:30:00 UTC', - :updated_at => '2013-10-21 06:30:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-10-21 06:30:00 UTC', + updated_at: '2013-10-21 06:30:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :timezone => 'Europe/Berlin', - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + timezone: 'Europe/Berlin', + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.escalation_time verify 1' ) @@ -474,93 +474,93 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket escalation suspend' do ticket = Ticket.create( - :title => 'some title äöüß3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-06-04 09:00:00 UTC', - :updated_at => '2013-06-04 09:00:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) # set ticket at 10:00 to pending History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 3, - :id_from => 2, - :value_from => 'open', - :value_to => 'pending reminder', - :created_by_id => 1, - :created_at => '2013-06-04 10:00:00 UTC', - :updated_at => '2013-06-04 10:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 10:00:00 UTC', + updated_at: '2013-06-04 10:00:00 UTC', ) # set ticket at 10:30 to open History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 2, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'open', - :created_by_id => 1, - :created_at => '2013-06-04 10:30:00 UTC', - :updated_at => '2013-06-04 10:30:00 UTC' + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC' ) # set update time ticket.update_attributes( - :last_contact_agent => '2013-06-04 10:15:00 UTC', + last_contact_agent: '2013-06-04 10:15:00 UTC', ) # set first response time ticket.update_attributes( - :first_response => '2013-06-04 10:45:00 UTC', + first_response: '2013-06-04 10:45:00 UTC', ) # set ticket from 11:30 to closed History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 3, - :id_from => 2, - :value_from => 'open', - :value_to => 'closed', - :created_by_id => 1, - :created_at => '2013-06-04 12:00:00 UTC', - :updated_at => '2013-06-04 12:00:00 UTC' + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC' ) ticket.update_attributes( - :close_time => '2013-06-04 12:00:00 UTC', + close_time: '2013-06-04 12:00:00 UTC', ) # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :timezone => 'Europe/Berlin', - :first_response_time => 120, - :update_time => 180, - :close_time => 250, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + timezone: 'Europe/Berlin', + first_response_time: 120, + update_time: 180, + close_time: 250, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' ) @@ -579,51 +579,51 @@ class TicketSlaTest < ActiveSupport::TestCase # test Ticket created in state pending and closed without reopen or state change ticket = Ticket.create( - :title => 'some title äöüß3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'pending reminder' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-06-04 09:00:00 UTC', - :updated_at => '2013-06-04 09:00:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'pending reminder' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) # set ticket from 11:30 to closed History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 4, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'closed', - :created_by_id => 1, - :created_at => '2013-06-04 12:00:00 UTC', - :updated_at => '2013-06-04 12:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'pending reminder', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update_attributes( - :close_time => '2013-06-04 12:00:00 UTC', + close_time: '2013-06-04 12:00:00 UTC', ) sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) @@ -645,80 +645,80 @@ class TicketSlaTest < ActiveSupport::TestCase # test Ticket created in state pending, changed state to openen, back to pending and closed ticket = Ticket.create( - :title => 'some title äöüß3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'pending reminder' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-06-04 09:00:00 UTC', - :updated_at => '2013-06-04 09:00:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'pending reminder' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) # state change to open 10:30 History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 2, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'open', - :created_by_id => 1, - :created_at => '2013-06-04 10:30:00 UTC', - :updated_at => '2013-06-04 10:30:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC', ) # state change to pending 11:00 History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 3, - :id_from => 2, - :value_from => 'open', - :value_to => 'pending reminder', - :created_by_id => 1, - :created_at => '2013-06-04 11:00:00 UTC', - :updated_at => '2013-06-04 11:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 11:00:00 UTC', + updated_at: '2013-06-04 11:00:00 UTC', ) # set ticket from 12:00 to closed History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 4, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'closed', - :created_by_id => 1, - :created_at => '2013-06-04 12:00:00 UTC', - :updated_at => '2013-06-04 12:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'pending reminder', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update_attributes( - :close_time => '2013-06-04 12:00:00 UTC', + close_time: '2013-06-04 12:00:00 UTC', ) sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) @@ -740,95 +740,95 @@ class TicketSlaTest < ActiveSupport::TestCase ### Test Ticket created in state pending, changed state to openen, back to pending and back to open then ### close ticket ticket = Ticket.create( - :title => 'some title äöüß3', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'pending reminder' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :created_at => '2013-06-04 09:00:00 UTC', - :updated_at => '2013-06-04 09:00:00 UTC', - :updated_by_id => 1, - :created_by_id => 1, + title: 'some title äöüß3', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'pending reminder' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) # state change to open from pending History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 2, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'open', - :created_by_id => 1, - :created_at => '2013-06-04 10:30:00 UTC', - :updated_at => '2013-06-04 10:30:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC', ) # state change to pending from open 11:00 History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 3, - :id_from => 2, - :value_from => 'open', - :value_to => 'pending reminder', - :created_by_id => 1, - :created_at => '2013-06-04 11:00:00 UTC', - :updated_at => '2013-06-04 11:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 11:00:00 UTC', + updated_at: '2013-06-04 11:00:00 UTC', ) # state change to open 11:30 History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 2, - :id_from => 3, - :value_from => 'pending reminder', - :value_to => 'open', - :created_by_id => 1, - :created_at => '2013-06-04 11:30:00 UTC', - :updated_at => '2013-06-04 11:30:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 11:30:00 UTC', + updated_at: '2013-06-04 11:30:00 UTC', ) # set ticket from open to closed 12:00 History.add( - :history_type => 'updated', - :history_object => 'Ticket', - :history_attribute => 'state', - :o_id => ticket.id, - :id_to => 4, - :id_from => 3, - :value_from => 'open', - :value_to => 'closed', - :created_by_id => 1, - :created_at => '2013-06-04 12:00:00 UTC', - :updated_at => '2013-06-04 12:00:00 UTC', + history_type: 'updated', + history_object: 'Ticket', + history_attribute: 'state', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'open', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update_attributes( - :close_time => '2013-06-04 12:00:00 UTC', + close_time: '2013-06-04 12:00:00 UTC', ) sla = Sla.create( - :name => 'test sla 1', - :condition => {}, - :data => { + name: 'test sla 1', + condition: {}, + data: { 'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun', 'beginning_of_workday' => '9:00', 'end_of_workday' => '18:00', }, - :first_response_time => 120, - :update_time => 180, - :close_time => 240, - :active => true, - :updated_by_id => 1, - :created_by_id => 1, + first_response_time: 120, + update_time: 180, + close_time: 240, + active: true, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) diff --git a/test/unit/ticket_test.rb b/test/unit/ticket_test.rb index ab42f493d..640540027 100644 --- a/test/unit/ticket_test.rb +++ b/test/unit/ticket_test.rb @@ -4,13 +4,13 @@ require 'test_helper' class TicketTest < ActiveSupport::TestCase test 'ticket create' do ticket = Ticket.create( - :title => "some title\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) @@ -20,17 +20,17 @@ class TicketTest < ActiveSupport::TestCase # create inbound article article_inbound = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some_sender@example.com', - :to => 'some_recipient@example.com', - :subject => 'some subject', - :message_id => 'some@id', - :body => 'some message article_inbound 😍😍😍', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Customer').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound 😍😍😍', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, ) assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' ) @@ -44,15 +44,15 @@ class TicketTest < ActiveSupport::TestCase # create note article article_note = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some person', - :subject => "some\nnote", - :body => "some\n message", - :internal => true, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'note').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + from: 'some person', + subject: "some\nnote", + body: "some\n message", + internal: true, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, + updated_by_id: 1, + created_by_id: 1, ) assert_equal( article_note.subject, 'some note', 'article_note.subject verify - inbound' ) assert_equal( article_note.body, "some\n message", 'article_note.body verify - inbound' ) @@ -68,17 +68,17 @@ class TicketTest < ActiveSupport::TestCase # create outbound article sleep 10 article_outbound = Ticket::Article.create( - :ticket_id => ticket.id, - :from => 'some_recipient@example.com', - :to => 'some_sender@example.com', - :subject => 'some subject', - :message_id => 'some@id2', - :body => 'some message 2', - :internal => false, - :sender => Ticket::Article::Sender.where(:name => 'Agent').first, - :type => Ticket::Article::Type.where(:name => 'email').first, - :updated_by_id => 1, - :created_by_id => 1, + ticket_id: ticket.id, + from: 'some_recipient@example.com', + to: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id2', + body: 'some message 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.find(ticket.id) @@ -89,7 +89,7 @@ class TicketTest < ActiveSupport::TestCase assert_equal( ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound' ) assert_equal( ticket.close_time, nil, 'ticket.close_time verify - outbound' ) - ticket.state_id = Ticket::State.where(:name => 'closed').first.id + ticket.state_id = Ticket::State.where(name: 'closed').first.id ticket.save ticket = Ticket.find(ticket.id) @@ -102,7 +102,7 @@ class TicketTest < ActiveSupport::TestCase # set pending time - ticket.state_id = Ticket::State.where(:name => 'pending reminder').first.id + ticket.state_id = Ticket::State.where(name: 'pending reminder').first.id ticket.pending_time = Time.parse('1977-10-27 22:00:00 +0000') ticket.save @@ -112,7 +112,7 @@ class TicketTest < ActiveSupport::TestCase # reset pending state, should also reset pending time - ticket.state_id = Ticket::State.where(:name => 'closed').first.id + ticket.state_id = Ticket::State.where(name: 'closed').first.id ticket.save ticket = Ticket.find(ticket.id) @@ -127,26 +127,26 @@ class TicketTest < ActiveSupport::TestCase test 'ticket latest change' do ticket1 = Ticket.create( - :title => 'latest change 1', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'latest change 1', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert_equal( Ticket.latest_change.to_s, ticket1.updated_at.to_s ) sleep 1 ticket2 = Ticket.create( - :title => 'latest change 2', - :group => Group.lookup( :name => 'Users'), - :customer_id => 2, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: 'latest change 2', + group: Group.lookup( name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert_equal( Ticket.latest_change.to_s, ticket2.updated_at.to_s ) diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb index bd7108dfb..89c39a034 100644 --- a/test/unit/token_test.rb +++ b/test/unit/token_test.rb @@ -8,54 +8,54 @@ class TokenTest < ActiveSupport::TestCase # test 1 { - :test_name => 'invalid token', - :action => 'PasswordReset', - :name => '1NV4L1D', - :result => nil, + test_name: 'invalid token', + action: 'PasswordReset', + name: '1NV4L1D', + result: nil, }, # test 2 { - :test_name => 'fresh token', - :create => { - :user_id => 2, - :action => 'PasswordReset', + test_name: 'fresh token', + create: { + user_id: 2, + action: 'PasswordReset', }, - :action => 'PasswordReset', - :result => true, - :verify => { - :firstname => 'Nicole', - :lastname => 'Braun', - :email => 'nicole.braun@zammad.org', + action: 'PasswordReset', + result: true, + verify: { + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, # test 3 { - :test_name => 'two days but not persistent', - :create => { - :user_id => 2, - :action => 'PasswordReset', - :created_at => 2.day.ago, + test_name: 'two days but not persistent', + create: { + user_id: 2, + action: 'PasswordReset', + created_at: 2.day.ago, }, - :action => 'PasswordReset', - :result => nil, + action: 'PasswordReset', + result: nil, }, { - :test_name => 'two days but persistent', - :create => { - :user_id => 2, - :action => 'iCal', - :created_at => 2.day.ago, - :persistent => true, + test_name: 'two days but persistent', + create: { + user_id: 2, + action: 'iCal', + created_at: 2.day.ago, + persistent: true, }, - :action => 'iCal', - :result => true, - :verify => { - :firstname => 'Nicole', - :lastname => 'Braun', - :email => 'nicole.braun@zammad.org', + action: 'iCal', + result: true, + verify: { + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, ] @@ -67,10 +67,10 @@ class TokenTest < ActiveSupport::TestCase #puts test[:test_name] + ': creating token '+ test[:create].inspect token = Token.create( - :action => test[:create][:action], - :user_id => test[:create][:user_id], - :created_at => test[:create][:created_at].to_s, - :persistent => test[:create][:persistent] + action: test[:create][:action], + user_id: test[:create][:user_id], + created_at: test[:create][:created_at].to_s, + persistent: test[:create][:persistent] ) #puts test[:test_name] + ': created token ' + token.inspect @@ -79,8 +79,8 @@ class TokenTest < ActiveSupport::TestCase end user = Token.check( - :action => test[:action], - :name => test[:name] + action: test[:action], + name: test[:name] ) if test[:result] == true @@ -98,7 +98,7 @@ class TokenTest < ActiveSupport::TestCase if test[:name] #puts test[:test_name] + ': deleting token '+ test[:name] - token = Token.where( :name => test[:name] ).first + token = Token.where( name: test[:name] ).first if token token.destroy diff --git a/test/unit/translation_test.rb b/test/unit/translation_test.rb index 68d5ebf03..a33e9d324 100644 --- a/test/unit/translation_test.rb +++ b/test/unit/translation_test.rb @@ -7,23 +7,23 @@ class TranslationTest < ActiveSupport::TestCase # test 1 { - :locale => 'en', - :string => 'New', - :result => 'New', + locale: 'en', + string: 'New', + result: 'New', }, # test 2 { - :locale => 'de-de', - :string => 'New', - :result => 'Neu', + locale: 'de-de', + string: 'New', + result: 'Neu', }, # test 3 { - :locale => 'de-de', - :string => 'not translated - lalala', - :result => 'not translated - lalala', + locale: 'de-de', + string: 'not translated - lalala', + result: 'not translated - lalala', }, ] tests.each { |test| diff --git a/test/unit/user_ref_object_touch_test.rb b/test/unit/user_ref_object_touch_test.rb index 8dc292193..fbcbc402a 100644 --- a/test/unit/user_ref_object_touch_test.rb +++ b/test/unit/user_ref_object_touch_test.rb @@ -4,66 +4,66 @@ require 'test_helper' class UserRefObjectTouchTest < ActiveSupport::TestCase # create base - groups = Group.where( :name => 'Users' ) - roles = Role.where( :name => 'Agent' ) + groups = Group.where( name: 'Users' ) + roles = Role.where( name: 'Agent' ) agent1 = User.create_or_update( - :login => 'user-ref-object-update-agent1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'user-ref-object-update-agent1@example.com', - :password => 'agentpw', - :active => true, - :roles => roles, - :groups => groups, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'user-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) - roles = Role.where( :name => 'Customer' ) + roles = Role.where( name: 'Customer' ) organization1 = Organization.create_if_not_exists( - :name => 'Ref Object Update Org', - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + name: 'Ref Object Update Org', + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer1 = User.create_or_update( - :login => 'user-ref-object-update-customer1@example.com', - :firstname => 'Notification', - :lastname => 'Agent1', - :email => 'user-ref-object-update-customer1@example.com', - :password => 'customerpw', - :active => true, - :organization_id => organization1.id, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'user-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, + organization_id: organization1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - :login => 'user-ref-object-update-customer2@example.com', - :firstname => 'Notification', - :lastname => 'Agent2', - :email => 'user-ref-object-update-customer2@example.com', - :password => 'customerpw', - :active => true, - :organization_id => nil, - :roles => roles, - :updated_at => '2015-02-05 16:37:00', - :updated_by_id => 1, - :created_by_id => 1, + login: 'user-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'user-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, + organization_id: nil, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) test 'a - check if ticket and organization has been updated' do ticket = Ticket.create( - :title => "some title1\n äöüß", - :group => Group.lookup( :name => 'Users'), - :customer_id => customer1.id, - :owner_id => agent1.id, - :state => Ticket::State.lookup( :name => 'new' ), - :priority => Ticket::Priority.lookup( :name => '2 normal' ), - :updated_by_id => 1, - :created_by_id => 1, + title: "some title1\n äöüß", + group: Group.lookup( name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup( name: 'new' ), + priority: Ticket::Priority.lookup( name: '2 normal' ), + updated_by_id: 1, + created_by_id: 1, ) assert( ticket, 'ticket created' ) assert_equal( ticket.customer.id, customer1.id ) diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index fa3667175..a194dc27c 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -5,239 +5,239 @@ class UserTest < ActiveSupport::TestCase test 'user' do tests = [ { - :name => '#1 - simple create', - :create => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'some@example.com', - :login => 'some@example.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#1 - simple create', + create: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some@example.com', + login: 'some@example.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :image => nil, - :fullname => 'Firstname Lastname', - :email => 'some@example.com', - :login => 'some@example.com', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + image: nil, + fullname: 'Firstname Lastname', + email: 'some@example.com', + login: 'some@example.com', }, }, { - :name => '#2 - simple create - no lastname', - :create => { - :firstname => 'Firstname Lastname', - :lastname => '', - :email => 'some@example.com', - :login => 'some@example.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#2 - simple create - no lastname', + create: { + firstname: 'Firstname Lastname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :image => nil, - :email => 'some@example.com', - :login => 'some@example.com', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + image: nil, + email: 'some@example.com', + login: 'some@example.com', }, }, { - :name => '#3 - simple create - nil as lastname', - :create => { - :firstname => 'Firstname Lastname', - :lastname => '', - :email => 'some@example.com', - :login => 'some@example.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#3 - simple create - nil as lastname', + create: { + firstname: 'Firstname Lastname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :image => nil, - :email => 'some@example.com', - :login => 'some@example.com', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + image: nil, + email: 'some@example.com', + login: 'some@example.com', }, }, { - :name => '#4 - simple create - no lastname, firstname with ","', - :create => { - :firstname => 'Lastname, Firstname', - :lastname => '', - :email => 'some@example.com', - :login => 'some@example.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#4 - simple create - no lastname, firstname with ","', + create: { + firstname: 'Lastname, Firstname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'some@example.com', - :login => 'some@example.com', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some@example.com', + login: 'some@example.com', }, }, { - :name => '#5 - simple create - no lastname/firstname', - :create => { - :firstname => '', - :lastname => '', - :email => 'firstname.lastname@example.com', - :login => 'login-1', - :updated_by_id => 1, - :created_by_id => 1, + name: '#5 - simple create - no lastname/firstname', + create: { + firstname: '', + lastname: '', + email: 'firstname.lastname@example.com', + login: 'login-1', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :fullname => 'Firstname Lastname', - :email => 'firstname.lastname@example.com', - :login => 'login-1', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + fullname: 'Firstname Lastname', + email: 'firstname.lastname@example.com', + login: 'login-1', }, }, { - :name => '#6 - simple create - no lastname/firstnam', - :create => { - :firstname => '', - :lastname => '', - :email => 'FIRSTNAME.lastname@example.com', - :login => 'login-2', - :updated_by_id => 1, - :created_by_id => 1, + name: '#6 - simple create - no lastname/firstnam', + create: { + firstname: '', + lastname: '', + email: 'FIRSTNAME.lastname@example.com', + login: 'login-2', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'firstname.lastname@example.com', - :login => 'login-2', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'firstname.lastname@example.com', + login: 'login-2', }, }, { - :name => '#7 - simple create - nill as fristname and lastname', - :create => { - :firstname => '', - :lastname => '', - :email => 'FIRSTNAME.lastname@example.com', - :login => 'login-3', - :updated_by_id => 1, - :created_by_id => 1, + name: '#7 - simple create - nill as fristname and lastname', + create: { + firstname: '', + lastname: '', + email: 'FIRSTNAME.lastname@example.com', + login: 'login-3', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'firstname.lastname@example.com', - :login => 'login-3', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'firstname.lastname@example.com', + login: 'login-3', }, }, { - :name => '#8 - update with avatar check', - :create => { - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'bob.smith@example.com', - :login => 'login-4', - :updated_by_id => 1, - :created_by_id => 1, + name: '#8 - update with avatar check', + create: { + firstname: 'Bob', + lastname: 'Smith', + email: 'bob.smith@example.com', + login: 'login-4', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Bob', - :lastname => 'Smith', - :image => nil, - :email => 'bob.smith@example.com', - :login => 'login-4', + create_verify: { + firstname: 'Bob', + lastname: 'Smith', + image: nil, + email: 'bob.smith@example.com', + login: 'login-4', }, - :update => { - :email => 'unit-test1@znuny.com', + update: { + email: 'unit-test1@znuny.com', }, - :update_verify => { - :firstname => 'Bob', - :lastname => 'Smith', - :image => 'a6f7f7f9dac25b2c023d403ef998801c', - :image_md5 => 'a6f7f7f9dac25b2c023d403ef998801c', - :email => 'unit-test1@znuny.com', - :login => 'login-4', + update_verify: { + firstname: 'Bob', + lastname: 'Smith', + image: 'a6f7f7f9dac25b2c023d403ef998801c', + image_md5: 'a6f7f7f9dac25b2c023d403ef998801c', + email: 'unit-test1@znuny.com', + login: 'login-4', } }, { - :name => '#9 - update create with avatar check', - :create => { - :firstname => 'Bob', - :lastname => 'Smith', - :email => 'unit-test2@znuny.com', - :login => 'login-5', - :updated_by_id => 1, - :created_by_id => 1, + name: '#9 - update create with avatar check', + create: { + firstname: 'Bob', + lastname: 'Smith', + email: 'unit-test2@znuny.com', + login: 'login-5', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Bob', - :lastname => 'Smith', - :image => '8765a1ac93f54405d8dfdd856c48c31f', - :image_md5 => '8765a1ac93f54405d8dfdd856c48c31f', - :email => 'unit-test2@znuny.com', - :login => 'login-5', + create_verify: { + firstname: 'Bob', + lastname: 'Smith', + image: '8765a1ac93f54405d8dfdd856c48c31f', + image_md5: '8765a1ac93f54405d8dfdd856c48c31f', + email: 'unit-test2@znuny.com', + login: 'login-5', }, - :update => { - :email => 'unit-test1@znuny.com', + update: { + email: 'unit-test1@znuny.com', }, - :update_verify => { - :firstname => 'Bob', - :lastname => 'Smith', - :image => 'a6f7f7f9dac25b2c023d403ef998801c', - :image_md5 => 'a6f7f7f9dac25b2c023d403ef998801c', - :email => 'unit-test1@znuny.com', - :login => 'login-5', + update_verify: { + firstname: 'Bob', + lastname: 'Smith', + image: 'a6f7f7f9dac25b2c023d403ef998801c', + image_md5: 'a6f7f7f9dac25b2c023d403ef998801c', + email: 'unit-test1@znuny.com', + login: 'login-5', } }, { - :name => '#10 - update create with login/email check', - :create => { - :firstname => '', - :lastname => '', - :email => 'caoyaoewfzfw@21222cn.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#10 - update create with login/email check', + create: { + firstname: '', + lastname: '', + email: 'caoyaoewfzfw@21222cn.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => '', - :lastname => '', - :fullname => 'caoyaoewfzfw@21222cn.com', - :email => 'caoyaoewfzfw@21222cn.com', - :login => 'caoyaoewfzfw@21222cn.com', + create_verify: { + firstname: '', + lastname: '', + fullname: 'caoyaoewfzfw@21222cn.com', + email: 'caoyaoewfzfw@21222cn.com', + login: 'caoyaoewfzfw@21222cn.com', }, - :update => { - :email => 'caoyaoewfzfw@212224cn.com', + update: { + email: 'caoyaoewfzfw@212224cn.com', }, - :update_verify => { - :firstname => '', - :lastname => '', - :email => 'caoyaoewfzfw@212224cn.com', - :fullname => 'caoyaoewfzfw@212224cn.com', - :login => 'caoyaoewfzfw@212224cn.com', + update_verify: { + firstname: '', + lastname: '', + email: 'caoyaoewfzfw@212224cn.com', + fullname: 'caoyaoewfzfw@212224cn.com', + login: 'caoyaoewfzfw@212224cn.com', } }, { - :name => '#11 - update create with login/email check', - :create => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'some_tEst11@example.com', - :updated_by_id => 1, - :created_by_id => 1, + name: '#11 - update create with login/email check', + create: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some_tEst11@example.com', + updated_by_id: 1, + created_by_id: 1, }, - :create_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :fullname => 'Firstname Lastname', - :email => 'some_test11@example.com', + create_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + fullname: 'Firstname Lastname', + email: 'some_test11@example.com', }, - :update => { - :email => 'some_Test11-1@example.com', + update: { + email: 'some_Test11-1@example.com', }, - :update_verify => { - :firstname => 'Firstname', - :lastname => 'Lastname', - :email => 'some_test11-1@example.com', - :fullname => 'Firstname Lastname', - :login => 'some_test11-1@example.com', + update_verify: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some_test11-1@example.com', + fullname: 'Firstname Lastname', + login: 'some_test11-1@example.com', } }, ] @@ -245,7 +245,7 @@ class UserTest < ActiveSupport::TestCase tests.each { |test| # check if user exists - user = User.where( :login => test[:create][:login] ).first + user = User.where( login: test[:create][:login] ).first if user user.destroy end diff --git a/test/unit/working_time_test.rb b/test/unit/working_time_test.rb index 598fbaa0f..03eeb7759 100644 --- a/test/unit/working_time_test.rb +++ b/test/unit/working_time_test.rb @@ -8,10 +8,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 1 { - :start => '2012-12-17 08:00:00', - :end => '2012-12-18 08:00:00', - :diff => 600, - :config => { + start: '2012-12-17 08:00:00', + end: '2012-12-18 08:00:00', + diff: 600, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -24,10 +24,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 2 { - :start => '2012-12-17 08:00:00', - :end => '2012-12-17 09:00:00', - :diff => 60, - :config => { + start: '2012-12-17 08:00:00', + end: '2012-12-17 09:00:00', + diff: 60, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -40,10 +40,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 3 { - :start => '2012-12-17 08:00:00', - :end => '2012-12-17 08:15:00', - :diff => 15, - :config => { + start: '2012-12-17 08:00:00', + end: '2012-12-17 08:15:00', + diff: 15, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -56,11 +56,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 4 { - :start => '2012-12-23 08:00:00', - :end => '2012-12-27 10:30:42', + start: '2012-12-23 08:00:00', + end: '2012-12-27 10:30:42', # :diff => 0, - :diff => 151, - :config => { + diff: 151, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -76,10 +76,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 5 { - :start => '2013-02-28 17:00:00', - :end => '2013-02-28 23:59:59', - :diff => 60, - :config => { + start: '2013-02-28 17:00:00', + end: '2013-02-28 23:59:59', + diff: 60, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -92,10 +92,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 6 { - :start => '2013-02-28 17:00:00', - :end => '2013-03-08 23:59:59', - :diff => 3660, - :config => { + start: '2013-02-28 17:00:00', + end: '2013-03-08 23:59:59', + diff: 3660, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -108,10 +108,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 7 { - :start => '2012-02-28 17:00:00', - :end => '2013-03-08 23:59:59', - :diff => 160_860, - :config => { + start: '2012-02-28 17:00:00', + end: '2013-03-08 23:59:59', + diff: 160_860, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -124,10 +124,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 8 { - :start => '2013-02-28 17:01:00', - :end => '2013-02-28 18:10:59', - :diff => 61, - :config => { + start: '2013-02-28 17:01:00', + end: '2013-02-28 18:10:59', + diff: 61, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -140,10 +140,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 9 { - :start => '2013-02-28 18:01:00', - :end => '2013-02-28 18:10:59', - :diff => 0, - :config => { + start: '2013-02-28 18:01:00', + end: '2013-02-28 18:10:59', + diff: 0, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -156,11 +156,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 10 / summertime { - :start => '2013-02-28 18:01:00', - :end => '2013-02-28 18:10:59', - :diff => 0, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-02-28 18:01:00', + end: '2013-02-28 18:10:59', + diff: 0, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -173,11 +173,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 11 / summertime { - :start => '2013-02-28 17:01:00', - :end => '2013-02-28 17:10:59', - :diff => 0, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-02-28 17:01:00', + end: '2013-02-28 17:10:59', + diff: 0, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -190,11 +190,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 12 / wintertime { - :start => '2013-08-29 17:01:00', - :end => '2013-08-29 17:10:59', - :diff => 0, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-08-29 17:01:00', + end: '2013-08-29 17:10:59', + diff: 0, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -207,11 +207,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 13 / summertime { - :start => '2013-02-28 16:01:00', - :end => '2013-02-28 16:10:59', - :diff => 10, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-02-28 16:01:00', + end: '2013-02-28 16:10:59', + diff: 10, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -224,11 +224,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 14 / wintertime { - :start => '2013-08-29 16:01:00', - :end => '2013-08-29 16:10:59', - :diff => 0, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-08-29 16:01:00', + end: '2013-08-29 16:10:59', + diff: 0, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -241,9 +241,9 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 15 { - :start => '2013-08-29 16:01:00', - :end => '2013-08-29 16:10:59', - :diff => 10, + start: '2013-08-29 16:01:00', + end: '2013-08-29 16:10:59', + diff: 10, }, ] tests.each { |test| @@ -257,10 +257,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 1 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-17 18:00:00', - :diff => 600, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-17 18:00:00', + diff: 600, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -273,10 +273,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 2 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-18 08:30:00', - :diff => 630, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-18 08:30:00', + diff: 630, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -289,10 +289,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 3 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-18 18:00:00', - :diff => 1200, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-18 18:00:00', + diff: 1200, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -305,10 +305,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 4 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-19 08:30:00', - :diff => 1230, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-19 08:30:00', + diff: 1230, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -321,10 +321,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 5 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-21 18:00:00', - :diff => 3000, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-21 18:00:00', + diff: 3000, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -338,10 +338,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 6 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-24 08:05:00', - :diff => 3005, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-24 08:05:00', + diff: 3005, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -354,10 +354,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 7 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-31 08:05:00', - :diff => 6005, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-31 08:05:00', + diff: 6005, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -370,10 +370,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 8 { - :start => '2012-12-17 08:00:00', - :dest_time => '2012-12-31 13:30:00', - :diff => 6330, - :config => { + start: '2012-12-17 08:00:00', + dest_time: '2012-12-31 13:30:00', + diff: 6330, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -386,10 +386,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 9 { - :start => '2013-04-12 21:20:15', - :dest_time => '2013-04-15 10:00:00', - :diff => 120, - :config => { + start: '2013-04-12 21:20:15', + dest_time: '2013-04-15 10:00:00', + diff: 120, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -402,11 +402,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 11 / summertime 7am-5pm { - :start => '2013-03-08 21:20:15', - :dest_time => '2013-03-11 09:00:00', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-03-08 21:20:15', + dest_time: '2013-03-11 09:00:00', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -419,11 +419,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 12 / wintertime 6am-4pm { - :start => '2013-09-06 21:20:15', - :dest_time => '2013-09-09 08:00:00', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-09-06 21:20:15', + dest_time: '2013-09-09 08:00:00', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -436,11 +436,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 13 / wintertime - 7am-4pm { - :start => '2013-10-21 06:30:00', - :dest_time => '2013-10-21 09:00:00', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-10-21 06:30:00', + dest_time: '2013-10-21 09:00:00', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -453,11 +453,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 14 / wintertime - 7am-4pm { - :start => '2013-10-21 04:34:15', - :dest_time => '2013-10-21 09:00:00', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-10-21 04:34:15', + dest_time: '2013-10-21 09:00:00', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -470,11 +470,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 15 / wintertime - 7am-4pm { - :start => '2013-10-20 22:34:15', - :dest_time => '2013-10-21 09:00:00', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-10-20 22:34:15', + dest_time: '2013-10-21 09:00:00', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -487,11 +487,11 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 16 / wintertime - 7am-4pm { - :start => '2013-10-21 07:00:15', - :dest_time => '2013-10-21 09:00:15', - :diff => 120, - :timezone => 'Europe/Berlin', - :config => { + start: '2013-10-21 07:00:15', + dest_time: '2013-10-21 09:00:15', + diff: 120, + timezone: 'Europe/Berlin', + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -504,24 +504,24 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 17 { - :start => '2013-10-21 04:01:00', - :dest_time => '2013-10-21 06:00:00', - :diff => 119, + start: '2013-10-21 04:01:00', + dest_time: '2013-10-21 06:00:00', + diff: 119, }, # test 18 { - :start => '2013-10-21 04:01:00', - :dest_time => '2013-10-21 04:01:00', - :diff => 0, + start: '2013-10-21 04:01:00', + dest_time: '2013-10-21 04:01:00', + diff: 0, }, # test 19 { - :start => '2013-04-12 21:20:15', - :dest_time => '2013-04-12 21:20:15', - :diff => 0, - :config => { + start: '2013-04-12 21:20:15', + dest_time: '2013-04-12 21:20:15', + diff: 0, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true, @@ -534,10 +534,10 @@ class WorkingTimeTest < ActiveSupport::TestCase # test 20 { - :start => '2013-04-12 11:20:15', - :dest_time => '2013-04-12 11:21:15', - :diff => 1, - :config => { + start: '2013-04-12 11:20:15', + dest_time: '2013-04-12 11:21:15', + diff: 1, + config: { 'Mon' => true, 'Tue' => true, 'Wed' => true,