Last active
December 16, 2015 19:00
-
-
Save psndcsrv/5482283 to your computer and use it in GitHub Desktop.
cucumber tests for publishing api
This file contains hidden or 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
Feature: External Activities can support a REST publishing api | |
Background: | |
Given an external activity named "Fun Stuff" with the definition | |
""" | |
{ | |
"name": "Cool Activity", | |
"url": "http://activity.com/activity/1", | |
"create_url": "http://activity.com/activity/1/sessions/", | |
"description": "This activity does fun stuff.", | |
"sections": [ | |
{ | |
"name": "Section 1", | |
"pages": [ | |
{ | |
"name": "Page 1", | |
"elements": [ | |
{ | |
"type": "open_response", | |
"id": "1234567", | |
"prompt": "Do you like this activity?" | |
}, | |
{ | |
"type": "multiple_choice", | |
"id": "456789", | |
"prompt": "What color is the sky?", | |
"multiple_selection_allowed": false, | |
"choices": [ | |
{ | |
"id": "97", | |
"content": "red" | |
}, | |
{ | |
"id": "98", | |
"content": "blue", | |
"correct": true | |
}, | |
{ | |
"id": "99", | |
"content": "green" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
""" | |
And a modified version of the external activity named "Fun Stuff" with the definition | |
""" | |
{ | |
"name": "Cool Activity", | |
"url": "http://activity.com/activity/1", | |
"create_url": "http://activity.com/activity/1/sessions/", | |
"sections": [ | |
{ | |
"name": "Section 1", | |
"pages": [ | |
{ | |
"name": "Page 1", | |
"elements": [ | |
{ | |
"type": "open_response", | |
"id": "1234568", | |
"prompt": "Why do you like/dislike this activity?" | |
}, | |
{ | |
"type": "multiple_choice", | |
"id": "456789", | |
"prompt": "What color is the sky?", | |
"multiple_selection_allowed": false, | |
"choices": [ | |
{ | |
"id": "97", | |
"content": "red" | |
}, | |
{ | |
"id": "98", | |
"content": "blue", | |
"correct": true | |
}, | |
{ | |
"id": "99", | |
"content": "greenish-green" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
""" | |
@mechanize | |
Scenario: External REST activity is published the first time | |
When the external runtime publishes the activity "Fun Stuff" | |
Then the portal should create an external activity with the following attributes: | |
| name | Cool Activity | | |
| url | http://activity.com/activity/1 | | |
| rest_create_url | http://activity.com/activity/1/sessions/ | | |
| description | This activity does fun stuff. | | |
And the external activity should have a template | |
And the portal should create an activity with the following attributes: | |
| name | Cool Activity | | |
And the portal should create a section with the following attributes: | |
| name | Section 1 | | |
And the portal should create a page with the following attributes: | |
| name | Page 1 | | |
And the portal should create an open response with the following attributes: | |
| prompt | Do you like this activity? | | |
| external_id | 1234567 | | |
And the portal should create a multiple choice with the following attributes: | |
| prompt | What color is the sky? | | |
| multiple_selection | false | | |
| external_id | 456789 | | |
| choices | [{:external_id => 97, :choice => "red"},{:external_id => 98, :choice => "blue"},{:external_id => 99, :choice => "green"}] | | |
@mechanize | |
Scenario: External REST activity is published the second time | |
Given the external runtime published the activity "Fun Stuff" before | |
When the external runtime publishes the activity "Fun Stuff" again | |
Then magic stuff happens | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment