Created
December 27, 2010 17:37
-
-
Save jeroenvandijk/756334 to your computer and use it in GitHub Desktop.
index.tokamak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: One activity | |
Given one activity | |
Given I 'GET' to '/api/v1/activities?user_id=@me&scope=@consumption&auth_token=cdncwcrcjgjy8iwTeCBv15BFI35dInU' | |
Then I should get a response '200' with the following json: | |
""" | |
{ "activities": | |
[ | |
{ | |
"id": 1, | |
"title": "likes your app x", | |
"actor": { | |
"type": "user", | |
"id": 3 | |
}, | |
"verbs": [ | |
"post" | |
], | |
"object": { | |
"type": "comment", | |
"id": 1, | |
"content": "Vel voluptate aliquid et doloribus sint eum ad sequi." | |
}, | |
"indirect_object": { | |
"type": "app", | |
"id": 1 | |
} | |
} | |
] | |
} | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
collection(@activities) do |collection| | |
collection.members do |member, activity| | |
member.values { |values| | |
values.id activity.id | |
values.title activity.title | |
# values.published_at activity.published_at | |
# ACTOR | |
values.actor { | |
values.type activity.actor_type.downcase | |
values.id activity.actor_id | |
} | |
# VERB | |
values.verbs activity.verbs | |
# OBJECT | |
values.object { | |
values.type activity.object_type.downcase | |
values.id activity.object_id | |
values.content activity.object.content if activity.object_content? | |
} | |
# Indirect OBJECT | |
if activity.indirect_object | |
values.indirect_object { | |
values.type activity.indirect_object_type.downcase | |
values.id activity.indirect_object_id | |
} | |
end | |
} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: Two activities | |
Given some activities | |
Given I 'GET' to '/api/v1/activities?user_id=@me&scope=@consumption&auth_token=cdncwcrcjgjy8iwTeCBv15BFI35dInU' | |
Then I should get a response '200' with the following json: | |
""" | |
{ "activities": | |
[ | |
{ | |
"id": 1, | |
"title": "likes your app x", | |
"actor": { | |
"type": "user", | |
"id": 3 | |
}, | |
"verbs": [ | |
"post" | |
], | |
"object": { | |
"type": "comment", | |
"id": 1, | |
"content": "Vel voluptate aliquid et doloribus sint eum ad sequi." | |
}, | |
"indirect_object": { | |
"type": "app", | |
"id": 1 | |
} | |
}, | |
{ | |
"id": 2, | |
"title": "likes activity x", | |
"actor": { | |
"type": "user", | |
"id": 2 | |
}, | |
"verbs": [ | |
"mark as liked" | |
], | |
"object": { | |
"type": "activity", | |
"id": 1 | |
} | |
} | |
] | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment