Sha256: 891545d383208399d8329854188a5ab0d2863c4f8e74e866053a6dea2b897e63
Contents?: true
Size: 1.78 KB
Versions: 21
Compression:
Stored size: 1.78 KB
Contents
require File.join(File.dirname(__FILE__),'spec_helper') 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
21 entries across 21 versions & 1 rubygems