Sha256: 4903048f2a64f6133887cfc436d0b27628537d0cb774fcd30e5346eb025c52fb
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
# -*- encoding: utf-8 -*- require "helper" describe CentrumFaktur::Comment do before do CentrumFaktur.configure do |config| config.login = "john" config.password = "secret" config.subdomain = "john" end end it "returns estimate comments list limited to one" do FakeWeb.register_uri(:get, "https://john:secret@john.centrumfaktur.pl/api/1.0/estimates/14587/comments/?limit=1", :response => fixture("comments.txt")) response = CentrumFaktur::Comment.list("/api/1.0/estimates/14587/comments/", :limit => 1) expected = [{"body"=>"cool", "user_uri"=>"/api/1.0/users/749/", "comment_type"=>"user", "created"=>"2011-06-14 20:06:36", "commented_object_type"=>"estimate", "commented_object_uri"=>"/api/1.0/estimates/20527/", "is_public"=>false}] assert_equal expected, response end it "creates comment" do FakeWeb.register_uri(:post, "https://john:secret@john.centrumfaktur.pl/api/1.0/estimates/14587/comments/", :response => fixture("new_comment.txt")) response = CentrumFaktur::Comment.create("/api/1.0/estimates/14587/comments/", {:body => "cool", :is_public => false}) expected = {"body"=>"thanks", "user_uri"=>"/api/1.0/users/749/", "comment_type"=>"user", "created"=>"2011-06-16 21:55:03", "commented_object_type"=>"estimate", "commented_object_uri"=>"/api/1.0/estimates/20627/", "is_public"=>false} assert_equal expected, response end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
centrum_faktur-0.2.2 | test/comment_test.rb |
centrum_faktur-0.2.1 | test/comment_test.rb |