Sha256: 079aa081cf7776510e2e19dcc6c642924d2db6b165a62cf3bb463531884e4dd3
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
require File.join(File.dirname(__FILE__), '/../../spec_helper') describe ShortLived do before(:all) do @window = stub :window end class SuperClass; def initialize(*); end; end module ThreadedMock def threaded lifetime # TODO end end def self.threaded_mock expected end context 'lifetime given as block' do before(:each) do @short_lived_class = Class.new(SuperClass) do include ShortLived lifetime { 10 + 10 } def threaded(*); end end end it "should define a method lifetime which returns the result of the block" do @short_lived_class.new(@window).lifetime.should == 20 end end context 'lifetime given normally' do before(:each) do @short_lived_class = Class.new(SuperClass) do include ShortLived lifetime 30 def threaded(*); end end end it "should define a method lifetime which returns the set value" do @short_lived_class.new(@window).lifetime.should == 30 end end context 'no lifetime given – what now?' do before(:each) do @short_lived_class = Class.new(SuperClass) do include ShortLived end end it "should raise a LifetimeMissingError" do lambda { @short_lived_class.new(@window) }.should raise_error(ShortLived::LifetimeMissingError) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gosu_extensions-0.1.11 | spec/lib/traits/short_lived_spec.rb |
gosu_extensions-0.1.10 | spec/lib/traits/short_lived_spec.rb |
gosu_extensions-0.1.9 | spec/lib/traits/short_lived_spec.rb |