summaryrefslogtreecommitdiff
path: root/features/messages.feature
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-12 09:12:48 +0200
committerAzul <azul@leap.se>2014-07-17 12:47:47 +0200
commitb17387a17669bfc9afce7435653cd8c29c686999 (patch)
tree70410bf1df84d88a2c400c7e5c2a78e4550d0126 /features/messages.feature
parentade74d8a9091ae607586d7b287a0579a2ee7af8e (diff)
some cleanup of the messages api and cuke feature
Diffstat (limited to 'features/messages.feature')
-rw-r--r--features/messages.feature74
1 files changed, 74 insertions, 0 deletions
diff --git a/features/messages.feature b/features/messages.feature
new file mode 100644
index 0000000..34c0892
--- /dev/null
+++ b/features/messages.feature
@@ -0,0 +1,74 @@
+Feature: Receive messages for the user
+
+ In order to stay in touch with the provider
+ As an authenticated user
+ I want to receive messages from the provider
+
+ Background:
+ Given I authenticated
+ Given I set headers:
+ | Accept | application/json |
+ | Content-Type | application/json |
+ | Authorization | Token token="MY_AUTH_TOKEN" |
+
+ Scenario: There are no messages yet
+ When I send a GET request to "/1/messages.json"
+ Then the response status should be "200"
+ And the response should be:
+ """
+ []
+ """
+
+ Scenario: Fetch the unread messages
+ Given there is a message for me with:
+ | id | 1a2b3c4d |
+ | text | Your provider says hi ! |
+ When I send a GET request to "/1/messages.json"
+ Then the response status should be "200"
+ And the response should be:
+ """
+ [{
+ "id": "1a2b3c4d",
+ "text": "Your provider says hi !"
+ }]
+ """
+
+ Scenario: Send unread messages until marked as read
+ Given there is a message for me
+ And I have sent a GET request to "/1/messages.json"
+ When I send a GET request to "/1/messages.json"
+ Then the response status should be "200"
+ And the response should include that message
+
+ Scenario: Mark message as read
+ Given there is a message for me with:
+ | id | 1a2b3c4d |
+ When I send a PUT request to "/1/messages/1a2b3c4d.json"
+ Then the response status should be "200"
+ And the response should be:
+ """
+ { "success": "marked as read",
+ "message": "The message has been marked as read" }
+ """
+ And that message should be marked as read
+
+ Scenario: Message not found
+ When I send a PUT request to "/1/messages/1a2b3c4d.json"
+ Then the response status should be "404"
+ And the response should be:
+ """
+ { "error": "not found",
+ "message": "The message could not be found" }
+ """
+
+ Scenario: Do not send read messages
+ Given there is a message for me
+ And that message is marked as read
+ When I send a GET request to "/1/messages.json"
+ Then the response status should be "200"
+ And the response should be:
+ """
+ []
+ """
+
+