|
@@ -568,6 +568,35 @@ RSpec.describe Channel::Driver::Twitter do
|
|
|
expect(Ticket::Article.last.attachments).to be_one
|
|
|
end
|
|
|
end
|
|
|
+
|
|
|
+ context 'when message is a retweet' do
|
|
|
+ let(:payload_file) { Rails.root.join('test/data/twitter/webhook_events/tweet_create-retweet.yml') }
|
|
|
+
|
|
|
+ context 'and "conversion of retweets" is enabled' do
|
|
|
+ before do
|
|
|
+ channel.options['sync']['track_retweets'] = true
|
|
|
+ channel.save
|
|
|
+ end
|
|
|
+
|
|
|
+ it 'creates a new article' do
|
|
|
+ expect { channel.process(payload) }
|
|
|
+ .to change(Ticket::Article, :count).by(1)
|
|
|
+ .and change { Ticket::Article.exists?(article_attributes) }.to(true)
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ context 'and "conversion of retweets" is disabled' do
|
|
|
+ before do
|
|
|
+ channel.options['sync']['track_retweets'] = false
|
|
|
+ channel.save
|
|
|
+ end
|
|
|
+
|
|
|
+ it 'does not create a new article' do
|
|
|
+ expect { channel.process(payload) }
|
|
|
+ .not_to change(Ticket::Article, :count)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
|