Sha256: b62fa0f4c11a01908c8a8d0c9b94a02d85ebfdcc8cf719824ccf988034cbd37c
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
require_relative 'spec_helper' require 'dbuilder' describe "Dbuilder Gem integration" do it "creates an object that can be built up with a builder" do objekt = AbcBuilder.build.new objekt.letters.must_equal "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z" end it "plays nice in a threaded environment threads" do results = [] 1000.times do results << Thread.new do Thread.current['test_val'] = rand(100) class ValBuilder extend Dbuilder::Builder builder_defaults :values, (1..(Thread.current['test_val'] + 1)) end sleep 0.5 ValBuilder.build.new.values.must_equal((1..(Thread.current['test_val'] + 1))) end end results.each{|t| t.join} end private class Abc def letters Array(letters_of_the_alphabet).join(",") end end class AbcBuilder extend Dbuilder::Builder builder_defaults :letters_of_the_alphabet, ("a".."z") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dbuilder-0.5.0 | spec/integration_spec.rb |