Sha256: 17a35cd3b41c277df28b9b01e868fdfbca2f05ad839d889fc2a38600487bbe7f

Contents?: true

Size: 1.04 KB

Versions: 31

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "TimeDSL" do
  it "Should do second/seconds" do
    10.seconds.should == 10
    1.second.should == 1
  end

  it "Should do minute/minutes" do
    22.minutes.should == 22 * 60
    1.minute.should == 60
  end

  it "Should do hour/hours" do
    24.hours.should == 24 * 3600
    1.hour.should == 3600
  end

  it "Should do day/days" do
    7.days.should == 7 * 24 * 3600
    1.day.should == 24 * 3600
  end

  it "Should do month/months" do
    9.months.should == 9 * 30 * 24 * 3600
    1.month.should == 30 * 24 * 3600
  end

  it "Should do year/years" do
    3.years.should == 3 * 364.25 * 24 * 3600
    1.year.should == 364.25 * 24 * 3600
  end

  it "Should do ago/until" do
    5.seconds.ago.should be_close(Time.now - 5, 0.5)
    8.minutes.until(3.minute.from_now).should be_close(3.minutes.from_now - 8 * 60, 0.5)
  end

  it "Should do from_now/since" do
    3.seconds.from_now.should be_close(Time.now + 3, 0.5)
    2.minutes.since(2.minutes.ago).should be_close(2.minutes.ago + 2 * 60, 0.5)
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/merb-helpers-0.9.14/spec/time_dsl_spec.rb
merb-helpers-1.0.15 spec/time_dsl_spec.rb
merb-helpers-1.0.14 spec/time_dsl_spec.rb
merb-helpers-1.0.13 spec/time_dsl_spec.rb
merb-helpers-1.0.12 spec/time_dsl_spec.rb
merb-helpers-0.9.10 spec/time_dsl_spec.rb
merb-helpers-0.9.9 spec/time_dsl_spec.rb
merb-helpers-1.0.1 spec/time_dsl_spec.rb
merb-helpers-1.0.10 spec/time_dsl_spec.rb
merb-helpers-1.0.11 spec/time_dsl_spec.rb
merb-helpers-1.0.5 spec/time_dsl_spec.rb
merb-helpers-0.9.8 spec/time_dsl_spec.rb
merb-helpers-0.9.13 spec/time_dsl_spec.rb
merb-helpers-0.9.12 spec/time_dsl_spec.rb
merb-helpers-0.9.11 spec/time_dsl_spec.rb