Sha256: f8c9194b55f8c1b30a83e9ee41198992b5cf8514bc80743130ee8954f142c011
Contents?: true
Size: 1.59 KB
Versions: 40
Compression:
Stored size: 1.59 KB
Contents
require 'rails_helper' describe Virgo::Post do describe "#publish_scheduled!" do it "should set a non-live post to live if it has status=published and its publish_at date is in the past" do @post = create(:post, status: :published, publish_at: 1.day.from_now) expect(@post.live).to be false @post.update!(publish_at: 1.day.ago) @post.update_column :live, false expect(@post.live).to be false Virgo::Post.publish_scheduled! @post.reload expect(@post.live).to be true end end describe "#front_page_feature" do it "should surface the most recent post marked as front page feature" do @most_recent = create(:post, publish_at: 1.minute.ago, feature_on_front_page: true) @next_most_recent = create(:post, publish_at: 5.minutes.ago, feature_on_front_page: true) expect(Virgo::Post.front_page_feature).to eq @most_recent expect(Virgo::Post.exclude_front_page_feature).to_not include @most_recent end end describe "#category_page_feature" do it "should surface the most recent post marked as category page feature" do @most_recent = create(:post, publish_at: 1.minute.ago, feature_on_category_page: true) @next_most_recent = create(:post, publish_at: 5.minutes.ago, feature_on_category_page: true) @category = create(:category) @most_recent.categories << @category @next_most_recent.categories << @category expect(Virgo::Post.category_feature(@category)).to eq @most_recent expect(Virgo::Post.exclude_category_feature(@category)).to_not include @most_recent end end end
Version data entries
40 entries across 40 versions & 1 rubygems