Logo: Relish

  1. Sign in

Project: Apiv3

Members

TODO: Document Purpose and Usage

Scenarios
Fetching the root Member collection.
When
I GET to /members
Then
I should get a 200 OK status code
And
the response is the Member collection
Creating a Member.
When
I POST to /members with the body:
{
  "template": {
    "data": [
      {"name": "first_name", "value": "Bobby"},
      {"name": "team_id", "value": 1},
      {"name": "user_id", "value": 1}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /members/{id}
And
the response is the Member collection
And
the response contains 1 Member
And
the Member's first_name attribute is 'Bobby'
And
the Member's team_id attribute is '1'
And
the Member's user_id attribute is '1'
Creating a new Member with non-permitted attributes.
When
I POST to /members with the body:
{
  "template": {
    "data": [
      {"name": "first_name", "value": "Bobby"},
      {"name": "team_id", "value": 1},
      {"name": "user_id", "value": 1},
      {"name": "created_at", "value": "2014-06-10T00:18:00Z"}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /members/{id}
And
the response is the Member collection
And
the response contains 1 Member
And
the Member's first_name attribute is 'Bobby'
And
the Member's team_id attribute is '1'
And
the Member's user_id attribute is '1'
And
the Member's created_at attribute is not '2014-06-10T00:18:00Z'
Updating a Member.
Given
I have 1 Member
And
the Member's initial first_name attribute is 'Bobby'
When
I PATCH to /members/:member_id giving the member_id with the body:
{
  "template": {
    "data": [
      {"name": "first_name", "value": "Sally"}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
And
the Member's first_name attribute is 'Sally'
Updating a Member with non-permitted attributes.
Given
I have 1 Member
When
I PATCH to /members/:member_id giving the member_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 Member collection
And
the response contains 1 Member
And
the Member's created_at attribute is not '2014-06-10T00:18:00Z'
Updating an invalid Member.
Given
I have an invalid Member
When
I PATCH to /members/:member_id giving the member_id with the body:
{
  "template": {
    "data": [
      {"name": "first_name", "value": "Sally"}
    ]
  }
}
Then
I should get a 404 NOT FOUND status code
  • @skip_auth
Updating a Member's is_manager attribute when a manager.
Given
I have 1 Member
And
the Member's initial is_manager attribute is 'false'
And
I am a manager
When
I PATCH to /members/:member_id giving the member_id with the body:
{
  "template": {
    "data": [
      {"name": "is_manager", "value": true}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
And
the Member's is_manager attribute is 'true'
  • @skip_auth
Updating a Member's is_manager attribute when an owner.
Given
I have 1 Member
And
the Member's initial is_manager attribute is 'false'
And
I am an owner
When
I PATCH to /members/:member_id giving the member_id with the body:
{
  "template": {
    "data": [
      {"name": "is_manager", "value": true}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
And
the Member's is_manager attribute is 'true'
  • @skip_auth
Updating a Member's is_manager attribute when not permitted.
Given
I have 1 Member
And
the Member's initial is_manager attribute is 'false'
And
I am not a manager/owner
When
I PATCH to /members/:member_id giving the member_id with the body:
{
  "template": {
    "data": [
      {"name": "is_manager", "value": true}
    ]
  }
}
Then
I should get a 403 FORBIDDEN status code
Deleting a Member.
Given
I have 1 Member
When
I DELETE to /members/:member_id giving the member_id
Then
I should get a 204 NO CONTENT status code
Deleting an invalid Member.
Given
I have an invalid Member
When
I DELETE to /members/:member_id giving the member_id
Then
I should get a 404 NOT FOUND status code
Fetching a Member.
Given
I have 1 Member
When
I GET to /members/:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
Fetching multiple Members.
Given
I have 2 Members
And
the Member's initial first_name attribute is 'Bobby'
And
the Member's initial team_id attribute is '1'
And
the Member's initial user_id attribute is '1'
When
I GET to /members/:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 2 Members
Fetching an invalid Member.
Given
I have an invalid Member
When
I GET to /members/:member_id giving the member_id
Then
I should get a 404 NOT FOUND status code
Searching for a Member.
Given
I have 1 Member
When
I GET to /members/search?id=:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
Searching for multiple Members.
Given
I have 2 Members
And
the Member's initial first_name attribute is 'Bobby'
And
the Member's initial team_id attribute is '1'
And
the Member's initial user_id attribute is '1'
When
I GET to /members/search?id=:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 2 Members
Searching for an invalid Member.
Given
I have an invalid Member
When
I GET to /members/search?id=:member_id giving the member_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 0 Members
Searching for a Member via team_id.
Given
I have 1 Member
When
I GET to /members/search?team_id=:team_id giving the team_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
Searching for a Member via user_id.
Given
I have 1 Member
When
I GET to /members/search?user_id=:user_id giving the user_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
Searching for Managers via team_id.
Given
I have 1 Member
And
the Member's initial is_manager attribute is 'true'
When
I GET to /members/search?is_manager=true&team_id=:team_id giving the team_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member
Searching for Owners via team_id.
Given
I have 1 Member
And
the Member's initial is_owner attribute is 'true'
When
I GET to /members/search?is_owner=true&team_id=:team_id giving the team_id
Then
I should get a 200 OK status code
And
the response is the Member collection
And
the response contains 1 Member

Last published almost 7 years ago by semmons99.