Skip to content

Instantly share code, notes, and snippets.

@scytacki
Last active December 16, 2015 07:38
Show Gist options
  • Save scytacki/5399605 to your computer and use it in GitHub Desktop.
Save scytacki/5399605 to your computer and use it in GitHub Desktop.
Feature: External Activities can support a REST api
Background:
Given the following external REST activity:
| name | "Cool Thing" |
| create_url | "http://example.com/activity/1/sessions/" |
And the stub request "create a session" matches
"""
POST /activity/1/sessions/ HTTP/1.1
Host: example.com
Content-Type: application/json
"""
And the stub request "create a session" responds with
"""
HTTP/1.1 201 Created
Location: http://example.com/activity/1/sessions/1
Content-Type: application/json
{
"id": 1
}
"""
And the stub request "run a session" matches
"""
GET /activity/1/sessions/1
Host: example.com
"""
And the stub request "run a session" responds with
"""
HTTP/1.1 200 OK
Content-Type: text/plain
Super Cool Activity here.
"""
Scenario: External REST activity is run the first time
When a student first runs the external activity "Cool Thing"
Then the stub request "create a session" should have been requested
And the stub request "run a session" should have been requested
Scenario: External REST activity is run the second time
Given a student has already run the external REST activity "Cool Thing" before
When a student first runs the external activity "Cool Thing"
Then the stub request "create a session" should not have been requested
And the stub request "run a session" should have been requested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment