Sha256: 2ae52d66186c6d2f3c32600c403ea82a59e08212f619c532f7fc78879bf69805
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
require 'rails_helper' RSpec.describe Exposition::TagsController, type: :controller do routes { Exposition::Engine.routes } describe "GET #show" do it "finds the given tag" do tag = create(:tag) get :show, id: tag expect(assigns(:tag)).to eq(tag) end it "finds all the published posts ordered by date with the tag" do tag = create(:tag) tagged_older_post = create(:post, published: true, tags: [tag]) tagged_newer_post = create(:post, published: true, tags: [tag]) tagged_unpublished_post = create(:post, published: false, tags: [tag]) untagged_post = create(:post, published: true) tagged_older_post.published_at = Date.today - 2.days tagged_newer_post.published_at = Date.today tagged_older_post.save! tagged_newer_post.save! get :show, id: tag expect(assigns(:taggables)).to eq([tagged_newer_post, tagged_older_post]) end it "paginates the results in chunks of 10" do tag = create(:tag) posts = FactoryGirl.create_list(:post, 11, published: true, tags: [tag]) get :show, id: tag expect(assigns(:taggables).count).to eq(10) end end end
Version data entries
5 entries across 5 versions & 1 rubygems