OSDN Git Service

add tests for creating/updating/deleting a post
authorscribu <mail@scribu.net>
Sun, 17 Feb 2013 03:11:02 +0000 (05:11 +0200)
committerscribu <mail@scribu.net>
Sun, 17 Feb 2013 03:54:28 +0000 (05:54 +0200)
features/post.feature [new file with mode: 0644]

diff --git a/features/post.feature b/features/post.feature
new file mode 100644 (file)
index 0000000..2ecfe9b
--- /dev/null
@@ -0,0 +1,29 @@
+Feature: Manage WordPress posts
+
+  Scenario: Creating/updating/deleting posts
+    Given WP install
+
+    When I run `wp post create --post_title='Test post' --porcelain`
+    Then it should run without errors
+    And STDOUT should match '%d'
+    And save STDOUT as {POST_ID}
+
+    When I run `wp post update {POST_ID} --post_title='Updated post'`
+    Then it should run without errors
+    And STDOUT should be:
+      """
+      Success: Updated post {POST_ID}.
+      """
+
+    When I run `wp post delete {POST_ID}`
+    Then it should run without errors
+    And STDOUT should be:
+      """
+      Success: Trashed post {POST_ID}.
+      """
+
+    When I run the previous command again
+    Then it should run without errors
+
+    When I run the previous command again
+    Then the return code should be 1