Sha256: 64687b0504104807f89a2ac44ed717c8384d6e899c67ef3af4d30ab1bcec7a2e

Contents?: true

Size: 760 Bytes

Versions: 8

Compression:

Stored size: 760 Bytes

Contents

require 'spec_helper'

module Almanack::EventSource
  describe Static do
    describe "#events_between" do
      it "returns events between two dates" do
        now = Time.now
        yesterday = now - 1
        tomorrow = now + 1

        source = Static.new [
          { title: 'Yesterday', start_date: yesterday },
          { title: 'Today', start_date: now },
          { title: 'Tomorrow', start_date: tomorrow }
        ]

        expect(source.events_between(yesterday..tomorrow).map(&:title)).to eq(%w( Yesterday Today Tomorrow ))
        expect(source.events_between(now..tomorrow).map(&:title)).to eq(%w( Today Tomorrow ))
        expect(source.events_between(yesterday..now).map(&:title)).to eq(%w( Yesterday Today ))
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
almanack-1.0.5 spec/event_source/static_spec.rb
almanack-1.0.4 spec/event_source/static_spec.rb
almanack-1.0.3 spec/event_source/static_spec.rb
almanack-1.0.2 spec/event_source/static_spec.rb
almanack-1.0.1 spec/event_source/static_spec.rb
almanack-1.0.0 spec/event_source/static_spec.rb
almanack-1.0.0.pre1 spec/event_source/static_spec.rb
almanack-1.0.0.pre spec/event_source/static_spec.rb