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
Metrics/LineLength:
Description: 'Limit lines to 80 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Enabled: false
Style/NegatedIf:
Description: >-
Favor unless over if for negative conditions

View file

@ -36,12 +36,12 @@ class ActivityStreamTest < ActiveSupport::TestCase
},
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false,
},
},
update: {
@ -60,8 +60,8 @@ class ActivityStreamTest < ActiveSupport::TestCase
check: [
{
result: true,
object: 'Ticket',
type: 'updated',
object: 'Ticket',
type: 'updated',
},
{
result: true,
@ -85,9 +85,6 @@ class ActivityStreamTest < ActiveSupport::TestCase
tickets = []
tests.each { |test|
ticket = nil
article = nil
ticket = Ticket.create( test[:create][:ticket] )
test[:check][0][:o_id] = ticket.id
test[:check][2][:o_id] = ticket.id
@ -378,7 +375,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
activity_stream_list.each { |item|
check_list += 1
next if check_list != check_count
# next if match
#next if match
#puts '--------'
#puts item.inspect
#puts check_item.inspect

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
# encoding: utf-8
# rubocop:disable PerceivedComplexity, CyclomaticComplexity
require 'test_helper'
class HistoryTest < ActiveSupport::TestCase
@ -22,12 +23,12 @@ class HistoryTest < ActiveSupport::TestCase
},
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false,
},
},
ticket_update: {
@ -89,12 +90,12 @@ class HistoryTest < ActiveSupport::TestCase
},
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false
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 <unittest@example.com>',
body: 'Unit Test 123',
internal: false,
},
},
ticket_update: {
@ -213,8 +214,9 @@ class HistoryTest < ActiveSupport::TestCase
user: {
firstname: 'Bob',
lastname: 'Master',
email: 'master@example.com', },
email: 'master@example.com',
active: false,
},
},
history_check: [
{
@ -354,16 +356,10 @@ class HistoryTest < ActiveSupport::TestCase
end
def history_check( history_list, history_check )
# puts history_list.inspect
history_check.each { |check_item|
# puts '+++++++++++'
# puts check_item.inspect
match = false
history_list.each { |history_item|
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['type'] != check_item[:history_type]
if check_item[:history_attribute]

View file

@ -1,4 +1,5 @@
# encoding: utf-8
# rubocop:disable Next, UselessAssignment, BlockNesting
require 'test_helper'
class OnlineNotificationTest < ActiveSupport::TestCase
@ -73,14 +74,14 @@ class OnlineNotificationTest < ActiveSupport::TestCase
check: [
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
{
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -124,14 +125,14 @@ class OnlineNotificationTest < ActiveSupport::TestCase
check: [
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
{
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -175,14 +176,14 @@ class OnlineNotificationTest < ActiveSupport::TestCase
check: [
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
{
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -226,14 +227,14 @@ class OnlineNotificationTest < ActiveSupport::TestCase
check: [
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
{
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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