From ba3f868638c074a461c72306aa6f6a0c3a79c67b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 1 Mar 2016 15:26:46 +0100 Subject: [PATCH] Upgrade to new rubocop. --- app/controllers/tickets_controller.rb | 2 +- app/models/activity_stream.rb | 2 +- app/models/application_model.rb | 6 +- app/models/calendar.rb | 2 +- app/models/channel/driver/facebook.rb | 2 +- app/models/channel/driver/twitter.rb | 4 +- app/models/locale.rb | 4 +- .../communicate_email/background_job.rb | 4 +- .../ticket/article/communicate_facebook.rb | 8 +- .../ticket/article/communicate_twitter.rb | 10 +- .../ticket/article/fillup_from_email.rb | 2 +- app/models/observer/ticket/notification.rb | 2 +- .../ticket/notification/background_job.rb | 2 +- app/models/package.rb | 18 ++-- app/models/setting.rb | 4 +- app/models/store.rb | 4 +- app/models/store/file.rb | 4 +- app/models/store/provider/file.rb | 6 +- app/models/ticket.rb | 24 ++--- app/models/ticket/escalation.rb | 2 +- app/models/ticket/number.rb | 6 +- app/models/ticket/overviews.rb | 2 +- app/models/ticket/state.rb | 2 +- app/models/translation.rb | 4 +- lib/application_lib.rb | 2 +- lib/auto_wizard.rb | 2 +- lib/external_credential/facebook.rb | 3 +- lib/external_credential/twitter.rb | 2 +- lib/facebook.rb | 2 +- lib/import/otrs.rb | 12 +-- lib/import/zendesk.rb | 2 +- lib/models.rb | 2 +- lib/report/base.rb | 6 +- lib/report/ticket_generic_time.rb | 8 +- lib/report/ticket_moved.rb | 2 +- lib/rss.rb | 2 +- lib/search_index_backend.rb | 10 +- lib/service/geo_calendar/zammad.rb | 2 +- lib/service/geo_ip/zammad.rb | 2 +- lib/sessions/backend/activity_stream.rb | 10 +- lib/sessions/backend/collections.rb | 4 +- lib/sessions/backend/collections/base.rb | 6 +- .../backend/collections/organization.rb | 2 +- lib/sessions/backend/rss.rb | 12 +-- lib/sessions/backend/ticket_create.rb | 6 +- lib/sessions/backend/ticket_overview_index.rb | 6 +- lib/sessions/backend/ticket_overview_list.rb | 8 +- lib/static_assets.rb | 4 +- lib/tasks/test_browser.rake | 2 +- lib/tweet_base.rb | 11 +-- lib/user_agent.rb | 4 +- script/build/test_slice_tests.sh | 2 + test/browser_test_helper.rb | 92 +++++++++---------- test/integration/elasticsearch_test.rb | 4 +- test/integration/email_helper_test.rb | 12 +-- test/integration/facebook_browser_test.rb | 12 +-- test/integration/facebook_test.rb | 6 +- test/integration/otrs_import_browser_test.rb | 4 +- test/integration/otrs_import_test.rb | 4 +- test/integration/report_test.rb | 4 +- test/integration/twitter_browser_test.rb | 12 +-- test/integration/twitter_test.rb | 16 ++-- .../zendesk_import_browser_test.rb | 6 +- test/integration/zendesk_import_test.rb | 6 +- 64 files changed, 221 insertions(+), 219 deletions(-) diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 1970c8311..318bc0f4d 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -354,7 +354,7 @@ class TicketsController < ApplicationController def stats if !params[:user_id] && !params[:organization_id] - fail 'Need user_id or organization_id as param' + raise 'Need user_id or organization_id as param' end # permission check diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb index 65393eb40..55dd0cd4c 100644 --- a/app/models/activity_stream.rb +++ b/app/models/activity_stream.rb @@ -34,7 +34,7 @@ add a new activity entry for an object if data[:role] role = Role.lookup(name: data[:role]) if !role - fail "No such Role #{data[:role]}" + raise "No such Role #{data[:role]}" end role_id = role.id end diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 68b038abb..92731b4f2 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -71,7 +71,7 @@ returns def self.param_cleanup(params, newObject = false) if params.nil? - fail "No params for #{self}!" + raise "No params for #{self}!" end # ignore id for new objects @@ -377,7 +377,7 @@ returns return end - fail 'Need name, id, login or email for lookup()' + raise 'Need name, id, login or email for lookup()' end =begin @@ -535,7 +535,7 @@ returns record.save return record else - fail 'Need name, login, email or locale for create_or_update()' + raise 'Need name, login, email or locale for create_or_update()' end end diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 28c1609bd..a91fa8bf5 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -268,7 +268,7 @@ returns if location =~ /^http/i result = UserAgent.get(location) if !result.success? - fail result.error + raise result.error end cal_file = result.body else diff --git a/app/models/channel/driver/facebook.rb b/app/models/channel/driver/facebook.rb index 83dd77836..45d66eace 100644 --- a/app/models/channel/driver/facebook.rb +++ b/app/models/channel/driver/facebook.rb @@ -29,7 +29,7 @@ class Channel::Driver::Facebook access_token = page['access_token'] } if !access_token - fail "No access_token found for fb_object_id: #{fb_object_id}" + raise "No access_token found for fb_object_id: #{fb_object_id}" end client = Facebook.new(access_token) client.from_article(article) diff --git a/app/models/channel/driver/twitter.rb b/app/models/channel/driver/twitter.rb index 2c6ce14ad..fe3ceb3d8 100644 --- a/app/models/channel/driver/twitter.rb +++ b/app/models/channel/driver/twitter.rb @@ -184,7 +184,7 @@ returns def stream sync = @channel.options['sync'] - fail 'Need channel.options[\'sync\'] for account, but no params found' if !sync + raise 'Need channel.options[\'sync\'] for account, but no params found' if !sync filter = {} if sync['search'] @@ -315,7 +315,7 @@ returns def check_external_credential(options) if options[:auth] && options[:auth][:external_credential_id] external_credential = ExternalCredential.find_by(id: options[:auth][:external_credential_id]) - fail "No such ExternalCredential.find(#{options[:auth][:external_credential_id]})" if !external_credential + raise "No such ExternalCredential.find(#{options[:auth][:external_credential_id]})" if !external_credential options[:auth][:consumer_key] = external_credential.credentials['consumer_key'] options[:auth][:consumer_secret] = external_credential.credentials['consumer_secret'] end diff --git a/app/models/locale.rb b/app/models/locale.rb index 4d9496c95..7332ea10f 100644 --- a/app/models/locale.rb +++ b/app/models/locale.rb @@ -26,8 +26,8 @@ class Locale < ApplicationModel } ) - fail "Can't load locales from #{url}" if !result - fail "Can't load locales from #{url}: #{result.error}" if !result.success? + raise "Can't load locales from #{url}" if !result + raise "Can't load locales from #{url}: #{result.error}" if !result.success? ActiveRecord::Base.transaction do result.data.each {|locale| 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 049c3eacc..5c9933793 100644 --- a/app/models/observer/ticket/article/communicate_email/background_job.rb +++ b/app/models/observer/ticket/article/communicate_email/background_job.rb @@ -12,9 +12,9 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob # send email if !ticket.group.email_address_id - fail "Can't send email, no email address definde for group id '#{ticket.group.id}'" + raise "Can't send email, no email address definde for group id '#{ticket.group.id}'" elsif !ticket.group.email_address.channel_id - fail "Can't send email, no channel definde for email_address id '#{ticket.group.email_address_id}'" + raise "Can't send email, no channel definde for email_address id '#{ticket.group.email_address_id}'" end channel = ticket.group.email_address.channel diff --git a/app/models/observer/ticket/article/communicate_facebook.rb b/app/models/observer/ticket/article/communicate_facebook.rb index 9c359c793..ea6387284 100644 --- a/app/models/observer/ticket/article/communicate_facebook.rb +++ b/app/models/observer/ticket/article/communicate_facebook.rb @@ -20,15 +20,15 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer return if type['name'] !~ /\Afacebook/ ticket = Ticket.lookup(id: record.ticket_id) - fail "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences - fail "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id'] + raise "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences + raise "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id'] channel = Channel.lookup(id: ticket.preferences['channel_id']) - fail "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Afacebook/i + raise "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Afacebook/i # check source object id ticket = record.ticket if !ticket.preferences['channel_fb_object_id'] - fail "fb object id is missing in ticket.preferences['channel_fb_object_id'] for Ticket.find(#{ticket.id})" + raise "fb object id is missing in ticket.preferences['channel_fb_object_id'] for Ticket.find(#{ticket.id})" end # fill in_reply_to diff --git a/app/models/observer/ticket/article/communicate_twitter.rb b/app/models/observer/ticket/article/communicate_twitter.rb index 45d63a27e..b878a12b4 100644 --- a/app/models/observer/ticket/article/communicate_twitter.rb +++ b/app/models/observer/ticket/article/communicate_twitter.rb @@ -18,11 +18,11 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer return if type['name'] !~ /\Atwitter/i ticket = Ticket.lookup(id: record.ticket_id) - fail "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences - fail "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id'] + raise "Can't find ticket.preferences for Ticket.find(#{record.ticket_id})" if !ticket.preferences + raise "Can't find ticket.preferences['channel_id'] for Ticket.find(#{record.ticket_id})" if !ticket.preferences['channel_id'] channel = Channel.lookup(id: ticket.preferences['channel_id']) - fail "No such channel id #{ticket.preferences['channel_id']}" if !channel - fail "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Atwitter/i + raise "No such channel id #{ticket.preferences['channel_id']}" if !channel + raise "Channel.find(#{channel.id}) isn't a twitter channel!" if channel.options[:adapter] !~ /\Atwitter/i tweet = channel.deliver( type: type['name'], to: record.to, @@ -54,7 +54,7 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer record.preferences[:twitter_mention_ids] = twitter_mention_ids end else - fail "Unknown tweet type '#{tweet.class}'" + raise "Unknown tweet type '#{tweet.class}'" end record.message_id = tweet.id diff --git a/app/models/observer/ticket/article/fillup_from_email.rb b/app/models/observer/ticket/article/fillup_from_email.rb index beb9f3a05..5a75064c9 100644 --- a/app/models/observer/ticket/article/fillup_from_email.rb +++ b/app/models/observer/ticket/article/fillup_from_email.rb @@ -38,7 +38,7 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer # set sender email_address = ticket.group.email_address if !email_address - fail "No email address found for group '#{ticket.group.name}'" + raise "No email address found for group '#{ticket.group.name}'" end system_sender = "#{email_address.realname} <#{email_address.email}>" if Setting.get('ticket_define_email_from') == 'AgentNameSystemAddressName' diff --git a/app/models/observer/ticket/notification.rb b/app/models/observer/ticket/notification.rb index 202cfcd35..5cecc0dd8 100644 --- a/app/models/observer/ticket/notification.rb +++ b/app/models/observer/ticket/notification.rb @@ -105,7 +105,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer end end else - fail "unknown object for notification #{event[:name]}" + raise "unknown object for notification #{event[:name]}" end } list_objects diff --git a/app/models/observer/ticket/notification/background_job.rb b/app/models/observer/ticket/notification/background_job.rb index 2c697b000..7f3cea77d 100644 --- a/app/models/observer/ticket/notification/background_job.rb +++ b/app/models/observer/ticket/notification/background_job.rb @@ -162,7 +162,7 @@ class Observer::Ticket::Notification::BackgroundJob elsif @p[:type] == 'escalation_warning' template = 'ticket_escalation_warning' else - fail "unknown type for notification #{@p[:type]}" + raise "unknown type for notification #{@p[:type]}" end NotificationFactory.notification( diff --git a/app/models/package.rb b/app/models/package.rb index 5c429c0e7..41c93a13c 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -103,7 +103,7 @@ note: will not take down package migrations, use Package.unlink instead package = entry.sub(%r{^.*/(.+?)\.szpm$}, '\1') end if package == false - fail "Can't link package, '#{package_base_dir}' is no package source directory!" + raise "Can't link package, '#{package_base_dir}' is no package source directory!" end logger.debug package.inspect package @@ -184,7 +184,7 @@ link files + execute migration up if File.file?(entry.to_s) && (File.file?(dest.to_s) && !File.symlink?(dest.to_s)) backup_file = dest.to_s + '.link_backup' if File.exist?(backup_file) - fail "Can't link #{entry} -> #{dest}, destination and .link_backup already exists!" + raise "Can't link #{entry} -> #{dest}, destination and .link_backup already exists!" else logger.info "Create backup file of #{dest} -> #{backup_file}." File.rename(dest.to_s, backup_file) @@ -243,10 +243,10 @@ returns if package_db if !data[:reinstall] if Gem::Version.new(package_db.version) == Gem::Version.new(meta[:version]) - fail "Package '#{meta[:name]}-#{meta[:version]}' already installed!" + raise "Package '#{meta[:name]}-#{meta[:version]}' already installed!" end if Gem::Version.new(package_db.version) > Gem::Version.new(meta[:version]) - fail "Newer version (#{package_db.version}) of package '#{meta[:name]}-#{meta[:version]}' already installed!" + raise "Newer version (#{package_db.version}) of package '#{meta[:name]}-#{meta[:version]}' already installed!" end end @@ -306,7 +306,7 @@ returns def self.reinstall(package_name) package = Package.find_by(name: package_name) if !package - fail "No such package '#{package_name}'" + raise "No such package '#{package_name}'" end file = _get_bin(package.name, package.version) install(string: file, reinstall: true) @@ -367,7 +367,7 @@ returns version: version, ) if !package - fail "No such package '#{name}' version '#{version}'" + raise "No such package '#{name}' version '#{version}'" end list = Store.list( object: 'Package', @@ -376,10 +376,10 @@ returns # find file if !list || !list.first - fail "No such file in storage list #{name} #{version}" + raise "No such file in storage list #{name} #{version}" end if !list.first.content - fail "No such file in storage #{name} #{version}" + raise "No such file in storage #{name} #{version}" end list.first.content end @@ -497,7 +497,7 @@ returns name = $2 end if !version || !name - fail "Invalid package migration '#{migration}'" + raise "Invalid package migration '#{migration}'" end # down diff --git a/app/models/setting.rb b/app/models/setting.rb index 2485f3d52..84d4203b6 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -33,7 +33,7 @@ set config setting def self.set(name, value) setting = Setting.find_by( name: name ) if !setting - fail "Can't find config setting '#{name}'" + raise "Can't find config setting '#{name}'" end setting.state_current = { value: value } setting.save @@ -68,7 +68,7 @@ reset config setting to default def self.reset(name) setting = Setting.find_by( name: name ) if !setting - fail "Can't find config setting '#{name}'" + raise "Can't find config setting '#{name}'" end setting.state_current = setting.state_initial setting.save diff --git a/app/models/store.rb b/app/models/store.rb index 0e82989ef..53418d336 100644 --- a/app/models/store.rb +++ b/app/models/store.rb @@ -142,7 +142,7 @@ returns def content file = Store::File.find_by(id: store_file_id) if !file - fail "No such file #{store_file_id}!" + raise "No such file #{store_file_id}!" end file.content end @@ -150,7 +150,7 @@ returns def provider file = Store::File.find_by(id: store_file_id) if !file - fail "No such file #{store_file_id}!" + raise "No such file #{store_file_id}!" end file.provider end diff --git a/app/models/store/file.rb b/app/models/store/file.rb index 4004f703e..7aca3cf8e 100644 --- a/app/models/store/file.rb +++ b/app/models/store/file.rb @@ -26,7 +26,7 @@ do also verify of written data # load backend based on config adapter_name = Setting.get('storage_provider') || 'DB' if !adapter_name - fail 'Missing storage_provider setting option' + raise 'Missing storage_provider setting option' end adapter = load_adapter("Store::Provider::#{adapter_name}") adapter.add(data, sha) @@ -40,7 +40,7 @@ do also verify of written data read_data = adapter.get(sha) read_sha = Digest::SHA256.hexdigest(read_data) if sha != read_sha - fail "Content not written correctly (provider #{adapter_name})." + raise "Content not written correctly (provider #{adapter_name})." end end end diff --git a/app/models/store/provider/file.rb b/app/models/store/provider/file.rb index 8aab3964f..cc0d936bf 100644 --- a/app/models/store/provider/file.rb +++ b/app/models/store/provider/file.rb @@ -18,7 +18,7 @@ class Store::Provider::File # check sha local_sha = Digest::SHA256.hexdigest(get(sha)) if sha != local_sha - fail "ERROR: Corrupt file in fs #{location}, sha should be #{sha} but is #{local_sha}" + raise "ERROR: Corrupt file in fs #{location}, sha should be #{sha} but is #{local_sha}" end true @@ -29,7 +29,7 @@ class Store::Provider::File location = get_location(sha) Rails.logger.debug "read from fs #{location}" if !File.exist?(location) - fail "ERROR: No such file #{location}" + raise "ERROR: No such file #{location}" end data = File.open(location, 'rb') content = data.read @@ -37,7 +37,7 @@ class Store::Provider::File # check sha local_sha = Digest::SHA256.hexdigest(content) if local_sha != sha - fail "ERROR: Corrupt file in fs #{location}, sha should be #{sha} but is #{local_sha}" + raise "ERROR: Corrupt file in fs #{location}, sha should be #{sha} but is #{local_sha}" end content end diff --git a/app/models/ticket.rb b/app/models/ticket.rb index a4136218c..804798824 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -367,7 +367,7 @@ get count of tickets and tickets which match on selector =end def self.selectors(selectors, limit = 10, current_user = nil) - fail 'no selectors given' if !selectors + raise 'no selectors given' if !selectors query, bind_params, tables = selector2sql(selectors, current_user) return [] if !query @@ -454,7 +454,7 @@ condition example tables += ', users owners' query += 'tickets.owner_id = owners.id' else - fail "invalid selector #{attribute.inspect}->#{selector.inspect}" + raise "invalid selector #{attribute.inspect}->#{selector.inspect}" end } @@ -462,10 +462,10 @@ condition example selectors.each {|attribute, selector_raw| # validation - fail "Invalid selector #{selector_raw.inspect}" if !selector_raw - fail "Invalid selector #{selector_raw.inspect}" if !selector_raw.respond_to?(:key?) + raise "Invalid selector #{selector_raw.inspect}" if !selector_raw + raise "Invalid selector #{selector_raw.inspect}" if !selector_raw.respond_to?(:key?) selector = selector_raw.stringify_keys - fail "Invalid selector, operator missing #{selector.inspect}" if !selector['operator'] + raise "Invalid selector, operator missing #{selector.inspect}" if !selector['operator'] # validate value / allow empty but only if pre_condition exists if (selector['value'].class == String || selector['value'].class == Array) && (selector['value'].respond_to?(:empty?) && selector['value'].empty?) @@ -492,11 +492,11 @@ condition example query += "#{attribute} IS NOT NULL" end elsif selector['pre_condition'] == 'current_user.id' - fail "Use current_user.id in selector, but no current_user is set #{selector.inspect}" if !current_user_id + raise "Use current_user.id in selector, but no current_user is set #{selector.inspect}" if !current_user_id query += "#{attribute} IN (?)" bind_params.push current_user_id elsif selector['pre_condition'] == 'current_user.organization_id' - fail "Use current_user.id in selector, but no current_user is set #{selector.inspect}" if !current_user_id + raise "Use current_user.id in selector, but no current_user is set #{selector.inspect}" if !current_user_id query += "#{attribute} IN (?)" user = User.lookup(id: current_user_id) bind_params.push user.organization_id @@ -563,7 +563,7 @@ condition example elsif selector['range'] == 'year' time = Time.zone.now - selector['value'].to_i.years else - fail "Unknown selector attributes '#{selector.inspect}'" + raise "Unknown selector attributes '#{selector.inspect}'" end bind_params.push time elsif selector['operator'] == 'within next (relative)' @@ -580,7 +580,7 @@ condition example elsif selector['range'] == 'year' time = Time.zone.now + selector['value'].to_i.years else - fail "Unknown selector attributes '#{selector.inspect}'" + raise "Unknown selector attributes '#{selector.inspect}'" end bind_params.push time elsif selector['operator'] == 'before (relative)' @@ -597,7 +597,7 @@ condition example elsif selector['range'] == 'year' time = Time.zone.now - selector['value'].to_i.years else - fail "Unknown selector attributes '#{selector.inspect}'" + raise "Unknown selector attributes '#{selector.inspect}'" end bind_params.push time elsif selector['operator'] == 'after (relative)' @@ -614,11 +614,11 @@ condition example elsif selector['range'] == 'year' time = Time.zone.now + selector['value'].to_i.years else - fail "Unknown selector attributes '#{selector.inspect}'" + raise "Unknown selector attributes '#{selector.inspect}'" end bind_params.push time else - fail "Invalid operator '#{selector['operator']}' for '#{selector['value'].inspect}'" + raise "Invalid operator '#{selector['operator']}' for '#{selector['value'].inspect}'" end } [query, bind_params, tables] diff --git a/app/models/ticket/escalation.rb b/app/models/ticket/escalation.rb index 1d1ee42a1..996d26a69 100644 --- a/app/models/ticket/escalation.rb +++ b/app/models/ticket/escalation.rb @@ -84,7 +84,7 @@ returns } config.hours = hours if !hours || hours.empty? - fail "No congifure hours found in calendar #{calendar.inspect}" + raise "No congifure hours found in calendar #{calendar.inspect}" end # get holidays diff --git a/app/models/ticket/number.rb b/app/models/ticket/number.rb index d5fde9ac6..2936721c7 100644 --- a/app/models/ticket/number.rb +++ b/app/models/ticket/number.rb @@ -23,7 +23,7 @@ returns ticket = Ticket.find_by( number: number ) return number if !ticket } - fail "Can't generate new ticket number!" + raise "Can't generate new ticket number!" end =begin @@ -47,11 +47,11 @@ returns # load backend based on config adapter_name = Setting.get('ticket_number') if !adapter_name - fail 'Missing ticket_number setting option' + raise 'Missing ticket_number setting option' end adapter = load_adapter(adapter_name) if !adapter - fail "Can't load ticket_number adapter '#{adapter_name}'" + raise "Can't load ticket_number adapter '#{adapter_name}'" end adapter end diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index 16a6623f6..ba13238d6 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -72,7 +72,7 @@ returns } if data[:view] && !overview_selected - fail "No such view '#{data[:view]}'" + raise "No such view '#{data[:view]}'" end # get only tickets with permissions diff --git a/app/models/ticket/state.rb b/app/models/ticket/state.rb index 5ebe899ea..4abf0d45e 100644 --- a/app/models/ticket/state.rb +++ b/app/models/ticket/state.rb @@ -43,7 +43,7 @@ returns: state_type_id: Ticket::StateType.where( name: %w(closed) ) ) end - fail "Unknown category '#{category}'" + raise "Unknown category '#{category}'" end =begin diff --git a/app/models/translation.rb b/app/models/translation.rb index 629891564..aca7a7399 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -44,7 +44,7 @@ dedicated: read_timeout: 16, } ) - fail "Can't load translations from #{url}: #{result.error}" if !result.success? + raise "Can't load translations from #{url}: #{result.error}" if !result.success? translations = Translation.where(locale: locale).all ActiveRecord::Base.transaction do @@ -120,7 +120,7 @@ push translations to online read_timeout: 16, } ) - fail "Can't push translations to #{url}: #{result.error}" if !result.success? + raise "Can't push translations to #{url}: #{result.error}" if !result.success? # set new translator_key if given if result.data['translator_key'] diff --git a/lib/application_lib.rb b/lib/application_lib.rb index 8eb8f5fce..53ab30f2b 100644 --- a/lib/application_lib.rb +++ b/lib/application_lib.rb @@ -54,7 +54,7 @@ returns adapter = adapter.constantize if !adapter - fail "Can't load adapter '#{adapter_name}'" + raise "Can't load adapter '#{adapter_name}'" end adapter diff --git a/lib/auto_wizard.rb b/lib/auto_wizard.rb index 7e3adf04f..f69c521f0 100644 --- a/lib/auto_wizard.rb +++ b/lib/auto_wizard.rb @@ -32,7 +32,7 @@ returns def self.data auto_wizard_file_location = file_location - fail "So such file #{auto_wizard_file_location}" if !File.file?(auto_wizard_file_location) + raise "So such file #{auto_wizard_file_location}" if !File.file?(auto_wizard_file_location) JSON.parse( File.read(auto_wizard_file_location) ) end diff --git a/lib/external_credential/facebook.rb b/lib/external_credential/facebook.rb index 689007320..926eb6eb0 100644 --- a/lib/external_credential/facebook.rb +++ b/lib/external_credential/facebook.rb @@ -23,6 +23,7 @@ class ExternalCredential::Facebook state = rand(999_999_999_999).to_s { request_token: state, + #authorize_url: oauth.url_for_oauth_code(permissions: 'publish_pages, manage_pages, user_posts', state: state), authorize_url: oauth.url_for_oauth_code(permissions: 'publish_pages, manage_pages', state: state), } end @@ -30,7 +31,7 @@ class ExternalCredential::Facebook def self.link_account(_request_token, params) # fail if request_token.params[:oauth_token] != params[:state] external_credential = ExternalCredential.find_by(name: 'facebook') - fail 'No such account' if !external_credential + raise 'No such account' if !external_credential oauth = Koala::Facebook::OAuth.new( external_credential.credentials['application_id'], external_credential.credentials['application_secret'], diff --git a/lib/external_credential/twitter.rb b/lib/external_credential/twitter.rb index 77831a94f..d2659413b 100644 --- a/lib/external_credential/twitter.rb +++ b/lib/external_credential/twitter.rb @@ -27,7 +27,7 @@ class ExternalCredential::Twitter end def self.link_account(request_token, params) - fail if request_token.params[:oauth_token] != params[:oauth_token] + raise if request_token.params[:oauth_token] != params[:oauth_token] external_credential = ExternalCredential.find_by(name: 'twitter') access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier]) client = Twitter::REST::Client.new( diff --git a/lib/facebook.rb b/lib/facebook.rb index cb49a52d5..5df6bf5fc 100644 --- a/lib/facebook.rb +++ b/lib/facebook.rb @@ -309,7 +309,7 @@ result Rails.logger.debug 'Create feed comment from article...' post = @client.put_comment(article[:in_reply_to], article[:body]) else - fail "Can't handle unknown facebook article type '#{article[:type]}'." + raise "Can't handle unknown facebook article type '#{article[:type]}'." end Rails.logger.debug post.inspect @client.get_object(post['id']) diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index 230c49345..b0e60417f 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -23,14 +23,14 @@ module Import::OTRS def self.request_json(data, data_only = false) response = post(data) if !response - fail "Can't connect to Zammad Migrator" + raise "Can't connect to Zammad Migrator" end if !response.success? - fail "Can't connect to Zammad Migrator" + raise "Can't connect to Zammad Migrator" end result = json(response) if !result - fail 'Invalid response' + raise 'Invalid response' end if data_only result['Result'] @@ -303,12 +303,12 @@ module Import::OTRS # check if system is in import mode if !Setting.get('import_mode') - fail 'System is not in import mode!' + raise 'System is not in import mode!' end result = request_json({}) if !result['Success'] - fail 'API key not valid!' + raise 'API key not valid!' end # set settings @@ -495,7 +495,7 @@ module Import::OTRS # check if system is in import mode if !Setting.get('import_mode') - fail 'System is not in import mode!' + raise 'System is not in import mode!' end # create states diff --git a/lib/import/zendesk.rb b/lib/import/zendesk.rb index a2e4a46d7..a86261e77 100644 --- a/lib/import/zendesk.rb +++ b/lib/import/zendesk.rb @@ -12,7 +12,7 @@ module Import::Zendesk # check if system is in import mode if !Setting.get('import_mode') - fail 'System is not in import mode!' + raise 'System is not in import mode!' end initialize_client diff --git a/lib/models.rb b/lib/models.rb index 4b7fb4541..357a6d495 100644 --- a/lib/models.rb +++ b/lib/models.rb @@ -215,7 +215,7 @@ returns if force total = references_total(object_name, object_id_to_merge) if total > 1000 - fail "Can't merge object because object has more then 1000 (#{total}) references, please contact your system administrator." + raise "Can't merge object because object has more then 1000 (#{total}) references, please contact your system administrator." end end diff --git a/lib/report/base.rb b/lib/report/base.rb index 249102146..21283bee0 100644 --- a/lib/report/base.rb +++ b/lib/report/base.rb @@ -98,9 +98,9 @@ class Report::Base ).count end - fail "UNKOWN params (#{params.inspect})!" + raise "UNKOWN params (#{params.inspect})!" end - fail "UNKOWN :type (#{params[:type]})!" + raise "UNKOWN :type (#{params[:type]})!" end # :object @@ -219,7 +219,7 @@ class Report::Base ticket_ids: ticket_ids, } end - fail "UNKOWN :type (#{data[:type]})!" + raise "UNKOWN :type (#{data[:type]})!" end # :type diff --git a/lib/report/ticket_generic_time.rb b/lib/report/ticket_generic_time.rb index b913a19de..b557a3a53 100644 --- a/lib/report/ticket_generic_time.rb +++ b/lib/report/ticket_generic_time.rb @@ -56,16 +56,16 @@ returns (1..stop_interval).each {|_counter| match = false if !result_es - fail "Invalid es result #{result_es.inspect}" + raise "Invalid es result #{result_es.inspect}" end if !result_es['aggregations'] - fail "Invalid es result, no aggregations #{result_es.inspect}" + raise "Invalid es result, no aggregations #{result_es.inspect}" end if !result_es['aggregations']['time_buckets'] - fail "Invalid es result, no time_buckets #{result_es.inspect}" + raise "Invalid es result, no time_buckets #{result_es.inspect}" end if !result_es['aggregations']['time_buckets']['buckets'] - fail "Invalid es result, no buckets #{result_es.inspect}" + raise "Invalid es result, no buckets #{result_es.inspect}" end result_es['aggregations']['time_buckets']['buckets'].each {|item| if params[:interval] == 'minute' diff --git a/lib/report/ticket_moved.rb b/lib/report/ticket_moved.rb index 61265e5b2..b9302231e 100644 --- a/lib/report/ticket_moved.rb +++ b/lib/report/ticket_moved.rb @@ -160,6 +160,6 @@ returns } end end - fail "Unknown selector params '#{selector.inspect}'" + raise "Unknown selector params '#{selector.inspect}'" end end diff --git a/lib/rss.rb b/lib/rss.rb index d83ce8f2d..34de4bb7f 100644 --- a/lib/rss.rb +++ b/lib/rss.rb @@ -9,7 +9,7 @@ module Rss Rails.logger.info "fetch rss... #{url}" response = UserAgent.request(url) if !response.success? - fail "Can't fetch '#{url}', http code: #{response.code}" + raise "Can't fetch '#{url}', http code: #{response.code}" end rss = SimpleRSS.parse response.body items = [] diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 6b417d55a..3b9e8ebab 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -59,7 +59,7 @@ create/update/delete index ) Rails.logger.info "# #{response.code}" return true if response.success? - fail response.inspect + raise response.inspect end =begin @@ -91,7 +91,7 @@ add new object to search index ) Rails.logger.info "# #{response.code}" return true if response.success? - fail response.inspect + raise response.inspect end =begin @@ -270,7 +270,7 @@ get count of tickets and tickets which match on selector =end def self.selectors(index = nil, selectors = nil, limit = 10, current_user = nil, aggs_interval = nil) - fail 'no selectors given' if !selectors + raise 'no selectors given' if !selectors url = build_url() return if !url @@ -303,7 +303,7 @@ get count of tickets and tickets which match on selector Rails.logger.info "# #{response.code}" if !response.success? - fail "ERROR: #{response.inspect}" + raise "ERROR: #{response.inspect}" end Rails.logger.debug response.data.to_json @@ -345,7 +345,7 @@ get count of tickets and tickets which match on selector elsif data['operator'] == 'contains not' query_must_not.push t else - fail "unknown operator '#{data['operator']}'" + raise "unknown operator '#{data['operator']}'" end } end diff --git a/lib/service/geo_calendar/zammad.rb b/lib/service/geo_calendar/zammad.rb index 22252a51e..7b01d2422 100644 --- a/lib/service/geo_calendar/zammad.rb +++ b/lib/service/geo_calendar/zammad.rb @@ -30,7 +30,7 @@ class Service::GeoCalendar::Zammad }, ) if !response.success? && response.code.to_s !~ /^40.$/ - fail "ERROR: #{response.code}/#{response.body}" + raise "ERROR: #{response.code}/#{response.body}" end data = response.data diff --git a/lib/service/geo_ip/zammad.rb b/lib/service/geo_ip/zammad.rb index 7e8014845..7820a50f3 100644 --- a/lib/service/geo_ip/zammad.rb +++ b/lib/service/geo_ip/zammad.rb @@ -26,7 +26,7 @@ class Service::GeoIp::Zammad }, ) if !response.success? && response.code.to_s !~ /^40.$/ - fail "ERROR: #{response.code}/#{response.body}" + raise "ERROR: #{response.code}/#{response.body}" end data = response.data diff --git a/lib/sessions/backend/activity_stream.rb b/lib/sessions/backend/activity_stream.rb index d3ee37ec4..e91db1ae6 100644 --- a/lib/sessions/backend/activity_stream.rb +++ b/lib/sessions/backend/activity_stream.rb @@ -1,6 +1,6 @@ class Sessions::Backend::ActivityStream - def initialize( user, client = nil, client_id = nil, ttl = 30 ) + def initialize(user, client = nil, client_id = nil, ttl = 25) @user = user @client = client @client_id = client_id @@ -11,7 +11,7 @@ class Sessions::Backend::ActivityStream def load # get whole collection - activity_stream = @user.activity_stream( 25 ) + activity_stream = @user.activity_stream(25) if activity_stream && !activity_stream.first return end @@ -25,7 +25,7 @@ class Sessions::Backend::ActivityStream @last_change = activity_stream.first['created_at'] end - @user.activity_stream( 25, true ) + @user.activity_stream(25, true) end def client_key @@ -35,11 +35,11 @@ class Sessions::Backend::ActivityStream def push # check timeout - timeout = Sessions::CacheIn.get( client_key ) + timeout = Sessions::CacheIn.get(client_key) return if timeout # set new timeout - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) data = load diff --git a/lib/sessions/backend/collections.rb b/lib/sessions/backend/collections.rb index 3dcff68e2..fce95be37 100644 --- a/lib/sessions/backend/collections.rb +++ b/lib/sessions/backend/collections.rb @@ -1,6 +1,6 @@ class Sessions::Backend::Collections - def initialize( user, client, client_id, ttl = 10 ) + def initialize(user, client, client_id, ttl = 10) @user = user @client = client @client_id = client_id @@ -28,7 +28,7 @@ class Sessions::Backend::Collections # load collections to deliver from external files dir = File.expand_path('../../../../', __FILE__) - files = Dir.glob( "#{dir}/lib/sessions/backend/collections/*.rb" ) + files = Dir.glob("#{dir}/lib/sessions/backend/collections/*.rb") files.each { |file| file.gsub!("#{dir}/lib/", '') file.gsub!(/\.rb$/, '') diff --git a/lib/sessions/backend/collections/base.rb b/lib/sessions/backend/collections/base.rb index f4f3b59f2..f2779624b 100644 --- a/lib/sessions/backend/collections/base.rb +++ b/lib/sessions/backend/collections/base.rb @@ -1,7 +1,7 @@ class Sessions::Backend::Collections::Base class << self; attr_accessor :model, :roles, :not_roles end - def initialize( user, client, client_id, ttl ) + def initialize(user, client, client_id, ttl) @user = user @client = client @client_id = client_id @@ -42,11 +42,11 @@ class Sessions::Backend::Collections::Base end # check timeout - timeout = Sessions::CacheIn.get( client_key ) + timeout = Sessions::CacheIn.get(client_key) return if timeout # set new timeout - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) # check if update has been done last_change = self.class.model.constantize.latest_change diff --git a/lib/sessions/backend/collections/organization.rb b/lib/sessions/backend/collections/organization.rb index b799e0b4c..916a7585b 100644 --- a/lib/sessions/backend/collections/organization.rb +++ b/lib/sessions/backend/collections/organization.rb @@ -8,7 +8,7 @@ class Sessions::Backend::Collections::Organization < Sessions::Backend::Collecti if !@user.role?('Customer') all = Organization.all elsif @user.organization_id - all = Organization.where( id: @user.organization_id ) + all = Organization.where(id: @user.organization_id) end all diff --git a/lib/sessions/backend/rss.rb b/lib/sessions/backend/rss.rb index d43485c49..032e92030 100644 --- a/lib/sessions/backend/rss.rb +++ b/lib/sessions/backend/rss.rb @@ -2,7 +2,7 @@ require 'rss' class Sessions::Backend::Rss - def initialize( user, client, client_id, ttl = 30 ) + def initialize(user, client, client_id, ttl = 30) @user = user @client = client @ttl = ttl @@ -16,14 +16,14 @@ class Sessions::Backend::Rss def load # check timeout - cache = Sessions::CacheIn.get( collection_key ) + cache = Sessions::CacheIn.get(collection_key) return cache if cache url = 'http://www.heise.de/newsticker/heise-atom.xml' - rss_items = Rss.fetch( url, 8 ) + rss_items = Rss.fetch(url, 8) # set new timeout - Sessions::CacheIn.set( collection_key, rss_items, { expires_in: 1.hour } ) + Sessions::CacheIn.set(collection_key, rss_items, { expires_in: 1.hour }) rss_items end @@ -35,11 +35,11 @@ class Sessions::Backend::Rss def push # check timeout - timeout = Sessions::CacheIn.get( client_key ) + timeout = Sessions::CacheIn.get(client_key) return if timeout # set new timeout - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) data = load diff --git a/lib/sessions/backend/ticket_create.rb b/lib/sessions/backend/ticket_create.rb index 1c130eeb5..99ca200a3 100644 --- a/lib/sessions/backend/ticket_create.rb +++ b/lib/sessions/backend/ticket_create.rb @@ -1,5 +1,5 @@ class Sessions::Backend::TicketCreate - def initialize( user, client = nil, client_id = nil, ttl = 30 ) + def initialize(user, client = nil, client_id = nil, ttl = 30) @user = user @client = client @client_id = client_id @@ -33,11 +33,11 @@ class Sessions::Backend::TicketCreate def push # check timeout - timeout = Sessions::CacheIn.get( client_key ) + timeout = Sessions::CacheIn.get(client_key) return if timeout # set new timeout - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) data = load diff --git a/lib/sessions/backend/ticket_overview_index.rb b/lib/sessions/backend/ticket_overview_index.rb index d3da40ab5..37babc637 100644 --- a/lib/sessions/backend/ticket_overview_index.rb +++ b/lib/sessions/backend/ticket_overview_index.rb @@ -1,5 +1,5 @@ class Sessions::Backend::TicketOverviewIndex - def initialize( user, client = nil, client_id = nil, ttl = 5 ) + def initialize(user, client = nil, client_id = nil, ttl = 7) @user = user @client = client @client_id = client_id @@ -34,10 +34,10 @@ class Sessions::Backend::TicketOverviewIndex def push # check check interval - return if Sessions::CacheIn.get( client_key ) + return if Sessions::CacheIn.get(client_key) # reset check interval - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) # check if min one ticket has changed last_ticket_change = Ticket.latest_change diff --git a/lib/sessions/backend/ticket_overview_list.rb b/lib/sessions/backend/ticket_overview_list.rb index 7b14aede7..900ff2336 100644 --- a/lib/sessions/backend/ticket_overview_list.rb +++ b/lib/sessions/backend/ticket_overview_list.rb @@ -1,5 +1,5 @@ class Sessions::Backend::TicketOverviewList - def initialize( user, client = nil, client_id = nil, ttl = 6 ) + def initialize(user, client = nil, client_id = nil, ttl = 7) @user = user @client = client @client_id = client_id @@ -45,10 +45,10 @@ class Sessions::Backend::TicketOverviewList def push # check interval - return if Sessions::CacheIn.get( client_key ) + return if Sessions::CacheIn.get(client_key) # reset check interval - Sessions::CacheIn.set( client_key, true, { expires_in: @ttl.seconds } ) + Sessions::CacheIn.set(client_key, true, { expires_in: @ttl.seconds }) # check if min one ticket has changed last_ticket_change = Ticket.latest_change @@ -67,7 +67,7 @@ class Sessions::Backend::TicketOverviewList assets = {} overview_data[:ticket_ids].each {|ticket_id| - ticket = Ticket.find( ticket_id ) + ticket = Ticket.find(ticket_id) assets = ticket.assets(assets) } diff --git a/lib/static_assets.rb b/lib/static_assets.rb index 722b27de1..a4d7939a3 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -20,7 +20,7 @@ returns data[:content] = Base64.decode64($2) return data end - fail "Unable to parse data url: #{data_url.substr(0, 100)}" + raise "Unable to parse data url: #{data_url.substr(0, 100)}" end =begin @@ -67,7 +67,7 @@ returns if list && list[0] return Store.find( list[0] ) end - fail 'No such raw logo!' + raise 'No such raw logo!' end =begin diff --git a/lib/tasks/test_browser.rake b/lib/tasks/test_browser.rake index 533960e4a..2bc8d1a87 100644 --- a/lib/tasks/test_browser.rake +++ b/lib/tasks/test_browser.rake @@ -11,7 +11,7 @@ namespace :test do end Dir.glob('test/browser/*_test.rb').sort.each { |r| sh "#{args.opts} ruby -Itest #{r}" do |ok, res| - fail 'Failed test. ' + res.inspect if !ok + raise 'Failed test. ' + res.inspect if !ok end } puts 'All browser tests, elapsed: ' + (Time.zone.now - start).to_s + ' seconds' diff --git a/lib/tweet_base.rb b/lib/tweet_base.rb index cb6db1e81..b606fee4e 100644 --- a/lib/tweet_base.rb +++ b/lib/tweet_base.rb @@ -18,7 +18,7 @@ class TweetBase Rails.logger.debug tweet.user.inspect return tweet.user else - fail "Unknown tweet type '#{tweet.class}'" + raise "Unknown tweet type '#{tweet.class}'" end end @@ -100,6 +100,7 @@ class TweetBase end def to_ticket(tweet, user, group_id, channel) + UserInfo.current_user_id = user.id Rails.logger.debug 'Create ticket from tweet...' Rails.logger.debug tweet.inspect @@ -119,8 +120,6 @@ class TweetBase return ticket if ticket end - UserInfo.current_user_id = user.id - # prepare title title = tweet.text if title.length > 80 @@ -177,7 +176,7 @@ class TweetBase end in_reply_to = tweet.in_reply_to_status_id else - fail "Unknown tweet type '#{tweet.class}'" + raise "Unknown tweet type '#{tweet.class}'" end UserInfo.current_user_id = user.id @@ -233,7 +232,7 @@ class TweetBase end to_article(tweet, user, ticket) else - fail "Unknown tweet type '#{tweet.class}'" + raise "Unknown tweet type '#{tweet.class}'" end # execute ticket events @@ -269,7 +268,7 @@ class TweetBase } ) else - fail "Can't handle unknown twitter article type '#{article[:type]}'." + raise "Can't handle unknown twitter article type '#{article[:type]}'." end Rails.logger.debug tweet.inspect diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 0cb9be737..edf7ba483 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -322,7 +322,7 @@ returns code: response.code, ) when Net::HTTPRedirection - fail 'Too many redirections for the original URL, halting.' if count <= 0 + raise 'Too many redirections for the original URL, halting.' if count <= 0 url = response['location'] return get(url, params, options, count - 1) when Net::HTTPOK @@ -351,7 +351,7 @@ returns ) end - fail "Unable to process http call '#{response.inspect}'" + raise "Unable to process http call '#{response.inspect}'" end def self.ftp(uri, options) diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index 75dd186a8..e28097008 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -9,6 +9,7 @@ if [ "$LEVEL" == '1' ]; then rm test/browser/agent_organization_profile_test.rb rm test/browser/agent_ticket_*.rb rm test/browser/chat_test.rb + rm test/browser/first_steps_test.rb rm test/browser/keyboard_shortcuts_test.rb rm test/browser/prefereces_test.rb rm test/browser/setting_test.rb @@ -25,6 +26,7 @@ elif [ "$LEVEL" == '2' ]; then rm test/browser/auth_test.rb rm test/browser/chat_test.rb rm test/browser/customer_ticket_create_test.rb + rm test/browser/first_steps_test.rb rm test/browser/form_test.rb rm test/browser/keyboard_shortcuts_test.rb rm test/browser/maintenance_*.rb diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index b4053376c..8ac29be69 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -153,7 +153,7 @@ class TestCase < Test::Unit::TestCase login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title') if login != params[:username] screenshot(browser: instance, comment: 'auto wizard login failed') - fail 'auto wizard login failed' + raise 'auto wizard login failed' end assert(true, 'auto wizard login ok') @@ -165,7 +165,7 @@ class TestCase < Test::Unit::TestCase return end screenshot(browser: instance, comment: 'login_failed') - fail 'No login box found' + raise 'No login box found' end screenshot(browser: instance, comment: 'login') @@ -186,7 +186,7 @@ class TestCase < Test::Unit::TestCase login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title') if login != params[:username] screenshot(browser: instance, comment: 'login_failed') - fail 'login failed' + raise 'login failed' end clues_close( @@ -226,7 +226,7 @@ class TestCase < Test::Unit::TestCase return } screenshot(browser: instance, comment: 'logout_failed') - fail 'no login box found, seems logout was not successfully!' + raise 'no login box found, seems logout was not successfully!' end =begin @@ -247,7 +247,7 @@ class TestCase < Test::Unit::TestCase clues = instance.find_elements(css: '.js-modal--clue .js-close')[0] if !params[:optional] && !clues screenshot(browser: instance, comment: 'no_clues') - fail 'Unable to closes clues, no clues found!' + raise 'Unable to closes clues, no clues found!' end return if !clues instance.execute_script("$('.js-modal--clue .js-close').click()") @@ -296,7 +296,7 @@ class TestCase < Test::Unit::TestCase current_url = instance.current_url if current_url !~ /#{Regexp.quote(params[:url])}/ screenshot(browser: instance, comment: 'location_check_failed') - fail "url #{current_url} is not matching #{params[:url]}" + raise "url #{current_url} is not matching #{params[:url]}" end assert(true, "url #{current_url} is matching #{params[:url]}") end @@ -412,7 +412,7 @@ class TestCase < Test::Unit::TestCase if params[:js] return instance.execute_script(params[:js]) end - fail "Invalid execute params #{params.inspect}" + raise "Invalid execute params #{params.inspect}" end =begin @@ -431,7 +431,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser if !instance.find_elements(css: params[:css])[0] screenshot(browser: instance, comment: 'exists_failed') - fail "#{params[:css]} dosn't exist, but should" + raise "#{params[:css]} dosn't exist, but should" end true end @@ -452,7 +452,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser if instance.find_elements(css: params[:css])[0] screenshot(browser: instance, comment: 'exists_not_failed') - fail "#{params[:css]} exists but should not" + raise "#{params[:css]} exists but should not" end true end @@ -673,10 +673,10 @@ class TestCase < Test::Unit::TestCase end if params[:should_not_match] if success - fail "should not match '#{params[:value]}' in select list, but is matching" + raise "should not match '#{params[:value]}' in select list, but is matching" end elsif !success - fail "not matching '#{params[:value]}' in select list" + raise "not matching '#{params[:value]}' in select list" end return true @@ -719,10 +719,10 @@ class TestCase < Test::Unit::TestCase if match if params[:should_not_match] - fail "matching '#{params[:value]}' in content '#{text}' but should not!" + raise "matching '#{params[:value]}' in content '#{text}' but should not!" end elsif !params[:should_not_match] - fail "not matching '#{params[:value]}' in content '#{text}' but should!" + raise "not matching '#{params[:value]}' in content '#{text}' but should!" end sleep 0.8 match @@ -769,7 +769,7 @@ class TestCase < Test::Unit::TestCase instance.find_elements(css: ".content.active .js-secondaryActionLabel[data-type=#{params[:type]}]")[0].click return end - fail "Unknown params for task_type: #{params.inspect}" + raise "Unknown params for task_type: #{params.inspect}" end =begin @@ -809,23 +809,23 @@ class TestCase < Test::Unit::TestCase if params.key?(:value ) && cookie[:value].to_s =~ /#{params[:value]}/i assert(true, "matching value '#{params[:value]}' in cookie '#{cookie}'") else - fail "not matching value '#{params[:value]}' in cookie '#{cookie}'" + raise "not matching value '#{params[:value]}' in cookie '#{cookie}'" end if params.key?(:expires) && cookie[:expires].to_s =~ /#{params[:expires]}/i assert(true, "matching expires '#{params[:expires].inspect}' in cookie '#{cookie}'") else - fail "not matching expires '#{params[:expires]}' in cookie '#{cookie}'" + raise "not matching expires '#{params[:expires]}' in cookie '#{cookie}'" end return if !params[:should_not_exist] - fail "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'" + raise "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'" } if params[:should_not_exist] assert(true, "cookie with name '#{params[:name]}' is not existing") return end - fail "not matching name '#{params[:name]}' in cookie '#{cookies}'" + raise "not matching name '#{params[:name]}' in cookie '#{cookies}'" end =begin @@ -847,7 +847,7 @@ class TestCase < Test::Unit::TestCase if title =~ /#{params[:value]}/i assert(true, "matching '#{params[:value]}' in title '#{title}'") else - fail "not matching '#{params[:value]}' in title '#{title}'" + raise "not matching '#{params[:value]}' in title '#{title}'" end end @@ -880,7 +880,7 @@ class TestCase < Test::Unit::TestCase if title =~ /#{data[:title]}/i assert(true, "matching '#{data[:title]}' in title '#{title}'") else - fail "not matching '#{data[:title]}' in title '#{title}'" + raise "not matching '#{data[:title]}' in title '#{title}'" end end puts "tv #{params.inspect}" @@ -899,16 +899,16 @@ class TestCase < Test::Unit::TestCase if is_modified assert(true, "task '#{data[:title]}' is modifed") elsif !exists - fail "task '#{data[:title]}' not exists, should not modified" + raise "task '#{data[:title]}' not exists, should not modified" else - fail "task '#{data[:title]}' is not modifed" + raise "task '#{data[:title]}' is not modifed" end elsif !is_modified assert(true, "task '#{data[:title]}' is modifed") elsif !exists - fail "task '#{data[:title]}' not exists, should be not modified" + raise "task '#{data[:title]}' not exists, should be not modified" else - fail "task '#{data[:title]}' is modifed, but should not" + raise "task '#{data[:title]}' is modifed, but should not" end end rescue => e @@ -943,7 +943,7 @@ class TestCase < Test::Unit::TestCase element = instance.find_elements(partial_link_text: data[:title])[0] if !element screenshot(browser: instance, comment: 'open_task_failed') - fail "no task with title '#{data[:title]}' found" + raise "no task with title '#{data[:title]}' found" end element.click true @@ -971,7 +971,7 @@ class TestCase < Test::Unit::TestCase element = instance.find_elements(partial_link_text: data[:title])[0] if !element screenshot(browser: instance, comment: 'close_task_failed') - fail "no task with title '#{data[:title]}' found" + raise "no task with title '#{data[:title]}' found" end instance.mouse.move_to(element) @@ -1058,7 +1058,7 @@ class TestCase < Test::Unit::TestCase sleep 0.5 } screenshot(browser: instance, comment: 'watch_for_failed') - fail "'#{params[:value]}' found in '#{text}'" + raise "'#{params[:value]}' found in '#{text}'" end =begin @@ -1116,7 +1116,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'disappear_failed') - fail "#{params[:css]}) still exsists" + raise "#{params[:css]}) still exsists" end =begin @@ -1310,7 +1310,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'overview_create_failed') - fail 'overview creation failed' + raise 'overview creation failed' end =begin @@ -1348,7 +1348,7 @@ wait untill text in selector disabppears element = instance.find_elements(css: '.active .newTicket')[0] if !element screenshot(browser: instance, comment: 'ticket_create_failed') - fail 'no ticket create screen found!' + raise 'no ticket create screen found!' end sleep 1 @@ -1448,7 +1448,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'ticket_create_failed') - fail "ticket creation failed, can't get zoom url (current url is '#{instance.current_url}')" + raise "ticket creation failed, can't get zoom url (current url is '#{instance.current_url}')" end =begin @@ -1604,7 +1604,7 @@ wait untill text in selector disabppears if !found screenshot(browser: instance, comment: 'ticket_update_discard_message_failed') - fail 'no discard message found' + raise 'no discard message found' end end @@ -1633,7 +1633,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'ticket_update_failed') - fail 'unable to update ticket' + raise 'unable to update ticket' end =begin @@ -1662,7 +1662,7 @@ wait untill text in selector disabppears if title =~ /#{data[:title]}/i assert(true, "matching '#{data[:title]}' in title '#{title}'") else - fail "not matching '#{data[:title]}' in title '#{title}'" + raise "not matching '#{data[:title]}' in title '#{title}'" end end @@ -1671,7 +1671,7 @@ wait untill text in selector disabppears if body =~ /#{data[:body]}/i assert(true, "matching '#{data[:body]}' in body '#{body}'") else - fail "not matching '#{data[:body]}' in body '#{body}'" + raise "not matching '#{data[:body]}' in body '#{body}'" end end true @@ -1710,7 +1710,7 @@ wait untill text in selector disabppears number = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0].text if number !~ /#{params[:number]}/ screenshot(browser: instance, comment: 'ticket_open_by_overview_failed') - fail "unable to search/find ticket #{params[:number]}!" + raise "unable to search/find ticket #{params[:number]}!" end sleep 1 assert(true, "ticket #{params[:number]} found") @@ -1744,7 +1744,7 @@ wait untill text in selector disabppears sleep 0.5 text = instance.find_elements(css: '#global-search')[0].attribute('value') if !text - fail '#global-search is not empty!' + raise '#global-search is not empty!' end # search by number again @@ -1760,7 +1760,7 @@ wait untill text in selector disabppears number = instance.find_elements(css: '.active .ticketZoom-header .ticket-number')[0].text if number !~ /#{params[:number]}/ screenshot(browser: instance, comment: 'ticket_open_by_search_failed') - fail "unable to search/find ticket #{params[:number]}!" + raise "unable to search/find ticket #{params[:number]}!" end sleep 1 true @@ -1794,7 +1794,7 @@ wait untill text in selector disabppears title = instance.find_elements(css: '.active .ticketZoom-header .ticket-title-update')[0].text if title !~ /#{params[:title]}/ screenshot(browser: instance, comment: 'ticket_open_by_title_failed') - fail "unable to search/find ticket #{params[:title]}!" + raise "unable to search/find ticket #{params[:title]}!" end sleep 1 true @@ -1872,7 +1872,7 @@ wait untill text in selector disabppears sleep 0.5 text = instance.find_elements(css: '#global-search')[0].attribute('value') if !text - fail '#global-search is not empty!' + raise '#global-search is not empty!' end element = instance.find_elements(css: '#global-search')[0] element.click @@ -1884,7 +1884,7 @@ wait untill text in selector disabppears name = instance.find_elements(css: '.active h1')[0].text if name !~ /#{params[:value]}/ screenshot(browser: instance, comment: 'organization_open_by_search_failed') - fail "unable to search/find org #{params[:value]}!" + raise "unable to search/find org #{params[:value]}!" end assert(true, "org #{params[:value]} found") sleep 2 @@ -1916,7 +1916,7 @@ wait untill text in selector disabppears name = instance.find_elements(css: '.active h1')[0].text if name !~ /#{params[:value]}/ screenshot(browser: instance, comment: 'user_open_by_search_failed') - fail "unable to search/find user #{params[:value]}!" + raise "unable to search/find user #{params[:value]}!" end assert(true, "user #{params[:term]} found") sleep 2 @@ -2025,7 +2025,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'sla_create_failed') - fail 'sla creation failed' + raise 'sla creation failed' end =begin @@ -2074,7 +2074,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'text_module_create_failed') - fail 'text module creation failed' + raise 'text module creation failed' end =begin @@ -2121,7 +2121,7 @@ wait untill text in selector disabppears sleep 1 } screenshot(browser: instance, comment: 'signature_create_failed') - fail 'signature creation failed' + raise 'signature creation failed' end =begin @@ -2195,7 +2195,7 @@ wait untill text in selector disabppears return true } screenshot(browser: instance, comment: 'group_create_failed') - fail 'group creation failed' + raise 'group creation failed' end def quote(string) diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index 5878bbcd2..7a034636b 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -5,11 +5,11 @@ class ElasticsearchTest < ActiveSupport::TestCase # set config if !ENV['ES_URL'] - fail "ERROR: Need ES_URL - hint ES_URL='http://172.0.0.1:9200'" + raise "ERROR: Need ES_URL - hint ES_URL='http://172.0.0.1:9200'" end Setting.set('es_url', ENV['ES_URL']) if !ENV['ES_INDEX'] && !ENV['ES_INDEX_RAND'] - fail "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'" + raise "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'" end if ENV['ES_INDEX_RAND'] ENV['ES_INDEX'] = "es_index_#{rand(999_999_999)}" diff --git a/test/integration/email_helper_test.rb b/test/integration/email_helper_test.rb index 0ef8ad585..1b0da03d3 100644 --- a/test/integration/email_helper_test.rb +++ b/test/integration/email_helper_test.rb @@ -249,7 +249,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test I if !ENV['EMAILHELPER_MAILBOX_1'] - fail "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_1'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] @@ -401,7 +401,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test I if !ENV['EMAILHELPER_MAILBOX_1'] - fail "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_1'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] @@ -433,7 +433,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test I, with imap if !ENV['EMAILHELPER_MAILBOX_1'] - fail "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_1'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] @@ -448,7 +448,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test II, gmail with only pop3 if !ENV['EMAILHELPER_MAILBOX_2'] - fail "Need EMAILHELPER_MAILBOX_2 as ENV variable like export EMAILHELPER_MAILBOX_2='hansb36621@gmail.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_2 as ENV variable like export EMAILHELPER_MAILBOX_2='hansb36621@gmail.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_2'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_2'].split(':')[1] @@ -467,7 +467,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test I, with imap if !ENV['EMAILHELPER_MAILBOX_1'] - fail "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_1 as ENV variable like export EMAILHELPER_MAILBOX_1='unittestemailhelper01@znuny.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_1'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] @@ -499,7 +499,7 @@ class EmailHelperTest < ActiveSupport::TestCase # realtest - test II, gmail with pop3 if !ENV['EMAILHELPER_MAILBOX_2'] - fail "Need EMAILHELPER_MAILBOX_2 as ENV variable like export EMAILHELPER_MAILBOX_2='hansb36621@gmail.com:somepass'" + raise "Need EMAILHELPER_MAILBOX_2 as ENV variable like export EMAILHELPER_MAILBOX_2='hansb36621@gmail.com:somepass'" end mailbox_user = ENV['EMAILHELPER_MAILBOX_2'].split(':')[0] mailbox_password = ENV['EMAILHELPER_MAILBOX_2'].split(':')[1] diff --git a/test/integration/facebook_browser_test.rb b/test/integration/facebook_browser_test.rb index 3774b7867..b4a311a05 100644 --- a/test/integration/facebook_browser_test.rb +++ b/test/integration/facebook_browser_test.rb @@ -6,28 +6,28 @@ class FacebookBrowserTest < TestCase # app config if !ENV['FACEBOOK_BT_APP_ID'] - fail "ERROR: Need FACEBOOK_BT_APP_ID - hint FACEBOOK_BT_APP_ID='1234'" + raise "ERROR: Need FACEBOOK_BT_APP_ID - hint FACEBOOK_BT_APP_ID='1234'" end app_id = ENV['FACEBOOK_BT_APP_ID'] if !ENV['FACEBOOK_BT_APP_SECRET'] - fail "ERROR: Need FACEBOOK_BT_APP_SECRET - hint FACEBOOK_BT_APP_SECRET='1234'" + raise "ERROR: Need FACEBOOK_BT_APP_SECRET - hint FACEBOOK_BT_APP_SECRET='1234'" end app_secret = ENV['FACEBOOK_BT_APP_SECRET'] if !ENV['FACEBOOK_BT_USER_LOGIN'] - fail "ERROR: Need FACEBOOK_BT_USER_LOGIN - hint FACEBOOK_BT_USER_LOGIN='1234'" + raise "ERROR: Need FACEBOOK_BT_USER_LOGIN - hint FACEBOOK_BT_USER_LOGIN='1234'" end user_login = ENV['FACEBOOK_BT_USER_LOGIN'] if !ENV['FACEBOOK_BT_USER_PW'] - fail "ERROR: Need FACEBOOK_BT_USER_PW - hint FACEBOOK_BT_USER_PW='1234'" + raise "ERROR: Need FACEBOOK_BT_USER_PW - hint FACEBOOK_BT_USER_PW='1234'" end user_pw = ENV['FACEBOOK_BT_USER_PW'] if !ENV['FACEBOOK_BT_PAGE_ID'] - fail "ERROR: Need FACEBOOK_BT_PAGE_ID - hint FACEBOOK_BT_PAGE_ID='1234'" + raise "ERROR: Need FACEBOOK_BT_PAGE_ID - hint FACEBOOK_BT_PAGE_ID='1234'" end page_id = ENV['FACEBOOK_BT_PAGE_ID'] if !ENV['FACEBOOK_BT_CUSTOMER'] - fail "ERROR: Need FACEBOOK_BT_CUSTOMER - hint FACEBOOK_BT_CUSTOMER='name:1234:access_token'" + raise "ERROR: Need FACEBOOK_BT_CUSTOMER - hint FACEBOOK_BT_CUSTOMER='name:1234:access_token'" end customer_name = ENV['FACEBOOK_BT_CUSTOMER'].split(':')[0] customer_id = ENV['FACEBOOK_BT_CUSTOMER'].split(':')[1] diff --git a/test/integration/facebook_test.rb b/test/integration/facebook_test.rb index 1bff8d42c..ba61aa570 100644 --- a/test/integration/facebook_test.rb +++ b/test/integration/facebook_test.rb @@ -16,21 +16,21 @@ class FacebookTest < ActiveSupport::TestCase # account config if !ENV['FACEBOOK_USER'] - fail "ERROR: Need FACEBOOK_USER - hint FACEBOOK_USER='name:1234:access_token'" + raise "ERROR: Need FACEBOOK_USER - hint FACEBOOK_USER='name:1234:access_token'" end user_name = ENV['FACEBOOK_USER'].split(':')[0] user_id = ENV['FACEBOOK_USER'].split(':')[1] user_access_token = ENV['FACEBOOK_USER'].split(':')[2] if !ENV['FACEBOOK_PAGE'] - fail "ERROR: Need FACEBOOK_PAGE - hint FACEBOOK_PAGE='name:1234:access_token'" + raise "ERROR: Need FACEBOOK_PAGE - hint FACEBOOK_PAGE='name:1234:access_token'" end page_name = ENV['FACEBOOK_PAGE'].split(':')[0] page_id = ENV['FACEBOOK_PAGE'].split(':')[1] page_access_token = ENV['FACEBOOK_PAGE'].split(':')[2] if !ENV['FACEBOOK_CUSTOMER'] - fail "ERROR: Need FACEBOOK_CUSTOMER - hint FACEBOOK_CUSTOMER='name:1234:access_token'" + raise "ERROR: Need FACEBOOK_CUSTOMER - hint FACEBOOK_CUSTOMER='name:1234:access_token'" end customer_name = ENV['FACEBOOK_CUSTOMER'].split(':')[0] customer_id = ENV['FACEBOOK_CUSTOMER'].split(':')[1] diff --git a/test/integration/otrs_import_browser_test.rb b/test/integration/otrs_import_browser_test.rb index 4f59578aa..57e52d4f0 100644 --- a/test/integration/otrs_import_browser_test.rb +++ b/test/integration/otrs_import_browser_test.rb @@ -5,10 +5,10 @@ class OtrsImportBrowserTest < TestCase def test_import if !ENV['IMPORT_BT_OTRS_ENDPOINT'] - fail "ERROR: Need IMPORT_BT_OTRS_ENDPOINT - hint IMPORT_BT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'" + raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT - hint IMPORT_BT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'" end if !ENV['IMPORT_BT_OTRS_ENDPOINT_KEY'] - fail "ERROR: Need IMPORT_BT_OTRS_ENDPOINT_KEY - hint IMPORT_BT_OTRS_ENDPOINT_KEY='01234567899876543210'" + raise "ERROR: Need IMPORT_BT_OTRS_ENDPOINT_KEY - hint IMPORT_BT_OTRS_ENDPOINT_KEY='01234567899876543210'" end @browser = browser_instance diff --git a/test/integration/otrs_import_test.rb b/test/integration/otrs_import_test.rb index ace09a5b8..fe0eb33c3 100644 --- a/test/integration/otrs_import_test.rb +++ b/test/integration/otrs_import_test.rb @@ -4,10 +4,10 @@ require 'integration_test_helper' class OtrsImportTest < ActiveSupport::TestCase if !ENV['IMPORT_OTRS_ENDPOINT'] - fail "ERROR: Need IMPORT_OTRS_ENDPOINT - hint IMPORT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'" + raise "ERROR: Need IMPORT_OTRS_ENDPOINT - hint IMPORT_OTRS_ENDPOINT='http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator'" end if !ENV['IMPORT_OTRS_ENDPOINT_KEY'] - fail "ERROR: Need IMPORT_OTRS_ENDPOINT_KEY - hint IMPORT_OTRS_ENDPOINT_KEY='01234567899876543210'" + raise "ERROR: Need IMPORT_OTRS_ENDPOINT_KEY - hint IMPORT_OTRS_ENDPOINT_KEY='01234567899876543210'" end Setting.set('import_otrs_endpoint', ENV['IMPORT_OTRS_ENDPOINT']) diff --git a/test/integration/report_test.rb b/test/integration/report_test.rb index 960cd748d..1a9c7b3dd 100644 --- a/test/integration/report_test.rb +++ b/test/integration/report_test.rb @@ -5,11 +5,11 @@ class ReportTest < ActiveSupport::TestCase # set config if !ENV['ES_URL'] - fail "ERROR: Need ES_URL - hint ES_URL='http://172.0.0.1:9200'" + raise "ERROR: Need ES_URL - hint ES_URL='http://172.0.0.1:9200'" end Setting.set('es_url', ENV['ES_URL']) if !ENV['ES_INDEX'] && !ENV['ES_INDEX_RAND'] - fail "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'" + raise "ERROR: Need ES_INDEX - hint ES_INDEX='estest.local_zammad'" end if ENV['ES_INDEX_RAND'] ENV['ES_INDEX'] = "es_index_#{rand(999_999_999)}" diff --git a/test/integration/twitter_browser_test.rb b/test/integration/twitter_browser_test.rb index 94624d942..7cfed4ecd 100644 --- a/test/integration/twitter_browser_test.rb +++ b/test/integration/twitter_browser_test.rb @@ -6,31 +6,31 @@ class TwitterBrowserTest < TestCase # app config if !ENV['TWITTER_BT_CONSUMER_KEY'] - fail "ERROR: Need TWITTER_BT_CONSUMER_KEY - hint TWITTER_BT_CONSUMER_KEY='1234'" + raise "ERROR: Need TWITTER_BT_CONSUMER_KEY - hint TWITTER_BT_CONSUMER_KEY='1234'" end consumer_key = ENV['TWITTER_BT_CONSUMER_KEY'] if !ENV['TWITTER_BT_CONSUMER_SECRET'] - fail "ERROR: Need TWITTER_BT_CONSUMER_SECRET - hint TWITTER_BT_CONSUMER_SECRET='1234'" + raise "ERROR: Need TWITTER_BT_CONSUMER_SECRET - hint TWITTER_BT_CONSUMER_SECRET='1234'" end consumer_secret = ENV['TWITTER_BT_CONSUMER_SECRET'] if !ENV['TWITTER_BT_USER_LOGIN'] - fail "ERROR: Need TWITTER_BT_USER_LOGIN - hint TWITTER_BT_USER_LOGIN='1234'" + raise "ERROR: Need TWITTER_BT_USER_LOGIN - hint TWITTER_BT_USER_LOGIN='1234'" end twitter_user_login = ENV['TWITTER_BT_USER_LOGIN'] if !ENV['TWITTER_BT_USER_PW'] - fail "ERROR: Need TWITTER_BT_USER_PW - hint TWITTER_BT_USER_PW='1234'" + raise "ERROR: Need TWITTER_BT_USER_PW - hint TWITTER_BT_USER_PW='1234'" end twitter_user_pw = ENV['TWITTER_BT_USER_PW'] if !ENV['TWITTER_BT_CUSTOMER_TOKEN'] - fail "ERROR: Need TWITTER_BT_CUSTOMER_TOKEN - hint TWITTER_BT_CUSTOMER_TOKEN='1234'" + raise "ERROR: Need TWITTER_BT_CUSTOMER_TOKEN - hint TWITTER_BT_CUSTOMER_TOKEN='1234'" end twitter_customer_token = ENV['TWITTER_BT_CUSTOMER_TOKEN'] if !ENV['TWITTER_BT_CUSTOMER_TOKEN_SECRET'] - fail "ERROR: Need TWITTER_BT_CUSTOMER_TOKEN_SECRET - hint TWITTER_BT_CUSTOMER_TOKEN_SECRET='1234'" + raise "ERROR: Need TWITTER_BT_CUSTOMER_TOKEN_SECRET - hint TWITTER_BT_CUSTOMER_TOKEN_SECRET='1234'" end twitter_customer_token_secret = ENV['TWITTER_BT_CUSTOMER_TOKEN_SECRET'] diff --git a/test/integration/twitter_test.rb b/test/integration/twitter_test.rb index 9f4965fd6..9be9eca28 100644 --- a/test/integration/twitter_test.rb +++ b/test/integration/twitter_test.rb @@ -17,23 +17,23 @@ class TwitterTest < ActiveSupport::TestCase # app config if !ENV['TWITTER_CONSUMER_KEY'] - fail "ERROR: Need TWITTER_CONSUMER_KEY - hint TWITTER_CONSUMER_KEY='1234'" + raise "ERROR: Need TWITTER_CONSUMER_KEY - hint TWITTER_CONSUMER_KEY='1234'" end if !ENV['TWITTER_CONSUMER_SECRET'] - fail "ERROR: Need TWITTER_CONSUMER_SECRET - hint TWITTER_CONSUMER_SECRET='1234'" + raise "ERROR: Need TWITTER_CONSUMER_SECRET - hint TWITTER_CONSUMER_SECRET='1234'" end consumer_key = ENV['TWITTER_CONSUMER_KEY'] consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] # armin_theo (is system and is following marion_bauer) if !ENV['TWITTER_SYSTEM_LOGIN'] - fail "ERROR: Need TWITTER_SYSTEM_LOGIN - hint TWITTER_SYSTEM_LOGIN='@system'" + raise "ERROR: Need TWITTER_SYSTEM_LOGIN - hint TWITTER_SYSTEM_LOGIN='@system'" end if !ENV['TWITTER_SYSTEM_TOKEN'] - fail "ERROR: Need TWITTER_SYSTEM_TOKEN - hint TWITTER_SYSTEM_TOKEN='1234'" + raise "ERROR: Need TWITTER_SYSTEM_TOKEN - hint TWITTER_SYSTEM_TOKEN='1234'" end if !ENV['TWITTER_SYSTEM_TOKEN_SECRET'] - fail "ERROR: Need TWITTER_SYSTEM_TOKEN_SECRET - hint TWITTER_SYSTEM_TOKEN_SECRET='1234'" + raise "ERROR: Need TWITTER_SYSTEM_TOKEN_SECRET - hint TWITTER_SYSTEM_TOKEN_SECRET='1234'" end system_login = ENV['TWITTER_SYSTEM_LOGIN'] system_login_without_at = system_login[1, system_login.length] @@ -42,13 +42,13 @@ class TwitterTest < ActiveSupport::TestCase # me_bauer (is customer and is following armin_theo) if !ENV['TWITTER_CUSTOMER_LOGIN'] - fail "ERROR: Need CUSTOMER_LOGIN - hint TWITTER_CUSTOMER_LOGIN='@customer'" + raise "ERROR: Need CUSTOMER_LOGIN - hint TWITTER_CUSTOMER_LOGIN='@customer'" end if !ENV['TWITTER_CUSTOMER_TOKEN'] - fail "ERROR: Need CUSTOMER_TOKEN - hint TWITTER_CUSTOMER_TOKEN='1234'" + raise "ERROR: Need CUSTOMER_TOKEN - hint TWITTER_CUSTOMER_TOKEN='1234'" end if !ENV['TWITTER_CUSTOMER_TOKEN_SECRET'] - fail "ERROR: Need CUSTOMER_TOKEN_SECRET - hint TWITTER_CUSTOMER_TOKEN_SECRET='1234'" + raise "ERROR: Need CUSTOMER_TOKEN_SECRET - hint TWITTER_CUSTOMER_TOKEN_SECRET='1234'" end customer_login = ENV['TWITTER_CUSTOMER_LOGIN'] customer_token = ENV['TWITTER_CUSTOMER_TOKEN'] diff --git a/test/integration/zendesk_import_browser_test.rb b/test/integration/zendesk_import_browser_test.rb index b40b378c7..d2765a07b 100644 --- a/test/integration/zendesk_import_browser_test.rb +++ b/test/integration/zendesk_import_browser_test.rb @@ -5,13 +5,13 @@ class ZendeskImportBrowserTest < TestCase def test_import if !ENV['IMPORT_BT_ZENDESK_ENDPOINT'] - fail "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT - hint IMPORT_BT_ZENDESK_ENDPOINT='https://example.zendesk.com/' (including trailing slash!)" + raise "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT - hint IMPORT_BT_ZENDESK_ENDPOINT='https://example.zendesk.com/' (including trailing slash!)" end if !ENV['IMPORT_BT_ZENDESK_ENDPOINT_USERNAME'] - fail "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT_USERNAME - hint IMPORT_BT_ZENDESK_ENDPOINT_USERNAME='your@email.com'" + raise "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT_USERNAME - hint IMPORT_BT_ZENDESK_ENDPOINT_USERNAME='your@email.com'" end if !ENV['IMPORT_BT_ZENDESK_ENDPOINT_KEY'] - fail "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT_KEY - hint IMPORT_BT_ZENDESK_ENDPOINT_KEY='XYZ3133723421111'" + raise "ERROR: Need IMPORT_BT_ZENDESK_ENDPOINT_KEY - hint IMPORT_BT_ZENDESK_ENDPOINT_KEY='XYZ3133723421111'" end @browser = browser_instance diff --git a/test/integration/zendesk_import_test.rb b/test/integration/zendesk_import_test.rb index 52a302cef..a68fa24c5 100644 --- a/test/integration/zendesk_import_test.rb +++ b/test/integration/zendesk_import_test.rb @@ -4,13 +4,13 @@ require 'integration_test_helper' class ZendeskImportTest < ActiveSupport::TestCase if !ENV['IMPORT_ZENDESK_ENDPOINT'] - fail "ERROR: Need IMPORT_ZENDESK_ENDPOINT - hint IMPORT_ZENDESK_ENDPOINT='https://example.zendesk.com/api/v2'" + raise "ERROR: Need IMPORT_ZENDESK_ENDPOINT - hint IMPORT_ZENDESK_ENDPOINT='https://example.zendesk.com/api/v2'" end if !ENV['IMPORT_ZENDESK_ENDPOINT_KEY'] - fail "ERROR: Need IMPORT_ZENDESK_ENDPOINT_KEY - hint IMPORT_ZENDESK_ENDPOINT_KEY='01234567899876543210'" + raise "ERROR: Need IMPORT_ZENDESK_ENDPOINT_KEY - hint IMPORT_ZENDESK_ENDPOINT_KEY='01234567899876543210'" end if !ENV['IMPORT_ZENDESK_ENDPOINT_USERNAME'] - fail "ERROR: Need IMPORT_ZENDESK_ENDPOINT_USERNAME - hint IMPORT_ZENDESK_ENDPOINT_USERNAME='bob.ross@happylittletrees.com'" + raise "ERROR: Need IMPORT_ZENDESK_ENDPOINT_USERNAME - hint IMPORT_ZENDESK_ENDPOINT_USERNAME='bob.ross@happylittletrees.com'" end Setting.set('import_zendesk_endpoint', ENV['IMPORT_ZENDESK_ENDPOINT'])