Created
November 12, 2013 19:08
-
-
Save justincampbell/7436851 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 'spec_helper' | |
require 'mrproper' | |
properties 'String' do | |
data string: String, wrap_at: Integer | |
property '#wrap' do |data| | |
assert_not_empty data[:string].wrap(data[:wrap_at]) | |
end | |
end | |
describe String do | |
describe "#wrap" do | |
let(:string) { "One two three four five" } | |
it { string.wrap(1).should == "One\ntwo\nthree\nfour\nfive" } | |
it { string.wrap(10).should == "One two\nthree four\nfive" } | |
context "when wrapping at 0" do | |
it "wraps at 1" do | |
string.wrap(0).should == "One\ntwo\nthree\nfour\nfive" | |
end | |
end | |
print "Creating checks" | |
# until (end_date ||= Time.now + 1) < Time.now | |
1_000.times do | |
putc "." | |
words = rand(255) | |
characters = rand(32) | |
input = words.times.map { |word| | |
characters.times.map { |letter| | |
letter.to_s | |
}.join | |
}.join(' ') | |
context "with '#{input}'" do | |
wrap_length = rand(255) | |
context "wrapped at #{wrap_length}" do | |
it "works" do | |
input.wrap(wrap_length) | |
end | |
end | |
end | |
end | |
puts "done." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment