Skip to content

Instantly share code, notes, and snippets.

@jeroenvandijk
Created December 27, 2010 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroenvandijk/756334 to your computer and use it in GitHub Desktop.
Save jeroenvandijk/756334 to your computer and use it in GitHub Desktop.
index.tokamak
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
}
}
]
}
"""
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
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