Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 118 lines (113 sloc) 3.974 kb
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
Feature: REST API

Background:
Given I create the file "app/todo.txt" contening:
"""
(A) Crack the Da Vinci Code.
(B) +winning Win.
@context Give it some context.
Just a POD: Plain old task.
(C) +project @context This one has it all!
(C) 2012-02-03 This one has a date!
(B) 2012-03-04 +project @context This one has a date and a context AND a project!
x 2012-04-03 This one has no priority and a date.
"""

Scenario: Tasks list access control
When I send a GET request on "/tasks"
Then the header "Access-Control-Allow-Origin" should be equal to "*"

Scenario: Tasks allowed method
When I send a OPTIONS request on "/tasks"
Then the header "Access-Control-Allow-Methods" should be equal to "GET, OPTIONS, POST"
And the header "Access-Control-Allow-Headers" should be equal to "Content-Type"

Scenario: Tasks list
When I send a GET request on "/tasks"
Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
[
{
"id": 0,
"raw": "(A) Crack the Da Vinci Code.",
"contexts": [],
"projects": [],
"priority": "A",
"complete": false,
"description": "Crack the Da Vinci Code."
},
{
"id": 1,
"raw": "(B) +winning Win.",
"contexts": [],
"projects": [
"winning"
],
"priority": "B",
"complete": false,
"description": "Win."
},
{
"id": 2,
"raw": "@context Give it some context.",
"contexts": [
"context"
],
"projects": [],
"complete": false,
"description": "Give it some context."
},
{
"id": 3,
"raw": "Just a POD: Plain old task.",
"contexts": [],
"projects": [],
"complete": false,
"description": "Just a POD: Plain old task."
},
{
"id": 4,
"raw": "(C) +project @context This one has it all!",
"contexts": [
"context"
],
"projects": [
"project"
],
"priority": "C",
"complete": false,
"description": "This one has it all!"
},
{
"id": 5,
"raw": "(C) 2012-02-03 This one has a date!",
"created": "2012-02-03",
"contexts": [],
"projects": [],
"priority": "C",
"complete": false,
"description": "This one has a date!"
},
{
"id": 6,
"raw": "(B) 2012-03-04 +project @context This one has a date and a context AND a project!",
"created": "2012-03-04",
"contexts": [
"context"
],
"projects": [
"project"
],
"priority": "B",
"complete": false,
"description": "This one has a date and a context AND a project!"
},
{
"id": 7,
"raw": "x 2012-04-03 This one has no priority and a date.",
"contexts": [],
"projects": [],
"complete": true,
"completed": "2012-04-03",
"description": "This one has no priority and a date."
}
]
"""
Something went wrong with that request. Please try again.