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

Version Path
virgo-0.3.17 spec/models/post_spec.rb
virgo-0.3.16 spec/models/post_spec.rb
virgo-0.3.15 spec/models/post_spec.rb
virgo-0.3.14 spec/models/post_spec.rb
virgo-0.3.13 spec/models/post_spec.rb
virgo-0.3.12 spec/models/post_spec.rb
virgo-0.3.11 spec/models/post_spec.rb
virgo-0.3.10 spec/models/post_spec.rb
virgo-0.3.9 spec/models/post_spec.rb
virgo-0.3.8 spec/models/post_spec.rb
virgo-0.3.7 spec/models/post_spec.rb
virgo-0.3.6 spec/models/post_spec.rb
virgo-0.3.4 spec/models/post_spec.rb
virgo-0.3.3 spec/models/post_spec.rb
virgo-0.3.2 spec/models/post_spec.rb
virgo-0.3.1 spec/models/post_spec.rb
virgo-0.3 spec/models/post_spec.rb
virgo-0.2.9 spec/models/post_spec.rb
virgo-0.2.8 spec/models/post_spec.rb
virgo-0.2.7 spec/models/post_spec.rb