Sha256: 50bd00280fc01d8bf9af5835c6b5b208044faa03e50dca0e9a7034268ee3da38
Contents?: true
Size: 1.48 KB
Versions: 14
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' require 'acts_as_fu' RSpec.configure do |config| config.include ActsAsFu end describe EventInstanceMethods do before(:each) do build_model :fake_event do ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env.to_sym]) string :name datetime :start_on datetime :end_on string :timezone include EventInstanceMethods end end let(:event) do FakeEvent.new({ :name => 'One Day', :start_on => Time.now, :end_on => Time.now, :timezone => "Pacific Time (US & Canada)" }) end context "distinguishing one day events from the rest" do it "given a start_on & end_on, compare day, month and year" do event.one_day?.should be_true event.end_on = 1.day.from_now event.one_day?.should be_false end it "given only a start_on, return true" do event.end_on = nil event.one_day?.should be_true end it "given only a end_on, ... return true" do event.start_on = nil event.one_day?.should be_true end end it "knows start|end_day" do event.start_day.should eq Date.today.day event.end_day.should eq Date.today.day end it "knows start|end_month" do event.start_month.should eq Date.today.strftime('%B') event.end_month.should eq Date.today.strftime("%B") end it "knows start|end_year" do event.start_year.should eq Date.today.year event.end_year.should eq Date.today.year end end
Version data entries
14 entries across 14 versions & 1 rubygems