From 706f873c53df15cb9b444c12ef3c4c7821fa4a92 Mon Sep 17 00:00:00 2001 From: Paul Thornthwaite Date: Sat, 14 Mar 2015 23:54:55 +0000 Subject: [PATCH] DRY up specs with `spec_helper` We require setting up MiniSpec and `fog` in each spec and this just feels cleaner way of doing it. Adding Coverage next and we don't want the code in EVERY spec. --- fog.gemspec | 1 + spec/fog/account_spec.rb | 3 +-- spec/fog/billing_spec.rb | 3 +-- spec/fog/bin/atmos_spec.rb | 3 +-- spec/fog/bin/aws_spec.rb | 3 +-- spec/fog/bin/baremetalcloud_spec.rb | 3 +-- spec/fog/bin/bluebox_spec.rb | 3 +-- spec/fog/bin/brightbox_spec.rb | 3 +-- spec/fog/bin/clodo_spec.rb | 3 +-- spec/fog/bin/cloudsigma_spec.rb | 3 +-- spec/fog/bin/cloudstack_spec.rb | 3 +-- spec/fog/bin/digitalocean_spec.rb | 3 +-- spec/fog/bin/dnsimple_spec.rb | 3 +-- spec/fog/bin/dnsmadeeasy_spec.rb | 3 +-- spec/fog/bin/dreamhost_spec.rb | 3 +-- spec/fog/bin/dynect_spec.rb | 3 +-- spec/fog/bin_spec.rb | 3 +-- spec/fog/cdn_spec.rb | 3 +-- spec/fog/compute_spec.rb | 3 +-- spec/fog/dns_spec.rb | 3 +-- spec/fog/identity_spec.rb | 3 +-- spec/fog/image_spec.rb | 3 +-- spec/fog/metering_spec.rb | 3 +-- spec/fog/monitoring_spec.rb | 3 +-- spec/fog/network_spec.rb | 3 +-- spec/fog/orchestration_spec.rb | 3 +-- spec/fog/storage_spec.rb | 3 +-- spec/fog/support_spec.rb | 3 +-- spec/fog/volume_spec.rb | 3 +-- spec/fog/vpn_spec.rb | 3 +-- spec/fog/xml/connection_spec.rb | 3 +-- spec/spec_helper.rb | 7 +++++++ 32 files changed, 38 insertions(+), 60 deletions(-) create mode 100644 spec/spec_helper.rb diff --git a/fog.gemspec b/fog.gemspec index b00acd6c2..132374e57 100644 --- a/fog.gemspec +++ b/fog.gemspec @@ -72,6 +72,7 @@ Gem::Specification.new do |s| s.add_development_dependency("fission") s.add_development_dependency("google-api-client", "~> 0.6", ">= 0.6.2") s.add_development_dependency("minitest") + s.add_development_dependency("minitest-stub-const") s.add_development_dependency("opennebula") s.add_development_dependency("pry") s.add_development_dependency("rake") diff --git a/spec/fog/account_spec.rb b/spec/fog/account_spec.rb index 2f7652cbf..53a3c15bf 100644 --- a/spec/fog/account_spec.rb +++ b/spec/fog/account_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Account do Fog::Account.providers.each do |provider| diff --git a/spec/fog/billing_spec.rb b/spec/fog/billing_spec.rb index 90045a5fe..d8996a8e6 100644 --- a/spec/fog/billing_spec.rb +++ b/spec/fog/billing_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Billing do Fog::Billing.providers.each do |provider| diff --git a/spec/fog/bin/atmos_spec.rb b/spec/fog/bin/atmos_spec.rb index 2f7abe70e..2fe9d052b 100644 --- a/spec/fog/bin/atmos_spec.rb +++ b/spec/fog/bin/atmos_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/aws_spec.rb b/spec/fog/bin/aws_spec.rb index 625f47ec5..4f7f30e60 100644 --- a/spec/fog/bin/aws_spec.rb +++ b/spec/fog/bin/aws_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/baremetalcloud_spec.rb b/spec/fog/bin/baremetalcloud_spec.rb index cd899c485..cc5e343bb 100644 --- a/spec/fog/bin/baremetalcloud_spec.rb +++ b/spec/fog/bin/baremetalcloud_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/bluebox_spec.rb b/spec/fog/bin/bluebox_spec.rb index 71e744924..119a29205 100644 --- a/spec/fog/bin/bluebox_spec.rb +++ b/spec/fog/bin/bluebox_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/brightbox_spec.rb b/spec/fog/bin/brightbox_spec.rb index 498937024..3e07452f8 100644 --- a/spec/fog/bin/brightbox_spec.rb +++ b/spec/fog/bin/brightbox_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/clodo_spec.rb b/spec/fog/bin/clodo_spec.rb index 3d9fa1e54..e90d701fc 100644 --- a/spec/fog/bin/clodo_spec.rb +++ b/spec/fog/bin/clodo_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/cloudsigma_spec.rb b/spec/fog/bin/cloudsigma_spec.rb index 864af873e..5637f819f 100644 --- a/spec/fog/bin/cloudsigma_spec.rb +++ b/spec/fog/bin/cloudsigma_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/cloudstack_spec.rb b/spec/fog/bin/cloudstack_spec.rb index e20fdd173..065c07e23 100644 --- a/spec/fog/bin/cloudstack_spec.rb +++ b/spec/fog/bin/cloudstack_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/digitalocean_spec.rb b/spec/fog/bin/digitalocean_spec.rb index 3bd97bb1c..029baab91 100644 --- a/spec/fog/bin/digitalocean_spec.rb +++ b/spec/fog/bin/digitalocean_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/dnsimple_spec.rb b/spec/fog/bin/dnsimple_spec.rb index 34f1eedff..95057aaea 100644 --- a/spec/fog/bin/dnsimple_spec.rb +++ b/spec/fog/bin/dnsimple_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/dnsmadeeasy_spec.rb b/spec/fog/bin/dnsmadeeasy_spec.rb index 4e9c1b2c9..60c2f2397 100644 --- a/spec/fog/bin/dnsmadeeasy_spec.rb +++ b/spec/fog/bin/dnsmadeeasy_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/dreamhost_spec.rb b/spec/fog/bin/dreamhost_spec.rb index 42300adc6..611ab7a3d 100644 --- a/spec/fog/bin/dreamhost_spec.rb +++ b/spec/fog/bin/dreamhost_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin/dynect_spec.rb b/spec/fog/bin/dynect_spec.rb index 52c6e39ee..896d66ebd 100644 --- a/spec/fog/bin/dynect_spec.rb +++ b/spec/fog/bin/dynect_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" require "helpers/bin" diff --git a/spec/fog/bin_spec.rb b/spec/fog/bin_spec.rb index 7afc22934..265a577f0 100644 --- a/spec/fog/bin_spec.rb +++ b/spec/fog/bin_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" require "fog/bin" describe Fog do diff --git a/spec/fog/cdn_spec.rb b/spec/fog/cdn_spec.rb index 1f3664de5..3cbb0dc04 100644 --- a/spec/fog/cdn_spec.rb +++ b/spec/fog/cdn_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::CDN do Fog::CDN.providers.each do |provider| diff --git a/spec/fog/compute_spec.rb b/spec/fog/compute_spec.rb index 53060081f..cf3b37b96 100644 --- a/spec/fog/compute_spec.rb +++ b/spec/fog/compute_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Compute do Fog::Compute.providers.each do |provider| diff --git a/spec/fog/dns_spec.rb b/spec/fog/dns_spec.rb index 4bb012b64..48c0d9dbd 100644 --- a/spec/fog/dns_spec.rb +++ b/spec/fog/dns_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::DNS do Fog::DNS.providers.each do |provider| diff --git a/spec/fog/identity_spec.rb b/spec/fog/identity_spec.rb index 9167ead76..6e122912e 100644 --- a/spec/fog/identity_spec.rb +++ b/spec/fog/identity_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Identity do Fog::Identity.providers.each do |provider| diff --git a/spec/fog/image_spec.rb b/spec/fog/image_spec.rb index a24df98ab..57d3ba127 100644 --- a/spec/fog/image_spec.rb +++ b/spec/fog/image_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Image do Fog::Image.providers.each do |provider| diff --git a/spec/fog/metering_spec.rb b/spec/fog/metering_spec.rb index 30e705c90..e6b1b55fd 100644 --- a/spec/fog/metering_spec.rb +++ b/spec/fog/metering_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Metering do Fog::Metering.providers.each do |provider| diff --git a/spec/fog/monitoring_spec.rb b/spec/fog/monitoring_spec.rb index 7c3212e2d..8f129b82b 100644 --- a/spec/fog/monitoring_spec.rb +++ b/spec/fog/monitoring_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Monitoring do Fog::Monitoring.providers.each do |provider| diff --git a/spec/fog/network_spec.rb b/spec/fog/network_spec.rb index d35d23a85..797ae5eb9 100644 --- a/spec/fog/network_spec.rb +++ b/spec/fog/network_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Network do Fog::Network.providers.each do |provider| diff --git a/spec/fog/orchestration_spec.rb b/spec/fog/orchestration_spec.rb index 132110a06..0ee185781 100644 --- a/spec/fog/orchestration_spec.rb +++ b/spec/fog/orchestration_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Orchestration do Fog::Orchestration.providers.each do |provider| diff --git a/spec/fog/storage_spec.rb b/spec/fog/storage_spec.rb index 8db4a36e7..146d73f1d 100644 --- a/spec/fog/storage_spec.rb +++ b/spec/fog/storage_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Storage do Fog::Storage.providers.each do |provider| diff --git a/spec/fog/support_spec.rb b/spec/fog/support_spec.rb index 42cb42e84..5afc71825 100644 --- a/spec/fog/support_spec.rb +++ b/spec/fog/support_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Support do Fog::Support.providers.each do |provider| diff --git a/spec/fog/volume_spec.rb b/spec/fog/volume_spec.rb index 77256b829..b26bac7e5 100644 --- a/spec/fog/volume_spec.rb +++ b/spec/fog/volume_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::Volume do Fog::Volume.providers.each do |provider| diff --git a/spec/fog/vpn_spec.rb b/spec/fog/vpn_spec.rb index e858971aa..66d20d2e0 100644 --- a/spec/fog/vpn_spec.rb +++ b/spec/fog/vpn_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" describe Fog::VPN do Fog::VPN.providers.each do |provider| diff --git a/spec/fog/xml/connection_spec.rb b/spec/fog/xml/connection_spec.rb index 5ce5c15ed..4c1b4e0e6 100644 --- a/spec/fog/xml/connection_spec.rb +++ b/spec/fog/xml/connection_spec.rb @@ -1,5 +1,4 @@ -require "minitest/autorun" -require "fog" +require "spec_helper" # @note This is going to be part of fog-xml eventually describe Fog::XML::Connection do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 000000000..7b08dd1dd --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,7 @@ +require "minitest/autorun" +require "minitest/spec" +require "minitest/stub_const" + +$LOAD_PATH.unshift "lib" + +require "fog"