Logo: Relish

  1. Sign in

Project: Apiv3

Contact Phone Numbers

TODO: Document Purpose and Usage

Scenarios
Fetching the root Contact Phone Number collection.
When
I GET to /contact_phone_numbers
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
Creating a Contact Phone Number.
Given
I have a valid Contact id
When
I POST to /contact_phone_numbers with the body:
{
  "template": {
    "data": [
      {"name": "phone_number", "value": "800-867-5309"},
      {"name": "contact_id", "value": <%= @contact_id %>}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /contact_phone_numbers/{id}
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
And
the ContactPhoneNumber's phone_number attribute is '800-867-5309'
And
the ContactPhoneNumber's contact_id attribute is '<%= @contact_id %>'
Creating a new Contact Phone Number with non-permitted attributes.
Given
I have a valid Contact id
When
I POST to /contact_phone_numbers with the body:
{
  "template": {
    "data": [
      {"name": "phone_number", "value": "800-867-5309"},
      {"name": "contact_id", "value": <%= @contact_id %>},
      {"name": "created_at", "value": "2014-06-10T00:18:00Z"}
    ]
  }
}
Then
I should get a 201 CREATED status code
And
the response location is /contact_phone_numbers/{id}
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
And
the ContactPhoneNumber's phone_number attribute is '800-867-5309'
And
the ContactPhoneNumber's contact_id attribute is '<%= @contact_id %>'
And
the ContactPhoneNumber's created_at attribute is not '2014-06-10T00:18:00Z'
Updating a Contact Phone Number.
Given
I have 1 ContactPhoneNumber
And
the ContactPhoneNumber's initial phone_number attribute is '800-867-5309'
When
I PATCH to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id with the body:
{
  "template": {
    "data": [
      {"name": "phone_number", "value": "989-867-5309"}
    ]
  }
}
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
And
the ContactPhoneNumber's phone_number attribute is '989-867-5309'
Updating a Contact Phone Number with non-permitted attributes.
Given
I have 1 ContactPhoneNumber
When
I PATCH to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_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 ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
And
the ContactPhoneNumber's created_at attribute is not '2014-06-10T00:18:00Z'
Updating an invalid Contact Phone Number.
Given
I have an invalid ContactPhoneNumber
When
I PATCH to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id with the body:
{
  "template": {
    "data": [
      {"name": "phone_number", "value": "989-867-5309"}
    ]
  }
}
Then
I should get a 404 NOT FOUND status code
Deleting a Contact Phone Number.
Given
I have 1 ContactPhoneNumber
When
I DELETE to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 204 NO CONTENT status code
Deleting an invalid Contact Phone Number.
Given
I have an invalid ContactPhoneNumber
When
I DELETE to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 404 NOT FOUND status code
Fetching a Contact Phone Number.
Given
I have 1 ContactPhoneNumber
When
I GET to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
Fetching multiple Contact Phone Numbers.
Given
I have 2 ContactPhoneNumbers
When
I GET to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 2 contact_phone_numbers
Fetching an invalid Contact Phone Number.
Given
I have an invalid ContactPhoneNumber
When
I GET to /contact_phone_numbers/:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 404 NOT FOUND status code
Searching for a Contact Phone Number.
Given
I have 1 ContactPhoneNumber
When
I GET to /contact_phone_numbers/search?id=:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
Searching for multiple Contact Phone Numbers.
Given
I have 2 ContactPhoneNumbers
When
I GET to /contact_phone_numbers/search?id=:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 2 contact_phone_numbers
Searching for an invalid Contact Phone Number.
Given
I have an invalid ContactPhoneNumber
When
I GET to /contact_phone_numbers/search?id=:contact_phone_numbers_id giving the contact_phone_numbers_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 0 contact_phone_numbers
Searching for a Contact Phone Number via team_id.
Given
I have 1 ContactPhoneNumber
When
I GET to /contact_phone_numbers/search?team_id=:team_id giving the team_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber
Searching for a Contact Phone Number via contact_id.
Given
I have 1 ContactPhoneNumber
When
I GET to /contact_phone_numbers/search?contact_id=:contact_id giving the contact_id
Then
I should get a 200 OK status code
And
the response is the ContactPhoneNumber collection
And
the response contains 1 ContactPhoneNumber

Last published almost 7 years ago by semmons99.