diff options
author | cmrd Senya <35317-cmrd-senya@users.noreply.gitlab.gnome.org> | 2022-09-06 10:22:08 +0300 |
---|---|---|
committer | cmrd Senya <35317-cmrd-senya@users.noreply.gitlab.gnome.org> | 2022-09-06 10:22:08 +0300 |
commit | e77d785d9c01429ea2a45cb9cd0227196a0e692c (patch) | |
tree | 67ea64f5ec716fbb8d12a7bf5322bf5b8212fa85 | |
parent | 61d7eb100a0a36eb6ae7a0b25ceddc7376c71a56 (diff) |
post fetch: update spec to test reshares data too
-rw-r--r-- | spec/lib/diaspora/fetcher/public_spec.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/spec/lib/diaspora/fetcher/public_spec.rb b/spec/lib/diaspora/fetcher/public_spec.rb index 8f8f405fb..f0e1f3738 100644 --- a/spec/lib/diaspora/fetcher/public_spec.rb +++ b/spec/lib/diaspora/fetcher/public_spec.rb @@ -134,7 +134,6 @@ describe Diaspora::Fetcher::Public do before do Timecop.freeze @now = DateTime.now.utc - @data = fixture_data.select {|item| item["post_type"] == "StatusMessage" } # save posts to db @fetcher.instance_eval { @@ -147,26 +146,26 @@ describe Diaspora::Fetcher::Public do end it "applies the date from JSON to the record" do - @data.each do |post| + fixture_data.each do |post| date = ActiveSupport::TimeZone.new("UTC").parse(post["created_at"]).to_i - entry = StatusMessage.find_by(guid: post["guid"]) + entry = Post.find_by(guid: post["guid"]) expect(entry.created_at.to_i).to eql(date) end end - it "copied the text correctly" do - @data.each do |post| + it "copied the text of status messages correctly" do + fixture_data.select {|item| item["post_type"] == "StatusMessage" }.each do |post| entry = StatusMessage.find_by(guid: post["guid"]) expect(entry.text).to eql(post["text"]) end end it "applies now to interacted_at on the record" do - @data.each do |post| + fixture_data.each do |post| date = @now.to_i - entry = StatusMessage.find_by(guid: post["guid"]) + entry = Post.find_by(guid: post["guid"]) expect(entry.interacted_at.to_i).to eql(date) end end |