Sha256: f0fb0383c6b6cbd5f06131b96379afbcb027a91cf805ef8e58c1f87ef55c4573
Contents?: true
Size: 1.85 KB
Versions: 13
Compression:
Stored size: 1.85 KB
Contents
require File.join(File.dirname(__FILE__),'spec_helper') require File.join(File.dirname(__FILE__), 'support', 'shared_examples') describe "DynamicAdapter" do it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do it "should return login when backend service defined" do stub_request(:post, "http://test.com/rhoconnect/authenticate").to_return(:body => "lucas") Rhoconnect.appserver = 'http://test.com' DynamicAdapter.authenticate('lucas','').should == 'lucas' end it "should query dynamic adapter service" do data = {'1'=>@product1} stub_request(:post, "http://test.com/rhoconnect/query").with(:headers => {'Content-Type' => 'application/json'}).to_return(:status => 200, :body => data.to_json) da = DynamicAdapter.new(@s2,nil,'http://test.com') da.query.should == data end it "should create new object using dynamic adapter" do stub_request(:post, "http://test.com/rhoconnect/create").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}) da = DynamicAdapter.new(@s2,nil,'http://test.com') da.create(@product1).should == {:id => 5} end it "should update object using dynamic adapter" do data = {'id' => 2} stub_request(:post, "http://test.com/rhoconnect/update").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}) da = DynamicAdapter.new(@s2,nil,'http://test.com') da.update(data).should == {:id => 5} end it "should delete object using dynamic adapter" do data = {'id' => 2} stub_request(:post, "http://test.com/rhoconnect/delete").with(:headers => {'Content-Type' => 'application/json'}).to_return(:body => {:id => 5}) da = DynamicAdapter.new(@s2,nil,'http://test.com') da.delete(data).should == {:id => 5} end end end
Version data entries
13 entries across 13 versions & 1 rubygems