Skip to content

Instantly share code, notes, and snippets.

@jvanbaarsen
Created May 25, 2013 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvanbaarsen/5649380 to your computer and use it in GitHub Desktop.
Save jvanbaarsen/5649380 to your computer and use it in GitHub Desktop.
client_spec.rb
require_relative '../../spec_helper'
require 'digitalocean/client.rb'
describe Digitalocean::Client do
subject {Digitalocean::Client.new(:client_id => client_id, :api_key => api_key)}
let (:client_id) {CLIENT_ID}
let (:api_key) {API_KEY}
it {should respond_to(:droplets)}
it {should respond_to(:regions)}
it {should respond_to(:images)}
it {should respond_to(:sizes)}
describe ".new" do
it "should return an instance when called with the right params" do
client = Digitalocean::Client.new(:client_id => client_id, :api_key => api_key)
client.should be_instance_of(Digitalocean::Client)
end
it "should raise an exception when client_id is not given" do
expect {Digitalocean::Client.new(:client_id => client_id)}.to raise_error(ArgumentError)
end
it "should raise an exception when api_key is not given" do
expect {Digitalocean::Client.new(:api_key => api_key) }.to raise_error(ArgumentError)
end
end
describe ".droplets" do
it "should return an instance" do
subject.droplets.should be_instance_of(Digitalocean::Resource::Droplet)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment