spec/features/comments_spec.rb in storytime-1.2.0 vs spec/features/comments_spec.rb in storytime-2.0.0

- old
+ new

@@ -1,17 +1,17 @@ require 'spec_helper' describe "Comments" do before do - setup_site + # setup_site login end it "lists comments on a post" do - post = FactoryGirl.create(:post) - 3.times{ FactoryGirl.create(:comment, post: post) } - other_post_comment = FactoryGirl.create(:comment) + post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first) + 3.times{ FactoryGirl.create(:comment, post: post, site: @current_site) } + other_post_comment = FactoryGirl.create(:comment, site: @current_site) visit url_for([post, only_path: true]) post.comments.each do |c| page.should have_content(c.content) @@ -20,11 +20,11 @@ page.should_not have_content(other_post_comment.content) end it "creates a comment" do - post = FactoryGirl.create(:post) + post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first) comment_count = post.comments.count visit url_for([post, only_path: true]) fill_in "comment_content", with: "Here's some comment content" @@ -36,17 +36,16 @@ expect(comment.content).to eq("Here's some comment content") expect(comment.user).to eq(current_user) end it "deletes a comment", js: true do - post = FactoryGirl.create(:post) - other_persons_comment = FactoryGirl.create(:comment, post: post) - comment_to_delete = FactoryGirl.create(:comment, post: post, user: current_user) + post = FactoryGirl.create(:post, site: @current_site, blog: @current_site.blogs.first) + other_persons_comment = FactoryGirl.create(:comment, post: post, site: @current_site) + comment_to_delete = FactoryGirl.create(:comment, post: post, user: current_user, site: @current_site) visit url_for([post, only_path: true]) expect(page).to have_content(other_persons_comment.content) - expect(page).to_not have_link("delete_comment_#{other_persons_comment.id}") expect(page).to have_content(comment_to_delete.content) click_link "delete_comment_#{comment_to_delete.id}" expect(page).to_not have_content(comment_to_delete.content)