test/lib/rep_test.rb in rep-0.1.0 vs test/lib/rep_test.rb in rep-0.1.1
- old
+ new
@@ -54,9 +54,19 @@
inst = klass.new(:bar => 'notbar')
inst.bar.must_equal 'notbar'
inst.foo.must_be_nil
end
+ it "can take a block for initialization custimization" do
+ klass = new_rep_class do
+ initialize_with :foo do |opts|
+ opts[:foo] &&= opts[:foo].to_s
+ end
+ end
+ inst = klass.new(:foo => :bar)
+ inst.foo.must_equal 'bar'
+ end
+
it "should accept multiple sets of fields" do
klass = new_rep_class do
fields [:one, :four] => :default
fields [:one, :two, :three] => :superset
end