Sha256: d69525430a60b8db6ad3a99dcaeb6db4c75e007447a016b015eedc6b14b5971d

Contents?: true

Size: 1.32 KB

Versions: 109

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe FbGraph::Project, '.new' do

  it 'should setup all supported attributes' do
    attributes = {
      :id   => 184246058253896,
      :name => "Drecom Blog",
      :with => [{
        :id   => 1064067203,
        :name => "Takanori Ishikawa"
      }],
      :start_date => "2008-04",
      :end_date   => "2008-09"
    }
    project = FbGraph::Project.new(attributes.delete(:id), attributes)
    project.with.should == [FbGraph::User.new(1064067203, :name => "Takanori Ishikawa")]
    project.start_date.should == Date.new(2008, 4)
    project.end_date.should   == Date.new(2008, 9)
  end

  it 'should treat 2008-00 style date' do
    attributes = {
      :id   => 184246058253896,
      :name => "Drecom Blog",
      :start_date => "2008-00",
      :end_date   => "2009-00"
    }
    project = FbGraph::Project.new(attributes.delete(:id), attributes)
    project.start_date.should == Date.new(2008)
    project.end_date.should   == Date.new(2009)
  end

  it 'should treat 2008 style date' do
    attributes = {
      :id   => 184246058253896,
      :name => "Drecom Blog",
      :start_date => "2008",
      :end_date   => "2009"
    }
    project = FbGraph::Project.new(attributes.delete(:id), attributes)
    project.start_date.should == Date.new(2008)
    project.end_date.should   == Date.new(2009)
  end

end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
fb_graph-2.1.2 spec/fb_graph/project_spec.rb
fb_graph-2.1.1 spec/fb_graph/project_spec.rb
fb_graph-2.1.0 spec/fb_graph/project_spec.rb
fb_graph-2.1.0.alpha spec/fb_graph/project_spec.rb
fb_graph-2.0.2 spec/fb_graph/project_spec.rb
fb_graph-2.0.1 spec/fb_graph/project_spec.rb
fb_graph-2.0.0 spec/fb_graph/project_spec.rb
fb_graph-2.0.0.beta spec/fb_graph/project_spec.rb
fb_graph-2.0.0.alpha spec/fb_graph/project_spec.rb
fb_graph-1.9.5 spec/fb_graph/project_spec.rb
fb_graph-1.9.4 spec/fb_graph/project_spec.rb
fb_graph-1.9.3 spec/fb_graph/project_spec.rb
fb_graph-1.9.2 spec/fb_graph/project_spec.rb
fb_graph-1.9.1 spec/fb_graph/project_spec.rb
fb_graph-1.9.0 spec/fb_graph/project_spec.rb
fb_graph-1.8.6 spec/fb_graph/project_spec.rb
fb_graph-1.8.5 spec/fb_graph/project_spec.rb
fb_graph-1.8.4 spec/fb_graph/project_spec.rb
fb_graph-1.8.3 spec/fb_graph/project_spec.rb
fb_graph-1.8.2 spec/fb_graph/project_spec.rb