diff --git a/.rubocop.yml b/.rubocop.yml index 5f52ded..9dfb3d0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -69,3 +69,4 @@ AllCops: - '*.gemspec' - 'tasks/**/*' - 'Rakefile' + - 'example/**/*' diff --git a/.ruby-version b/.ruby-version index 005119b..3f684d2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.1 +2.3.4 diff --git a/example/adapter/lib/new_adapter/adapter.rb b/example/adapter/lib/new_adapter/adapter.rb deleted file mode 100644 index 9eebfcf..0000000 --- a/example/adapter/lib/new_adapter/adapter.rb +++ /dev/null @@ -1,4 +0,0 @@ -module NewAdapter - class Adapter < DoSnapshot::Adapter::Abstract - end -end diff --git a/example/adapter/spec/new_adapter_spec.rb b/example/adapter/spec/new_adapter_spec.rb deleted file mode 100644 index 3c895f7..0000000 --- a/example/adapter/spec/new_adapter_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# -*- encoding : utf-8 -*- -# frozen_string_literal: true -require 'spec_helper' - -RSpec.describe NewAdapter do - include DoSnapshot::RSpec::Environment - include DoSnapshot::RSpec::ApiV2Helpers - include DoSnapshot::RSpec::Adapter -end diff --git a/example/new_adapter/.gitignore b/example/new_adapter/.gitignore new file mode 100644 index 0000000..de10ebc --- /dev/null +++ b/example/new_adapter/.gitignore @@ -0,0 +1,29 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +log/* +!log/.keep +tmp/* +!tmp/.keep +*.bundle +*.so +*.o +*.a +mkmf.log +.idea +.irb_history +.ruby-version +.envrc diff --git a/example/adapter/Gemfile b/example/new_adapter/Gemfile similarity index 100% rename from example/adapter/Gemfile rename to example/new_adapter/Gemfile diff --git a/example/new_adapter/Rakefile b/example/new_adapter/Rakefile new file mode 100644 index 0000000..8bc26d4 --- /dev/null +++ b/example/new_adapter/Rakefile @@ -0,0 +1,20 @@ +# -*- encoding : utf-8 -*- +# frozen_string_literal: true +require 'bundler/setup' + +PROJECT_ROOT = File.expand_path('..', __FILE__) +PROJECT_ROOT_DIR = File.dirname(__FILE__) +$LOAD_PATH.unshift "#{PROJECT_ROOT}/lib" +require 'new_adapter' + +begin + require 'rspec/core/rake_task' + + desc 'Run all specs' + RSpec::Core::RakeTask.new(:spec) +rescue LoadError + nil + # The test gem group fails to install on the platform for some reason +end + +task default: :spec diff --git a/example/adapter/lib/new_adapter.rb b/example/new_adapter/lib/new_adapter.rb similarity index 54% rename from example/adapter/lib/new_adapter.rb rename to example/new_adapter/lib/new_adapter.rb index 0b0bca1..d2ebc1a 100644 --- a/example/adapter/lib/new_adapter.rb +++ b/example/new_adapter/lib/new_adapter.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require_relative 'new_adapter/version' +require_relative 'new_adapter/adapter' -module NewAdapter - autoload :Adapter, 'new_adapter/adapter' +module NewAdapter end diff --git a/example/new_adapter/lib/new_adapter/adapter.rb b/example/new_adapter/lib/new_adapter/adapter.rb new file mode 100644 index 0000000..ce31a5f --- /dev/null +++ b/example/new_adapter/lib/new_adapter/adapter.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +require 'do_snapshot/helpers' +require 'do_snapshot/adapter' + +module NewAdapter + class Adapter < ::DoSnapshot::Adapter::DropletKit + end +end diff --git a/example/adapter/lib/new_adapter/version.rb b/example/new_adapter/lib/new_adapter/version.rb similarity index 100% rename from example/adapter/lib/new_adapter/version.rb rename to example/new_adapter/lib/new_adapter/version.rb diff --git a/example/adapter/new_adapter.gemspec b/example/new_adapter/new_adapter.gemspec similarity index 96% rename from example/adapter/new_adapter.gemspec rename to example/new_adapter/new_adapter.gemspec index 1ca5a28..7a2324a 100644 --- a/example/adapter/new_adapter.gemspec +++ b/example/new_adapter/new_adapter.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 +# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'new_adapter/version' diff --git a/example/new_adapter/spec/new_adapter/adapter_spec.rb b/example/new_adapter/spec/new_adapter/adapter_spec.rb new file mode 100644 index 0000000..6606a9d --- /dev/null +++ b/example/new_adapter/spec/new_adapter/adapter_spec.rb @@ -0,0 +1,11 @@ +# -*- encoding : utf-8 -*- +# frozen_string_literal: true +require 'spec_helper' + +module NewAdapter + RSpec.describe Adapter do + include DoSnapshot::RSpec::Environment + include DoSnapshot::RSpec::ApiV2Helpers + include DoSnapshot::RSpec::Adapter + end +end diff --git a/example/new_adapter/spec/new_adapter_spec.rb b/example/new_adapter/spec/new_adapter_spec.rb new file mode 100644 index 0000000..8fdb5f2 --- /dev/null +++ b/example/new_adapter/spec/new_adapter_spec.rb @@ -0,0 +1,7 @@ +# -*- encoding : utf-8 -*- +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe NewAdapter do + +end diff --git a/example/adapter/spec/spec_helper.rb b/example/new_adapter/spec/spec_helper.rb similarity index 80% rename from example/adapter/spec/spec_helper.rb rename to example/new_adapter/spec/spec_helper.rb index a6fa4b0..0727cb3 100644 --- a/example/adapter/spec/spec_helper.rb +++ b/example/new_adapter/spec/spec_helper.rb @@ -4,6 +4,8 @@ Bundler.setup require 'webmock/rspec' +require 'new_adapter' +require 'do_snapshot/cli' require 'do_snapshot/rspec' WebMock.disable_net_connect!(allow_localhost: true) @@ -21,9 +23,9 @@ end def project_path - File.expand_path('../..', __FILE__) + DoSnapshot::RSpec.project_path end def fixture(fixture_name) - Pathname.new(project_path + '/spec/fixtures/digitalocean/').join("#{fixture_name}.json").read + DoSnapshot::RSpec.fixture(fixture_name) end diff --git a/lib/do_snapshot/rspec.rb b/lib/do_snapshot/rspec.rb index 448f905..cd3b788 100644 --- a/lib/do_snapshot/rspec.rb +++ b/lib/do_snapshot/rspec.rb @@ -8,5 +8,13 @@ module RSpec # rubocop:disable Style/Documentation autoload :ApiV2Helpers, 'do_snapshot/rspec/api_v2_helpers' autoload :Environment, 'do_snapshot/rspec/environment' autoload :UriHelpers, 'do_snapshot/rspec/uri_helpers' + + def self.project_path + File.expand_path('../../..', __FILE__) + end + + def self.fixture(fixture_name) + Pathname.new(project_path + '/lib/do_snapshot/rspec/fixtures/digitalocean/').join("#{fixture_name}.json").read + end end end diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/empty.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/empty.json new file mode 100644 index 0000000..e69de29 diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/error_message.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/error_message.json new file mode 100644 index 0000000..1e70ef6 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/error_message.json @@ -0,0 +1,4 @@ +{ + "id": "not_found", + "message": "The resource you were accessing could not be found." +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/response_event.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/response_event.json new file mode 100644 index 0000000..2518f51 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/response_event.json @@ -0,0 +1,29 @@ +{ + "action":{ + "id": 7499, + "status": "in-progress", + "type": "snapshot", + "started_at": "2014-11-14T16:34:39Z", + "completed_at": null, + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet.json new file mode 100644 index 0000000..532a165 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet.json @@ -0,0 +1,102 @@ +{ + "droplet": { + "id": 100823, + "name": "example.com", + "memory": 512, + "vcpus": 1, + "disk": 20, + "locked": false, + "status": "active", + "kernel": { + "id": 2233, + "name": "CentOS 6.4 x64 vmlinuz-2.6.32-358.6.2.el6.x86_64", + "version": "2.6.32-358.6.2.el6.x86_64" + }, + "created_at": "2014-11-14T16:36:31Z", + "features": [ + "ipv6", + "virtio" + ], + "backup_ids": [ + ], + "snapshot_ids": [ + 5019770, + 5019903, + 5020783, + 5030783 + ], + "image": { + "id": 562354, + "name": "CentOS 6.4 x64", + "distribution": "CentOS", + "slug": "centos-6-4-x64", + "public": false, + "regions": [ + "nyc1", + "ams1", + "sfo1", + "nyc2", + "ams2", + "sgp1", + "lon1", + "nyc3", + "ams3", + "nyc3", + "fra1" + ], + "created_at": "2014-10-17T20:24:33Z", + "type": "snapshot", + "min_disk_size": 20 + }, + "size": { + "slug": "512mb", + "memory": 512, + "vcpus": 1, + "disk": 20, + "transfer": 1.0, + "price_monthly": 5.0, + "price_hourly": 0.00744, + "regions": [ + "nyc1", + "sgp1", + "ams1", + "sfo1", + "nyc2", + "lon1", + "nyc3", + "ams3", + "ams2", + "fra1" + ] + }, + "size_slug": "512mb", + "networks": { + "v4": [ + { + "ip_address": "104.131.186.241", + "netmask": "255.255.240.0", + "gateway": "104.131.176.1", + "type": "public" + } + ], + "v6": [] + }, + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "16gb", + "2gb", + "1gb", + "4gb", + "8gb", + "512mb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + } + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet_inactive.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet_inactive.json new file mode 100644 index 0000000..b2f345c --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplet_inactive.json @@ -0,0 +1,102 @@ +{ + "droplet": { + "id": 100823, + "name": "example.com", + "memory": 512, + "vcpus": 1, + "disk": 20, + "locked": false, + "status": "off", + "kernel": { + "id": 2233, + "name": "CentOS 6.4 x64 vmlinuz-2.6.32-358.6.2.el6.x86_64", + "version": "2.6.32-358.6.2.el6.x86_64" + }, + "created_at": "2014-11-14T16:36:31Z", + "features": [ + "ipv6", + "virtio" + ], + "backup_ids": [ + ], + "snapshot_ids": [ + 5019770, + 5019903, + 5020783, + 5030783 + ], + "image": { + "id": 562354, + "name": "CentOS 6.4 x64", + "distribution": "CentOS", + "slug": "centos-6-4-x64", + "public": false, + "regions": [ + "nyc1", + "ams1", + "sfo1", + "nyc2", + "ams2", + "sgp1", + "lon1", + "nyc3", + "ams3", + "nyc3", + "fra1" + ], + "created_at": "2014-10-17T20:24:33Z", + "type": "snapshot", + "min_disk_size": 20 + }, + "size": { + "slug": "512mb", + "memory": 512, + "vcpus": 1, + "disk": 20, + "transfer": 1.0, + "price_monthly": 5.0, + "price_hourly": 0.00744, + "regions": [ + "nyc1", + "sgp1", + "ams1", + "sfo1", + "nyc2", + "lon1", + "nyc3", + "ams3", + "ams2", + "fra1" + ] + }, + "size_slug": "512mb", + "networks": { + "v4": [ + { + "ip_address": "104.131.186.241", + "netmask": "255.255.240.0", + "gateway": "104.131.176.1", + "type": "public" + } + ], + "v6": [] + }, + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "16gb", + "2gb", + "1gb", + "4gb", + "8gb", + "512mb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + } + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets.json new file mode 100644 index 0000000..55e6406 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets.json @@ -0,0 +1,284 @@ +{ + "droplets": [ + { + "id": 100823, + "name": "example1.com", + "memory": 512, + "vcpus": 1, + "disk": 20, + "locked": false, + "status": "active", + "kernel": { + "id": 139, + "name": "CentOS 6.4 x64 vmlinuz-2.6.32-358.6.2.el6.x86_64", + "version": "2.6.32-358.6.2.el6.x86_64" + }, + "created_at": "2013-05-28T22:36:38Z", + "features": [], + "backup_ids": [], + "next_backup_window": null, + "snapshot_ids": [], + "image": { + "id": 562354, + "name": "CentOS 6.4 x64", + "distribution": "CentOS", + "slug": "centos-6-4-x64", + "public": false, + "regions": [ + "nyc1", + "ams1", + "sfo1", + "nyc2", + "ams2", + "sgp1", + "lon1", + "nyc3", + "ams3", + "fra1" + ], + "created_at": "2013-07-24T20:45:07Z", + "min_disk_size": 20, + "type": "snapshot" + }, + "size": { + "slug": "512mb", + "memory": 512, + "vcpus": 1, + "disk": 20, + "transfer": 1.0, + "price_monthly": 5.0, + "price_hourly": 0.00744, + "regions": [ + "nyc1", + "sgp1", + "ams1", + "sfo1", + "nyc2", + "lon1", + "nyc3", + "ams3", + "ams2", + "fra1" + ], + "available": true + }, + "size_slug": "512mb", + "networks": { + "v4": [ + { + "ip_address": "104.236.32.182", + "netmask": "255.255.192.0", + "gateway": "104.236.0.1", + "type": "public" + } + ], + "v6": [] + }, + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "16gb", + "2gb", + "1gb", + "4gb", + "8gb", + "512mb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + } + }, + { + "id": 100824, + "name": "example2.com", + "memory": 512, + "vcpus": 1, + "disk": 20, + "locked": false, + "status": "active", + "kernel": { + "id": 139, + "name": "CentOS 6.4 x64 vmlinuz-2.6.32-358.6.2.el6.x86_64", + "version": "2.6.32-358.6.2.el6.x86_64" + }, + "created_at": "2013-11-29T08:15:38Z", + "features": ["virtio"], + "backup_ids": [], + "next_backup_window": null, + "snapshot_ids": [ + ], + "image": { + "id": 562354, + "name": "CentOS 6.4 x64", + "distribution": "CentOS", + "slug": "centos-6-4-x64", + "public": false, + "regions": [ + "nyc1", + "ams1", + "sfo1", + "nyc2", + "ams2", + "sgp1", + "lon1", + "nyc3", + "ams3", + "fra1" + ], + "created_at": "2014-07-11T22:00:45Z", + "min_disk_size": 20, + "type": "snapshot" + }, + "size": { + "slug": "512mb", + "memory": 512, + "vcpus": 1, + "disk": 20, + "transfer": 1.0, + "price_monthly": 5.0, + "price_hourly": 0.00744, + "regions": [ + "nyc1", + "sgp1", + "ams1", + "sfo1", + "nyc2", + "lon1", + "nyc3", + "ams3", + "ams2", + "fra1" + ], + "available": true + }, + "size_slug": "512mb", + "networks": { + "v4": [ + { + "ip_address": "104.236.32.183", + "netmask": "255.255.192.0", + "gateway": "104.236.0.1", + "type": "public" + } + ], + "v6": [] + }, + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "16gb", + "2gb", + "1gb", + "4gb", + "8gb", + "512mb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + } + }, + { + "id": 100825, + "name": "example3.com", + "memory": 512, + "vcpus": 1, + "disk": 20, + "locked": false, + "status": "active", + "kernel": { + "id": 139, + "name": "CentOS 6.4 x64 vmlinuz-2.6.32-358.6.2.el6.x86_64", + "version": "2.6.32-358.6.2.el6.x86_64" + }, + "created_at": "2013-11-29T08:15:38Z", + "features": ["virtio"], + "backup_ids": [], + "next_backup_window": null, + "snapshot_ids": [ + ], + "image": { + "id": 562354, + "name": "CentOS 6.4 x64", + "distribution": "CentOS", + "slug": "centos-6-4-x64", + "public": false, + "regions": [ + "nyc1", + "ams1", + "sfo1", + "nyc2", + "ams2", + "sgp1", + "lon1", + "nyc3", + "ams3", + "fra1" + ], + "created_at": "2014-07-11T22:00:45Z", + "min_disk_size": 20, + "type": "snapshot" + }, + "size": { + "slug": "512mb", + "memory": 512, + "vcpus": 1, + "disk": 20, + "transfer": 1.0, + "price_monthly": 5.0, + "price_hourly": 0.00744, + "regions": [ + "nyc1", + "sgp1", + "ams1", + "sfo1", + "nyc2", + "lon1", + "nyc3", + "ams3", + "ams2", + "fra1" + ], + "available": true + }, + "size_slug": "512mb", + "networks": { + "v4": [ + { + "ip_address": "104.236.32.184", + "netmask": "255.255.192.0", + "gateway": "104.236.0.1", + "type": "public" + } + ], + "v6": [] + }, + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "16gb", + "2gb", + "1gb", + "4gb", + "8gb", + "512mb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + } + } + ], + "links": {}, + "meta": {"total": 3} +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets_empty.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets_empty.json new file mode 100644 index 0000000..25ea063 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_droplets_empty.json @@ -0,0 +1,5 @@ +{ + "droplets": [], + "links": {}, + "meta": {"total": 0} +} diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_done.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_done.json new file mode 100644 index 0000000..d145aff --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_done.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "completed", + "type": "snapshot", + "started_at": "2014-11-14T16:32:24Z", + "completed_at": "2014-11-14T16:34:15Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_done.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_done.json new file mode 100644 index 0000000..14a8a64 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_done.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "completed", + "type": "power_off", + "started_at": "2015-05-03T01:00:12Z", + "completed_at": "2015-05-03T01:35:51Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_start.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_start.json new file mode 100644 index 0000000..266343c --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_off_start.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "in-progress", + "type": "power_off", + "started_at": "2015-05-03T01:00:12Z", + "completed_at": "2015-05-03T01:35:51Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_done.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_done.json new file mode 100644 index 0000000..6feccc9 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_done.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "completed", + "type": "power_on", + "started_at": "2015-05-03T01:00:12Z", + "completed_at": "2015-05-03T01:35:51Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_start.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_start.json new file mode 100644 index 0000000..d6991d6 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_power_on_start.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "in-progress", + "type": "power_on", + "started_at": "2015-05-03T01:00:12Z", + "completed_at": "2015-05-03T01:35:51Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_start.json b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_start.json new file mode 100644 index 0000000..019f6b3 --- /dev/null +++ b/lib/do_snapshot/rspec/fixtures/digitalocean/v2/show_event_start.json @@ -0,0 +1,29 @@ +{ + "action": { + "id": 7499, + "status": "in-progress", + "type": "snapshot", + "started_at": "2014-11-14T16:32:24Z", + "completed_at": "2014-11-14T16:34:15Z", + "resource_id": 100823, + "resource_type": "droplet", + "region": { + "name": "Amsterdam 1", + "slug": "ams1", + "sizes": [ + "512mb", + "1gb", + "4gb", + "2gb", + "8gb", + "16gb" + ], + "features": [ + "virtio", + "backups" + ], + "available": true + }, + "region_slug": "ams1" + } +} \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3ce83ca..2d7f616 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,9 +29,9 @@ end def project_path - File.expand_path('../..', __FILE__) + DoSnapshot::RSpec.project_path end def fixture(fixture_name) - Pathname.new(project_path + '/spec/fixtures/digitalocean/').join("#{fixture_name}.json").read + DoSnapshot::RSpec.fixture(fixture_name) end