Instantly share code, notes, and snippets.

@iain /post.rb
Created Apr 10, 2010

Embed
What would you like to do?
Simple Rspec example
class Post
def initialize(attributes = {})
@attributes = attributes
end
def publishable?
@attributes[:approved]
end
end
describe Post do
context "when it's not approved" do
subject { Post.new(:approved => false) }
it { should_not be_publishable }
end
context "when it's approved" do
subject { Post.new(:approved => true) }
it { should be_publishable }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment