Sha256: 75b98cd73328fc3304a373f0ffdd2e544d4310f83fc5449a2354eab6d86f554b
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'timespan/mongoid/spec_helper' describe Range do subject { timerange } describe 'create DurationRange' do let(:range) { (1..5) } let (:timerange) { range.days } specify { subject.should be_a DurationRange } its(:min) { should be_a Fixnum } its(:max) { should be_a Fixnum } specify { subject.min.should == 1.day } specify { subject.max.should == 5.days } end end describe DurationRange do subject { timerange } let(:range) { (1..5) } context 'day range' do let (:timerange) { range.days } its(:range) { should be_a Range } its(:min) { should == 1.day } its(:max) { should == 5.days } its(:unit) { should == :days } specify { subject.between?(4.days).should be_true } end context 'week range' do let (:timerange) { range.weeks } its(:range) { should be_a Range } its(:min) { should == 1.week } its(:max) { should == 5.weeks } its(:unit) { should == :weeks } end context 'month range' do let (:timerange) { range.months } its(:min) { should == 1.month } its(:max) { should == 5.months } its(:unit) { should == :months } end context 'year range' do let (:timerange) { range.years } its(:min) { should == 1.year } its(:max) { should == 5.years } its(:unit) { should == :years } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timespan-0.5.3 | spec/timespan/core_ext/duration_range_spec.rb |
timespan-0.5.2 | spec/timespan/core_ext/duration_range_spec.rb |