Skip to content

Instantly share code, notes, and snippets.

@antillas21
Created January 27, 2013 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antillas21/4647648 to your computer and use it in GitHub Desktop.
Save antillas21/4647648 to your computer and use it in GitHub Desktop.
Rspec Post spec
# spec/models/post_spec.rb
require 'spec_helper'
describe Post do
let(:post) { Post.new }
describe 'basic attributes' do
it 'needs a title, content and name' do
post.title = 'post title'
post.name = 'post name'
post.content = 'post content'
post.save.should be_true
end
end
end
@nisevi
Copy link

nisevi commented Jan 28, 2013

thank you for your help!! i'm creating the structure of the folder so now i have:

spec/models/tag_rspec.rb

spec/models/post_rspec.rb

spec/models/comment_rspec.rb

but i've another dude....can i control the relationship between models? for example: if i want to control that a comment only have a post associated.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment