Sha256: b07488ecdcb573fda2ec1cf86efd0d387bc64c9264fcfc97fac8c8b4a3decfc4

Contents?: true

Size: 1.35 KB

Versions: 23

Compression:

Stored size: 1.35 KB

Contents

require File.join(File.dirname(__FILE__), '../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

23 entries across 23 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/project_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/project_spec.rb
fb_graph-1.6.9 spec/fb_graph/project_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/project_spec.rb
fb_graph-1.6.8 spec/fb_graph/project_spec.rb
fb_graph-1.6.7 spec/fb_graph/project_spec.rb
fb_graph-1.6.5 spec/fb_graph/project_spec.rb
fb_graph-1.6.4 spec/fb_graph/project_spec.rb
fb_graph-1.6.3 spec/fb_graph/project_spec.rb
fb_graph-1.6.2 spec/fb_graph/project_spec.rb
fb_graph-1.6.1 spec/fb_graph/project_spec.rb
fb_graph-1.6.0 spec/fb_graph/project_spec.rb
fb_graph-1.5.5 spec/fb_graph/project_spec.rb
fb_graph-1.5.4 spec/fb_graph/project_spec.rb
fb_graph-1.5.3 spec/fb_graph/project_spec.rb
fb_graph-1.5.2 spec/fb_graph/project_spec.rb
fb_graph-1.5.1 spec/fb_graph/project_spec.rb
fb_graph-1.5.0 spec/fb_graph/project_spec.rb
fb_graph-1.4.1 spec/fb_graph/project_spec.rb
fb_graph-1.4.0 spec/fb_graph/project_spec.rb