Logo: Relish

  1. Sign in

Project: Apiv3

Availabilities

TODO: Document Purpose and Usage

Scenarios
Fetching the root Availability collection.
When
I GET to /availabilities
Then
I should get a 200 OK status code
And
the response is the Availability collection
Creating a Availability.
When
I POST to /availabilities with the body:
{
  "template": {
    "data": [
      {"name": "event_id", "value": 1},
      {"name": "member_id", "value": 1},
      {"name": "status_code", "value": 0}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /availabilities/{id}
And
the response is the Availability collection
And
the response contains 1 Availability
And
the Availability's status_code attribute is '0'
And
the Availability's event_id attribute is '1'
And
the Availability's member_id attribute is '1'
Creating a new Availability with non-permitted attributes.
When
I POST to /availabilities with the body:
{
  "template": {
    "data": [
      {"name": "event_id", "value": 1},
      {"name": "member_id", "value": 1},
      {"name": "status_code", "value": 0},
      {"name": "created_at", "value": "2014-06-10T00:18:00Z"}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /availabilities/{id}
And
the response is the Availability collection
And
the response contains 1 Availability
And
the Availability's status_code attribute is '0'
And
the Availability's event_id attribute is '1'
And
the Availability's member_id attribute is '1'
And
the Availability's created_at attribute is not '2014-06-10T00:18:00Z'
Updating a Availability.
Given
I have 1 Availability
And
the Availability's initial status_code attribute is '1'
When
I PATCH to /availabilities/:availability_id giving the availability_id with the body:
{
  "template": {
    "data": [
      {"name": "status_code", "value": 0}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
And
the Availability's status_code attribute is '0'
Updating a Availability with non-permitted attributes.
Given
I have 1 Availability
When
I PATCH to /availabilities/:availability_id giving the availability_id with the body:
{
  "template": {
    "data": [
      {"name": "created_at", "value": "2014-06-10T00:18:00Z"}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
And
the Availability's created_at attribute is not '2014-06-10T00:18:00Z'
Updating an invalid Availability.
Given
I have an invalid Availability
When
I PATCH to /availabilities/:availability_id giving the availability_id with the body:
{
  "template": {
    "data": [
      {"name": "status_code", "value": 0}
    ]
  }
}
Then
I should get a 404 NOT FOUND status code
Deleting a Availability.
Given
I have 1 Availability
When
I DELETE to /availabilities/:availability_id giving the availability_id
Then
I should get a 204 NO CONTENT status code
Deleting an invalid Availability.
Given
I have an invalid Availability
When
I DELETE to /availabilities/:availability_id giving the availability_id
Then
I should get a 404 NOT FOUND status code
Fetching a Availability.
Given
I have 1 Availability
When
I GET to /availabilities/:availability_id giving the availability_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
Fetching multiple Availabilities.
Given
I have 2 Availabilities
And
the Availability's initial status_code attribute is '0'
When
I GET to /availabilities/:availability_id giving the availability_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 2 Availabilities
Fetching an invalid Availability.
Given
I have an invalid Availability
When
I GET to /availabilities/:availability_id giving the availability_id
Then
I should get a 404 NOT FOUND status code
Searching for a Availability.
Given
I have 1 Availability
When
I GET to /availabilities/search?id=:availability_id giving the availability_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
Searching for multiple Availabilities.
Given
I have 2 Availabilities
And
the Availability's initial status_code attribute is '0'
When
I GET to /availabilities/search?id=:availability_id giving the availability_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 2 Availabilities
Searching for an invalid Availability.
Given
I have an invalid Availability
When
I GET to /availabilities/search?id=:availability_id giving the availability_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 0 Availabilities
Searching for a Availability via team_id.
Given
I have 1 Availability
When
I GET to /availabilities/search?team_id=:team_id giving the team_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
Searching for a Availability via event_id.
Given
I have 1 Availability
When
I GET to /availabilities/search?event_id=:event_id giving the event_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability
Searching for a Availability via member_id.
Given
I have 1 Availability
When
I GET to /availabilities/search?member_id=:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Availability collection
And
the response contains 1 Availability

Last published almost 7 years ago by semmons99.