From ee87075b230a4b5a8a1feb7fb46d32d34bf99272 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 12 Dec 2015 23:28:34 +0100 Subject: [PATCH] Improved test. --- lib/tweet.rb | 5 ++--- test/integration/twitter_test.rb | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tweet.rb b/lib/tweet.rb index 94c1fafbd..2a710d217 100644 --- a/lib/tweet.rb +++ b/lib/tweet.rb @@ -97,9 +97,8 @@ class Tweet Rails.logger.debug group_id.inspect if tweet.class.to_s == 'Twitter::DirectMessage' - article = Ticket::Article.find_by( - from: 'me_bauer', + from: tweet.in_reply_to_screen_name, type_id: Ticket::Article::Type.find_by( name: 'twitter direct-message' ).id, ) @@ -156,7 +155,7 @@ class Tweet end Ticket::Article.create( - from: user.login, + from: tweet.in_reply_to_screen_name, to: to, body: tweet.text, message_id: tweet.id, diff --git a/test/integration/twitter_test.rb b/test/integration/twitter_test.rb index 8b0ad2b6a..8a9a26319 100644 --- a/test/integration/twitter_test.rb +++ b/test/integration/twitter_test.rb @@ -141,6 +141,7 @@ class TwitterTest < ActiveSupport::TestCase article = Ticket::Article.find_by( message_id: tweet.id ) assert(article, "article tweet '#{tweet.id}' imported") + assert_equal('armin_theo', article.from, 'ticket article inbound from') assert_equal(2, article.ticket.articles.count, 'ticket article inbound count') assert_equal(reply_text.utf8_to_3bytesutf8, ticket.articles.last.body, 'ticket article inbound body') end