Skip to content

Instantly share code, notes, and snippets.

@iain
Created April 10, 2010 13:50
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 iain/362030 to your computer and use it in GitHub Desktop.
Save iain/362030 to your computer and use it in GitHub Desktop.
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