Sha256: c2ba3c352582875b6f6f65c05154370590969e56037c8483abff929709b06ab3
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe "Smartdc::Api::Analytics" do before(:all) do @object = Object.new @request = Smartdc::Request end describe ".create" do it "should return a instrumentation" do @object.stub(:content) {fixture('analytics')[0]} analytic = @object.content @request.stub_chain(:new, :post).with('my/analytics/instrumentations/', analytic) {@object} analytics = Smartdc::Api::Analytics.new({}) analytics.create(analytic).content['id'].should == analytic['id'] end end describe ".read" do it "should return a instrumentation" do @object.stub(:content) {fixture('analytics')[0]} id = @object.content['id'] @request.stub_chain(:new, :get).with('my/analytics/instrumentations/' + id) {@object} analytics = Smartdc::Api::Analytics.new({}) analytics.read(id).content['id'].should == id end end describe ".all" do it "should return some instrumentations" do @object.stub(:content) {fixture('analytics')} @request.stub_chain(:new, :get).with('my/analytics/instrumentations', {}) {@object} analytics = Smartdc::Api::Analytics.new({}) analytics.all.content.count.should > 0 end end describe ".delete" do it "should return true when success" do analytic = fixture('analytics')[0] @object.stub(:status) {204} @request.stub_chain(:new, :del).with('my/analytics/instrumentations/' + analytic['id']) {@object} analytics = Smartdc::Api::Analytics.new({}) analytics.destroy(analytic['id']).status.should == 204 end end end
Version data entries
4 entries across 4 versions & 1 rubygems