Created
August 6, 2010 09:17
-
-
Save ashmoran/511087 to your computer and use it in GitHub Desktop.
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
require 'rspec' | |
class Quiz | |
def self.answer(question) | |
42 | |
end | |
end | |
# Test | |
module MyMacro | |
def should_answer(question, answer) | |
it "should answer '#{question}' with #{answer}" do | |
Quiz.answer(question).should == answer | |
end | |
end | |
end | |
RSpec.configure do |config| | |
config.extend MyMacro | |
end | |
describe Quiz do | |
ANSWER = 42 | |
before(:all) do | |
# @answer = 42 | |
end | |
should_answer("What's the meaning of life?", ANSWER) | |
should_answer("What comes after 41?", ANSWER) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment