Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View string_spec.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
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
Something went wrong with that request. Please try again.