docbrown/spec/labor/bufferizer_spec.rb
Jess Lee 10674aed72 Buffer Listings (#2956)
* add share to buffer button

* wip

* wip

* adds listings to buffer via form

* create migration for buffered timestamp and update seed file

* display when listing was last buffered

* remove annoying spacing

* refactor article script for listings

* social preview wip

* add custom social card for indivdual listings

* add styling

* fix css

* tweak styling

* final css tweaks

* fix branch

* add buffer listings id

* update envfile

* add social previews spec
2019-06-14 19:33:19 -04:00

25 lines
809 B
Ruby

require "rails_helper"
RSpec.describe Bufferizer do
let(:user) { create(:user) }
let(:listing) { create(:classified_listing, user_id: user.id) }
let(:article) { create(:article, user_id: user.id) }
it "sends to buffer twitter" do
tweet = "test tweet"
described_class.new("article", article, tweet).main_tweet!
expect(article.last_buffered.utc.to_i).to be > 2.minutes.ago.to_i
end
it "sends to buffer facebook" do
post = "test facebook post"
described_class.new("article", article, post).facebook_post!
expect(article.facebook_last_buffered.utc.to_i).to be > 2.minutes.ago.to_i
end
it "sends to buffer listings" do
text = "test listing"
described_class.new("listing", listing, text).listings_tweet!
expect(listing.last_buffered).not_to be(nil)
end
end