Sha256: 15d39a9b343a541f4550aeb54fcc8ec420a294a0b8653578d84ebeb13e89dc64

Contents?: true

Size: 827 Bytes

Versions: 1

Compression:

Stored size: 827 Bytes

Contents

require 'spec_helper'

describe GoogleR::Event do
  before(:each) do
  end

  let(:event) { GoogleR::Event.new(nil) }

  it "represents with valid-formatted times" do
    time = Time.new(2012, 6, 4, 9, 34, 48, "-04:00")
    event.start_time = time
    format = event.to_google
    expect(format).to include("2012-06-04T09:34:48-04:00")
  end

  it "parses events which take whole day" do
    json = {
      "kind" => "calendar#event",
      "start" => {
        "date" => "2012-03-04",
      },
      "end" => {
        "date" => "2012-03-05",
      },
      "updated" => Time.now.to_s,
      "created" => Time.now.to_s,
    }

    event = GoogleR::Event.from_json(json, double(:calendar => nil))
    expect(event.start_time).to eq(Time.parse("2012-03-04"))
    expect(event.end_time).to eq(Time.parse("2012-03-05"))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_r-0.2.0 spec/google_event_spec.rb