Sha256: 834db2a5f6cdae9f0c928d19b264d66bc1e3c01d7acfa52cd214e54a8e4f8088

Contents?: true

Size: 888 Bytes

Versions: 83

Compression:

Stored size: 888 Bytes

Contents

require 'spec_helper'

describe Tenon::EventDecorator do
  let(:ed) { Tenon::EventDecorator.new(event) }
  let!(:time) { Time.now.at_beginning_of_day }

  describe '#display_date' do
    context 'a single day event' do
      let(:event) { double(starts_at: time, ends_at: time + 1.hour) }

      it 'should show the day and the times' do
        str = "#{time.strftime('%B %d, %Y')} from #{time.strftime('%I:%M%p')} until #{(time + 1.hour).strftime('%I:%M%p')}"
        expect(ed.display_date).to eq str
      end
    end

    context 'a multi-day event' do
      let(:event) { double(starts_at: time, ends_at: time + 2.days) }

      it 'should show the start day and time and the end day and time' do
        str = "#{time.strftime("%B %d, %Y at %I:%M%p")} until #{(time + 2.days).strftime("%B %d, %Y at %I:%M%p")}"
        expect(ed.display_date).to eq str
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.7 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.6 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.5 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.4 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.3 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.2 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.1.1 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.76 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.75 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.74 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.73 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.72 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.71 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.70 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.69 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.68 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.67 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.66 spec/decorators/tenon/event_decorator_spec.rb
tenon-1.0.65 spec/decorators/tenon/event_decorator_spec.rb