Welcome to mirror list, hosted at ThFree Co, Russian Federation.

photo_spec.rb « activity_streams « models « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4081676ec3b8380b4a360a4a40dc18ba0c324862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

require 'spec_helper'

describe ActivityStreams::Photo do
  describe '.from_activity' do
    before do
      @json = JSON.parse <<JSON
        {"activity":{"actor":{"url":"http://cubbi.es/daniel","displayName":"daniel","objectType":"person"},"published":"2011-05-19T18:12:23Z","verb":"save","object":{"objectType":"photo","url":"http://i658.photobucket.com/albums/uu308/R3b3lAp3/Swagger_dog.jpg","image":{"url":"http://i658.photobucket.com/albums/uu308/R3b3lAp3/Swagger_dog.jpg","width":637,"height":469}},"provider":{"url":"http://cubbi.es/","displayName":"Cubbi.es"}}}
JSON
      @json = @json["activity"]
    end
    it 'marshals into an object' do
      photo = ActivityStreams::Photo.from_activity(@json)

      photo.image_url.should == @json["object"]["image"]["url"]
      photo.image_height.should == @json["object"]["image"]["height"]
      photo.image_width.should == @json["object"]["image"]["width"]
      photo.object_url.should == @json["object"]["url"]

      photo.provider_display_name.should == @json["provider"]["displayName"]
      photo.actor_url.should == @json["actor"]["url"]
    end

  end
end