spec/link_spec.rb in caren-api-0.4.4 vs spec/link_spec.rb in caren-api-0.4.5

- old
+ new

@@ -18,18 +18,21 @@ end describe "Link", "REST methods" do before do + link = File.read("spec/fixtures/caren_link.xml") links = File.read("spec/fixtures/caren_links.xml") search = File.read("spec/fixtures/caren_links_search.xml") + link_url = Caren::Api.session.url_for(Caren::Link.resource_url(1)) links_url = Caren::Api.session.url_for(Caren::Link.resource_url) search_url = Caren::Api.session.url_for("#{Caren::Link.resource_url}?key=external-id&value=1") timestamp = DateTime.now.to_i + FakeWeb.register_uri(:get, link_url, :body => link, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,link) ) FakeWeb.register_uri(:get, links_url, :body => links, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,links) ) FakeWeb.register_uri(:get, search_url, :body => search, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,search) ) FakeWeb.register_uri(:post, links_url, :status => 201, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp) ) end @@ -43,9 +46,14 @@ links.first.id.should == 1 links.first.status.should == "confirmed" links.first.external_id.should == "1" links.first.person_name.should == "Andre Foeken" links.first.person_id.should == 3 + end + + it "should be find all links using the API" do + link = Caren::Link.find(1,Caren::Api.session) + link.id.should == 1 end it "should be find a specific link using the API" do links = Caren::Link.search(:external_id, 1, Caren::Api.session) links.should have(1).thing \ No newline at end of file