Sha256: 14d90833f6ecf489079baf6d0eb5dedeb927cb0a10190f9d95b3073aef256e33
Contents?: true
Size: 1.66 KB
Versions: 4
Compression:
Stored size: 1.66 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') require 'linode' describe Linode::Image do before :each do @api_key = 'foo' @linode = Linode::Image.new(:api_key => @api_key) end it 'should be a Linode instance' do @linode.class.should < Linode end %w(list delete).each do |action| it "should allow accessing the #{action} API" do @linode.should respond_to(action.to_sym) end describe "when accessing the #{action} API" do it 'should allow a data hash' do @linode.stubs(:send_request) lambda { @linode.send(action.to_sym, {}) }.should_not raise_error end it 'should not require arguments' do @linode.stubs(:send_request) lambda { @linode.send(action.to_sym) }.should_not raise_error end it "should request the image.#{action} action" do @linode.expects(:send_request).with {|api_action, data| api_action == "image.#{action}" } @linode.send(action.to_sym) end it 'should provide the data hash when making its request' do @linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } } @linode.send(action.to_sym, {:foo => :bar}) end it 'should return the result of the request' do @linode.expects(:send_request).returns(:bar => :baz) @linode.send(action.to_sym).should == { :bar => :baz } end it "should consider the documentation to live at https://www.linode.com/api/image/image.#{action}" do @linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/image/image.#{action}" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
linode-0.9.2 | spec/linode/image_spec.rb |
linode-0.9.1 | spec/linode/image_spec.rb |
linode-0.9.0 | spec/linode/image_spec.rb |
linode-0.8.1 | spec/linode/image_spec.rb |