fix specs

This commit is contained in:
Brenda
2020-02-10 11:02:16 +13:00
committed by Brenda Wallace
parent dcb05c2e1e
commit 821ddd90cb
6 changed files with 14 additions and 10 deletions

View File

@@ -54,6 +54,8 @@ class PostsController < ApplicationController
@author.posts
else
Post
end.order(created_at: :desc).includes(:author, comments: :author).paginate(page: params[:page], per_page: 12)
end.order(created_at: :desc)
.includes(:author, :crop_posts, :crops, comments: :author)
.paginate(page: params[:page], per_page: 12)
end
end

View File

@@ -1,5 +1,5 @@
- if current_member.present?
.flex-column.nav-pills
.flex-column.nav-pills.layout-nav
/ %h2.card-title #{model} links
= link_to url_for([current_member, model]), class: 'nav-link' do
My #{model.model_name.human.pluralize}

View File

@@ -10,7 +10,7 @@
by
= succeed "," do
%a.font-weight-bold= post.author
%p= post_stripped_tags(post, length: 300)
%p.post-body= post_stripped_tags(post, length: 300)
%h6.font-weight-bold.mb-3
- post.crops.each do |crop|
= link_to crop do

View File

@@ -29,8 +29,8 @@
= succeed "." do
= link_to "comments RSS feed", comments_path(format: 'rss')
.col-10
.row
- @posts.includes(:author, :crop_posts, :crops).order(created_at: :desc).each do |post|
.col-lg-3.col-md-6.mb-3
.row.posts
- @posts.each do |post|
.col-lg-3.col-md-6.mb-3.post
= render 'posts/preview', post: post
= will_paginate @posts

View File

@@ -14,7 +14,7 @@ describe "Gardens" do
describe '#index' do
shared_examples "has buttons bar at top" do
it "has buttons bar at top" do
within '.button-bar' do
within '.layout-nav' do
expect(subject).to have_link 'Add a garden'
expect(subject).to have_link 'My gardens'
expect(subject).to have_link "Everyone's gardens"

View File

@@ -23,12 +23,14 @@ describe "posts/index" do
it "renders a list of posts" do
assert_select "div.post", count: 2
assert_select "h5", text: "A Post", count: 2
assert_select "div.post-body", text: "This is some text.".to_s, count: 2
assert_select "h4", text: "A Post", count: 2
assert_select "p.post-body", text: "This is some text.", count: 2
end
it "contains two gravatar icons" do
assert_select "img", src: %r{gravatar\.com/avatar}, count: 2
within '.posts' do
assert_select "img", src: %r{gravatar\.com/avatar}, count: 2
end
end
it "contains RSS feed links for posts and comments" do