Sha256: e95abb6541c013d0638f787c168c9365e4258b25479eb437957ed63096411da3
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'minitest/autorun' require 'minitest/spec' require 'blank_slate' include BlankSlate module BlankSlate class TesterClass def one "one" end end end describe "BlankSlate" do def blank_slate(&block) BlankSlate(BlankSlate::TesterClass, &block) end it "returns a class with all instance_methods of the given class" do assert_equal BlankSlate::TesterClass.instance_methods.sort, blank_slate.instance_methods.sort end it "sets the values of instance methods to nil" do null_object = blank_slate.new null_object.one.must_be_nil end it "accepts a block to define methods on the null class" do null_object = blank_slate do def passed_block_method 'this is from the method defined in the block!' end end.new null_object.passed_block_method.must_equal 'this is from the method defined in the block!' end it "allows the block to override method definitions from the given class" do null_object = blank_slate do def one 'not the same one' end end.new null_object.one.must_equal 'not the same one' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blank_slate-1.0.0 | test/lib/blank_slate_test.rb |