Simple Rspec example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
def initialize(attributes = {}) | |
@attributes = attributes | |
end | |
def publishable? | |
@attributes[:approved] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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