Improved test.

This commit is contained in:
Martin Edenhofer 2016-08-31 18:18:55 +02:00
parent 73bded92f7
commit f9c941a186

View file

@ -60,7 +60,7 @@ class TwitterTest < ActiveSupport::TestCase
# add channel # add channel
current = Channel.where(area: 'Twitter::Account') current = Channel.where(area: 'Twitter::Account')
current.each(&:destroy) current.each(&:destroy)
channel = Channel.create( channel = Channel.create!(
area: 'Twitter::Account', area: 'Twitter::Account',
options: { options: {
adapter: 'twitter', adapter: 'twitter',
@ -103,7 +103,7 @@ class TwitterTest < ActiveSupport::TestCase
hash = '#citheo42' + rand(999_999).to_s hash = '#citheo42' + rand(999_999).to_s
user = User.find(2) user = User.find(2)
text = "Today the weather is really #{rand_word}... #{hash}" text = "Today the weather is really #{rand_word}... #{hash}"
ticket = Ticket.create( ticket = Ticket.create!(
title: text[0, 40], title: text[0, 40],
customer_id: user.id, customer_id: user.id,
group_id: group.id, group_id: group.id,
@ -116,7 +116,7 @@ class TwitterTest < ActiveSupport::TestCase
created_by_id: 1, created_by_id: 1,
) )
assert(ticket, "outbound ticket created, text: #{text}") assert(ticket, "outbound ticket created, text: #{text}")
article = Ticket::Article.create( article = Ticket::Article.create!(
ticket_id: ticket.id, ticket_id: ticket.id,
body: text, body: text,
type: Ticket::Article::Type.find_by(name: 'twitter status'), type: Ticket::Article::Type.find_by(name: 'twitter status'),
@ -218,7 +218,7 @@ class TwitterTest < ActiveSupport::TestCase
# send reply # send reply
reply_text = "#{customer_login} on my side #weather#{hash_gen}" reply_text = "#{customer_login} on my side #weather#{hash_gen}"
article = Ticket::Article.create( article = Ticket::Article.create!(
ticket_id: ticket.id, ticket_id: ticket.id,
body: reply_text, body: reply_text,
type: Ticket::Article::Type.find_by(name: 'twitter status'), type: Ticket::Article::Type.find_by(name: 'twitter status'),
@ -304,7 +304,7 @@ class TwitterTest < ActiveSupport::TestCase
assert_equal(ticket.state.name, 'new') assert_equal(ticket.state.name, 'new')
# reply via ticket # reply via ticket
outbound_article = Ticket::Article.create( outbound_article = Ticket::Article.create!(
ticket_id: ticket.id, ticket_id: ticket.id,
to: customer_login, to: customer_login,
body: "Will call you later #{rand_word}!", body: "Will call you later #{rand_word}!",
@ -448,7 +448,7 @@ class TwitterTest < ActiveSupport::TestCase
# send reply # send reply
reply_text = "RE #{text}" reply_text = "RE #{text}"
article = Ticket::Article.create( article = Ticket::Article.create!(
ticket_id: article.ticket_id, ticket_id: article.ticket_id,
body: reply_text, body: reply_text,
type: Ticket::Article::Type.find_by(name: 'twitter status'), type: Ticket::Article::Type.find_by(name: 'twitter status'),