Sha256: a2033f3de511ef6dc43e4da9373812e37721858293eb72c5e826a943d2b804a2
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 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, params: { 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, params: { 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 = FactoryBot.create_list(:post, 11, published: true, tags: [tag]) get :show, params: { id: tag } expect(assigns(:taggables).count).to eq(10) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
exposition-0.0.5.7.pre.alpha | spec/controllers/exposition/tags_controller_spec.rb |
exposition-0.0.5.6.pre.alpha | spec/controllers/exposition/tags_controller_spec.rb |