Skip to content

Instantly share code, notes, and snippets.

@moklett
Created September 10, 2010 13:50

Revisions

  1. moklett created this gist Sep 10, 2010.
    44 changes: 44 additions & 0 deletions chargify_clear_site_data.feature
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    Scenario: Clear site data for a test site
    Given my site is in test mode
    And I have 2 products
    And I have 4 subscriptions
    When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json
    Then the response status should be "200 OK"
    And I should have 0 products
    And I should have 0 subscriptions

    Scenario: Attempt to clear site data for a production site
    Given my site is in production mode
    And I have 2 products
    And I have 4 subscriptions
    When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json
    Then the response status should be "403 Forbidden"
    And I should have 2 products
    And I should have 4 subscriptions

    Scenario: Clear site data for a test site, leaving products
    Given my site is in test mode
    And I have 2 products
    And I have 4 subscriptions
    When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json?cleanup_scope=customers
    Then the response status should be "200 OK"
    And I should have 2 products
    And I should have 0 subscriptions

    Scenario: Clear all site data for a test site using the explicit 'all' scope
    Given my site is in test mode
    And I have 2 products
    And I have 4 subscriptions
    When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json?cleanup_scope=all
    Then the response status should be "200 OK"
    And I should have 0 products
    And I should have 0 subscriptions

    Scenario: Attempt to clear site data for a test site using a bogus scope
    Given my site is in test mode
    And I have 2 products
    And I have 4 subscriptions
    When I send a POST request to https://[@subdomain].chargify.com/sites/clear_data.json?cleanup_scope=bogus
    Then the response status should be "403 Forbidden"
    And I should have 2 products
    And I should have 4 subscriptions