Sha256: f07cb6a3e0f3899f4f01add4e6b1b919a91bc2bd7aee6aff27440d446e7a7f6c

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

describe EventCalendar::ApplicationHelper do
  describe "time_with_zones (singular)" do
    it "returns times" do
      time = Time.now
      helper.time_with_zones(time).should eq [
        ["Eastern", time.in_time_zone("Eastern Time (US & Canada)").strftime(TIME_BASE)],
        ["Central", time.in_time_zone("Central Time (US & Canada)").strftime(TIME_BASE)],
        ["Mountain", time.in_time_zone("Mountain Time (US & Canada)").strftime(TIME_BASE)],
        ["Pacific", time.in_time_zone("Pacific Time (US & Canada)").strftime(TIME_BASE)]
      ]
    end
  end
  
  describe "open_if_current_month..." do
    let(:month_names) do
      %w(January February March April May June July August September October
        November December)
    end
    let(:current_month){Date.current.strftime("%B")}
    let(:non_current_month){month_names.select{|m| m != current_month}.first}
    it "returns 'closed' given a non-current-month and nil open_or_closed" do
      helper.open_if_current_month(non_current_month, nil).should eq 'closed'
    end
    it "returns 'open' given a current-month and any open_or_closed" do
      helper.open_if_current_month(current_month, nil).should eq 'open'
      helper.open_if_current_month(current_month, 'closed').should eq 'open'
      helper.open_if_current_month(current_month, 'open').should eq 'open'
    end
    it "returns given open_or_closed when it is not nil and a non-current-month" do
      helper.open_if_current_month(non_current_month, 'open').should eq 'open'
      helper.open_if_current_month(non_current_month, 'closed').should eq 'closed'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
event_calendar_engine-0.2.15 spec/helpers/event_calendar/application_helper_spec.rb
event_calendar_engine-0.2.14 spec/helpers/event_calendar/application_helper_spec.rb
event_calendar_engine-0.2.13 spec/helpers/event_calendar/application_helper_spec.rb
event_calendar_engine-0.2.11 spec/helpers/event_calendar/application_helper_spec.rb