Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- describe PostComment do
- before do
- @user = User.create(uname: "mmarignoli", fname:"Marco", email:"test@test.com", password:"foobar", password_confirmation:"foobar")
- @post = Post.create(user_id: @user.id, title: "Example Post", content: "Hello this is a test Post")
- @firstComment = PostComment.create(content:"Hello There", post_id: @post.id, user_id: @user.id)
- @replyComment = PostCommentReply.create(content:"Hello to you", post_comment_id: @firstComment.id, user_id: @user.id)
- end
- it { should respond_to(:content) }
- it { should respond_to(:post_id) }
- it { should respond_to(:user_id) }
- describe "user should exist" do
- before { @user.uname == "mmarignoli"}
- it { should be_valid }
- end
- describe "post should exist" do
- before { @post.title == "Example Post"}
- it { should be_valid }
- end
- describe "it should have a post" do
- before { @firstComment.post.title == "Example Post"}
- it { should be_valid}
- end
- describe "it should have a reply" do
- before { @firstComment.post_comment_reply[0].content == "Hello to you" }
- it {should be_valid}
- end
- describe "it should have 550 char limit" do
- before { PostComment.new(content:"a"*551, post_id:1, user_id:1).valid? }
- it { should_not be_valid }
- end
- end
Add Comment
Please, Sign In to add comment