Sha256: 75f7583b8d781cdc541be35d97b0486b7e8df6601703efbdc43d0edfec06962f
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe Smartdc::Api::Keys do let(:object) {Object.new} let(:request) {Smartdc::Request} let(:keys) {Smartdc::Api::Keys.new({})} describe ".create" do it "creates a key" do object.stub(:content) {fixture('keys')[0]} key = object.content request.stub_chain(:new, :post).with('my/keys/', key) {object} expect(keys.create(key).content['name']).to eq(key['name']) end end describe ".read" do it "returns a key" do object.stub(:content) {fixture('keys')[0]} name = object.content['name'] request.stub_chain(:new, :get).with('my/keys/' + name) {object} expect(keys.read(name).content['name']).to eq(name) end end describe ".all" do it "returns some keys" do object.stub(:content) {fixture('keys')} request.stub_chain(:new, :get).with('my/keys', {}) {object} expect(keys.all.content.count).to be > 1 end end describe ".destroy" do it "returns true when success" do key = fixture('keys')[0] object.stub(:status) {204} request.stub_chain(:new, :del).with('my/keys/' + key['name']) {object} expect(keys.destroy(key['name']).status).to eq(204) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smartdc-1.3.0 | spec/unit/smartdc/api/keys_spec.rb |