Sha256: 44492b31850f660bad2105a93081f9d719460f791b27cffbe59d44fc9d3fa5ef

Contents?: true

Size: 915 Bytes

Versions: 33

Compression:

Stored size: 915 Bytes

Contents

describe "Numeric Timer methods" do

  describe "Numeric" do
    it "should have a #later method" do
      @later = nil
      0.9.seconds.later do
        @later = true
      end
      wait 1 {
        @later.should == true
      }
    end

    it "should have a #every method" do
      @every = 0
      @stop_me = 480.milliseconds.every do
        @every += 1
      end
      wait 1 {
        @every.should == 2
        @stop_me.invalidate
      }
    end
  end

  describe "NSTimer" do

    it "should have a #later method" do
      @later = nil
      NSTimer.after(0.9.seconds) do
        @later = true
      end
      wait 1 {
        @later.should == true
      }
    end

    it "should have a #every method" do
      @every = 0
      @stop_me = NSTimer.every(480.milliseconds) do
        @every += 1
      end
      wait 1 {
        @every.should == 2
        @stop_me.invalidate
      }
    end

  end

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
sugarcube-4.0.0 spec/cocoa/timer_spec.rb
sugarcube-3.5.0 spec/cocoa/timer_spec.rb
sugarcube-3.4.2 spec/cocoa/timer_spec.rb
sugarcube-3.4.1 spec/cocoa/timer_spec.rb
sugarcube-3.4.0 spec/cocoa/timer_spec.rb
sugarcube-3.3.7 spec/cocoa/timer_spec.rb
sugarcube-3.3.6 spec/cocoa/timer_spec.rb
sugarcube-3.3.5 spec/cocoa/timer_spec.rb
sugarcube-3.3.4 spec/cocoa/timer_spec.rb
sugarcube-3.3.3 spec/cocoa/timer_spec.rb
sugarcube-3.3.2 spec/cocoa/timer_spec.rb
sugarcube-3.3.1 spec/cocoa/timer_spec.rb
sugarcube-3.3.0 spec/cocoa/timer_spec.rb
sugarcube-3.2.0 spec/cocoa/timer_spec.rb
sugarcube-3.1.1 spec/cocoa/timer_spec.rb
sugarcube-3.1.0 spec/cocoa/timer_spec.rb
sugarcube-3.0.8 spec/cocoa/timer_spec.rb
sugarcube-3.0.7 spec/cocoa/timer_spec.rb
sugarcube-3.0.6 spec/cocoa/timer_spec.rb
sugarcube-3.0.5 spec/cocoa/timer_spec.rb