Created
January 24, 2013 21:11
-
-
Save DavidBechtel/4627797 to your computer and use it in GitHub Desktop.
presents rspec test file
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
#presents_spec file | |
require './fizzbuzz_generator' | |
require './presents' | |
describe Presents, "#new" do | |
context 'as_text for output format' | |
it "returns fizzbuzz for numbers 1 through 15 in an array" do | |
p = Presents.new(FizzBuzzGenerator.new(15)) | |
p.as_text.should eq(["1 ","2 ","3 fizz ","4 ","5 buzz ","6 fizz ","7 ","8 ","9 fizz ","10 buzz ","11 ","12 fizz ","13 ","14 ","15 fizzbuzz "]) | |
end | |
context 'as_json for output format' | |
it "returns fizzbuzz for numbers 1 through 12 in an array" do | |
p = Presents.new(FizzBuzzGenerator.new(12)) | |
p.as_json.should eq("[\"1 \",\"2 \",\"3 fizz \",\"4 \",\"5 buzz \",\"6 fizz \",\"7 \",\"8 \",\"9 fizz \",\"10 buzz \",\"11 \",\"12 fizz \"]") | |
end | |
context 'as_html for output format' | |
it "returns fizzbuzz for numbers 1 through 8 in an array" do | |
p = Presents.new(FizzBuzzGenerator.new(8)) | |
p.as_html.should eq("<ul>\n\t<li> 1 </li> \n\t<li> 2 </li> \n\t<li> 3 fizz </li> \n\t<li> 4 </li> \n\t<li> 5 buzz </li> \n\t<li> 6 fizz </li> \n\t<li> 7 </li> \n\t<li> 8 </li> \n</ul>") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rspec test for Presents.rb program.