Some new rubocop checks.

This commit is contained in:
Martin Edenhofer 2015-04-27 21:24:14 +02:00
parent 7ff5568b37
commit 03b47edd43
14 changed files with 64 additions and 56 deletions

View file

@ -8,6 +8,11 @@ AllCops:
# https://github.com/bbatsov/rubocop#includingexcluding-files # https://github.com/bbatsov/rubocop#includingexcluding-files
Metrics/LineLength:
Description: 'Limit lines to 80 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Enabled: false
Style/NegatedIf: Style/NegatedIf:
Description: >- Description: >-
Favor unless over if for negative conditions Favor unless over if for negative conditions

View file

@ -41,7 +41,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id,
from: 'Unit Test <unittest@example.com>', from: 'Unit Test <unittest@example.com>',
body: 'Unit Test 123', body: 'Unit Test 123',
internal: false internal: false,
}, },
}, },
update: { update: {
@ -85,9 +85,6 @@ class ActivityStreamTest < ActiveSupport::TestCase
tickets = [] tickets = []
tests.each { |test| tests.each { |test|
ticket = nil
article = nil
ticket = Ticket.create( test[:create][:ticket] ) ticket = Ticket.create( test[:create][:ticket] )
test[:check][0][:o_id] = ticket.id test[:check][0][:o_id] = ticket.id
test[:check][2][:o_id] = ticket.id test[:check][2][:o_id] = ticket.id

View file

@ -34,7 +34,7 @@ if user
active: true, active: true,
) )
else else
user = User.create_if_not_exists( User.create_if_not_exists(
login: 'nicole.braun@zammad.org', login: 'nicole.braun@zammad.org',
firstname: 'Nicole', firstname: 'Nicole',
lastname: 'Braun', lastname: 'Braun',

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable all
require 'test_helper' require 'test_helper'
class EmailParserTest < ActiveSupport::TestCase class EmailParserTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable all
require 'test_helper' require 'test_helper'
class EmailProcessTest < ActiveSupport::TestCase class EmailProcessTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable PerceivedComplexity, CyclomaticComplexity
require 'test_helper' require 'test_helper'
class HistoryTest < ActiveSupport::TestCase class HistoryTest < ActiveSupport::TestCase
@ -27,7 +28,7 @@ class HistoryTest < ActiveSupport::TestCase
sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id, sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id,
from: 'Unit Test <unittest@example.com>', from: 'Unit Test <unittest@example.com>',
body: 'Unit Test 123', body: 'Unit Test 123',
internal: false internal: false,
}, },
}, },
ticket_update: { ticket_update: {
@ -94,7 +95,7 @@ class HistoryTest < ActiveSupport::TestCase
sender_id: Ticket::Article::Sender.lookup(name: 'Customer' ).id, sender_id: Ticket::Article::Sender.lookup(name: 'Customer' ).id,
from: 'Unit Test <unittest@example.com>', from: 'Unit Test <unittest@example.com>',
body: 'Unit Test 123', body: 'Unit Test 123',
internal: false internal: false,
}, },
}, },
ticket_update: { ticket_update: {
@ -213,9 +214,10 @@ class HistoryTest < ActiveSupport::TestCase
user: { user: {
firstname: 'Bob', firstname: 'Bob',
lastname: 'Master', lastname: 'Master',
email: 'master@example.com', }, email: 'master@example.com',
active: false, active: false,
}, },
},
history_check: [ history_check: [
{ {
result: true, result: true,
@ -354,16 +356,10 @@ class HistoryTest < ActiveSupport::TestCase
end end
def history_check( history_list, history_check ) def history_check( history_list, history_check )
# puts history_list.inspect
history_check.each { |check_item| history_check.each { |check_item|
# puts '+++++++++++'
# puts check_item.inspect
match = false match = false
history_list.each { |history_item| history_list.each { |history_item|
next if match next if match
# puts '--------'
# puts history_item.inspect
# puts history_item.history_object.name
next if history_item['object'] != check_item[:history_object] next if history_item['object'] != check_item[:history_object]
next if history_item['type'] != check_item[:history_type] next if history_item['type'] != check_item[:history_type]
if check_item[:history_attribute] if check_item[:history_attribute]

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable Next, UselessAssignment, BlockNesting
require 'test_helper' require 'test_helper'
class OnlineNotificationTest < ActiveSupport::TestCase class OnlineNotificationTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable Next, UselessAssignment
require 'test_helper' require 'test_helper'
class PackageTest < ActiveSupport::TestCase class PackageTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable UselessAssignment
require 'test_helper' require 'test_helper'
class RestTest < ActiveSupport::TestCase class RestTest < ActiveSupport::TestCase
@ -239,6 +240,6 @@ class RestTest < ActiveSupport::TestCase
#puts 'URL: ' + url #puts 'URL: ' + url
#puts response.code.to_s #puts response.code.to_s
#puts response.body.to_s #puts response.body.to_s
return { data: response.data, response: response } { data: response.data, response: response }
end end
end end

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable UselessAssignment
require 'test_helper' require 'test_helper'
class SessionBasicTest < ActiveSupport::TestCase class SessionBasicTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable UselessAssignment
require 'test_helper' require 'test_helper'
class SessionBasicTicketTest < ActiveSupport::TestCase class SessionBasicTicketTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable Next, CyclomaticComplexity
require 'test_helper' require 'test_helper'
class SessionCollectionsTest < ActiveSupport::TestCase class SessionCollectionsTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable Next, UselessAssignment
require 'test_helper' require 'test_helper'
class SessionEnhancedTest < ActiveSupport::TestCase class SessionEnhancedTest < ActiveSupport::TestCase

View file

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
# rubocop:disable Next
require 'test_helper' require 'test_helper'
class TokenTest < ActiveSupport::TestCase class TokenTest < ActiveSupport::TestCase