Skip to content

@justincampbell /string_spec.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.