test/vultr/test_vultr_plan.rb in vultr-0.1.1 vs test/vultr/test_vultr_plan.rb in vultr-0.2.0
- old
+ new
@@ -1,13 +1,25 @@
-require "vultr"
-require "minitest/autorun"
+require 'vultr'
+require 'minitest/autorun'
describe Vultr::Plan do
let(:plan) { Vultr::Plan }
- it "needs to verify list plan url" do
- url = plan._list
+ it 'needs to verify list plan url' do
+ assert ENV.has_key? 'VULTR_API_KEY'
+ Vultr.api_key = ENV['VULTR_API_KEY']
- url.must_equal "https://api.vultr.com/v1/plans/list"
+ assert_equal plan._list, 'https://api.vultr.com/v1/plans/list'
+
+ r = plan.list
+
+ assert r.has_key? :status
+ assert_equal r[:status], 200
+
+ assert r.has_key? :result
+ r[:result].each do |k, v|
+ assert v.has_key?('VPSPLANID')
+ assert_equal k.to_i, v['VPSPLANID'].to_i
+ end
end
-end
\ No newline at end of file
+end