Create a separate Chargify site in test mode using the bogus gateway (this is the default). |
To run the remote tests: |
Copy the /spec/remote/reote.example.yml file to /spec/remote/remote.yml and update it with the subdomain name and your api key. |
1. Create a new Chargify Site, and leave it in test mode with the test gateway (this is the default). I suggest username-gem-test, for example, mine is wsmoak-gem-test |
look at spec/spec_helper.rb and set the configuration environment variables SUBDOMAIN, API_KEY, DOMAIN |
2. Copy spec/remote/remote.example.yml to spec/remote/remote.yml, and update the subdomain name and your api key |
include --tag remote on the bundle exec rspec command line. |
3. Modify spec/remote_spec.rb to add a sleep after each time it clears the site data. Clearing a site was recently moved to a background job, so the API request is returning immediately, before the site is *actually* cleared. For example: - before { Chargify::Site.clear_data! } + before { Chargify::Site.clear_data!; sleep 15 } 4. Run the tests: bundle exec rspec Note: the remote tests seem to be running by default with `bundle exec rspec` even though the output *says* exclude {:remote=>true} This seems wrong, but I haven't looked for the reason yet. As of 2016-05-28, one test is broken. See https://github.com/chargify/chargify_api_ares/issues/131 |
CI: https://travis-ci.org/chargify/chargify_api_ares/ (is it running the remote tests?)
Working on https://github.com/chargify/chargify_api_ares/issues/100
References
Updating my fork
To use local changes:
gem build chargify_api_ares.gemspec gem install ./chargify_api_ares-1.3.2.pre.gem
seemed to have to install even though I pointed at it locally in Gemfile with
gem "chargify_api_ares", :path => "~/projects/chargify_api_ares"
Note: Make sure to run with "bundle exec" in order to pick up the Gemfile
Looking at a similar issue to add delayed cancel
They've added subscription.delayed_cancel(true|false)
So how do you do a delayed cancel with a message? Are you meant to call *both* cancel and delayed_cancel to do that?
which implies I should have subscription.delayed_product_change(true|false) ?
I'm thinking subscription.product.handle = "new-product" subscription.change_product(delayed=false)
(How do you cancel a delayed product change through the API? It's possible through the UI...)
To run the remote tests:
1. Create a new Chargify Site, and leave it in test mode with the test gateway (this is the default). I suggest username-gem-test, for example, mine is wsmoak-gem-test
2. Copy spec/remote/remote.example.yml to spec/remote/remote.yml, and update the subdomain name and your api key
3. Modify spec/remote_spec.rb to add a sleep after each time it clears the site data. Clearing a site was recently moved to a background job, so the API request is returning immediately, before the site is *actually* cleared. For example:
- before { Chargify::Site.clear_data! } + before { Chargify::Site.clear_data!; sleep 15 }
4. Run the tests:
bundle exec rspec
Note: the remote tests seem to be running by default with `bundle exec rspec` even though the output *says*
exclude {:remote=>true}
This seems wrong, but I haven't looked for the reason yet.
As of 2016-05-28, one test is broken. See https://github.com/chargify/chargify_api_ares/issues/131
Current CI: https://travis-ci.org/chargify/chargify_api_ares/builds/100185879