Small improvements.

This commit is contained in:
Martin Edenhofer 2014-05-27 15:22:21 +02:00
parent ae203f542a
commit b864eb9ad6
2 changed files with 20 additions and 8 deletions

View file

@ -349,13 +349,13 @@ class ActivityStreamTest < ActiveSupport::TestCase
def activity_stream_check( activity_stream_list, checks ) def activity_stream_check( activity_stream_list, checks )
puts 'AS ' + activity_stream_list.inspect puts 'AS ' + activity_stream_list.inspect
checks.each { |check_item| checks.each { |check_item|
# puts '+++++++++++' puts '+++++++++++'
# puts check_item.inspect puts check_item.inspect
match = false match = false
activity_stream_list.each { |item| activity_stream_list.each { |item|
next if match next if match
# puts '--------' puts '--------'
# puts item.inspect puts item.inspect
# puts item.object # puts item.object
next if item['object'] != check_item[:object] next if item['object'] != check_item[:object]
next if item['type'] != check_item[:type] next if item['type'] != check_item[:type]

View file

@ -3,6 +3,16 @@ require 'test_helper'
class NotificationFactoryTest < ActiveSupport::TestCase class NotificationFactoryTest < ActiveSupport::TestCase
test 'notifications' do test 'notifications' do
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
)
tests = [ tests = [
{ {
:locale => 'en', :locale => 'en',
@ -39,12 +49,14 @@ class NotificationFactoryTest < ActiveSupport::TestCase
result = NotificationFactory.build( result = NotificationFactory.build(
:string => test[:string], :string => test[:string],
:objects => { :objects => {
:ticket => Ticket.find(1), :ticket => ticket,
:recipient => User.find(2), :recipient => User.find(2),
}, },
:locale => test[:locale] :locale => test[:locale]
) )
assert_equal( result, test[:result], "verify result" ) assert_equal( result, test[:result], "verify result" )
} }
ticket.destroy
end end
end end