mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-16 12:40:07 -04:00
fix specs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user