sabredav_client 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17f2790683714c8c43f56ccb08b612951652a1ef
4
- data.tar.gz: 9d0f1a852fc8c520b4884807468d62b49fc54f9a
3
+ metadata.gz: f09c3b341d38c5d61c5af212eef534715dd2af8d
4
+ data.tar.gz: 2d32cde34531ea583dd10f987269bc1dd78da9e4
5
5
  SHA512:
6
- metadata.gz: 5f1232e44f715632aa25a27dc757a5e0eb442a1c6fcb08daf010d313be76f3ec0fb9f566ff5cc7e6c79e9ff6f1c31689e1f398798d5337097f677e5f3800446e
7
- data.tar.gz: a21f83c90c6ec0ed446804ad12fee15d91cbd813469edbd3c065f1bfa608c74cc2b02aa212d4cc15d2c07838c2d129a85568f88a0e69877a949b20024d2bcc9d
6
+ metadata.gz: 39d91dc553f80a8478538622623d7241372a281d490d7567f309e4689064c7cfa9b2edeebb60f4f2f2034e59611edda4cbee7d07edd7491813dd9964fe2c401b
7
+ data.tar.gz: 7b415d80e04584b6789362b98ad571e431fa0c6bfef5ea63c5e8694dd618fae7c50d294871599b061425b2877db2908ea7d6776b9f297a23d5a4e0a5d5497b13
@@ -68,6 +68,8 @@ module SabredavClient
68
68
  end
69
69
 
70
70
  def delete(uri)
71
+ raise SabredavClient::Errors::SabredavClientError if uri.nil? || !uri.end_with?(".ics")
72
+
71
73
  req = client.create_request(:delete, path: uri)
72
74
  res = req.run
73
75
 
@@ -1,3 +1,3 @@
1
1
  module SabredavClient
2
- VERSION="0.1.5"
2
+ VERSION="0.1.6"
3
3
  end
@@ -17,14 +17,35 @@ describe SabredavClient::Events do
17
17
  it "one event" do
18
18
  uri = "event.ics"
19
19
  FakeWeb.register_uri(:delete, "http://user@localhost:5232/user/calendar/#{uri}",
20
- [{:body => "1 deleted.", :status => ["200", "OK"]},
21
- {:body => "not found", :status => ["404", "Not Found"]}])
20
+ [{:body => "1 deleted.", :status => ["200", "OK"]}])
22
21
  r = events.delete(uri)
23
22
 
24
23
  expect(r).to be(true)
25
- expect {
26
- events.delete(uri)
27
- }.to raise_error(SabredavClient::Errors::NotFoundError)
24
+ end
25
+
26
+ context "error" do
27
+ it "raises error if etag not includes .ics" do
28
+ uri = nil
29
+
30
+ expect {
31
+ events.delete(uri)
32
+ }.to raise_error(SabredavClient::Errors::SabredavClientError)
33
+
34
+ uri = "x-vvvvvv-sssss-2122222-xssw"
35
+
36
+ expect {
37
+ events.delete(uri)
38
+ }.to raise_error(SabredavClient::Errors::SabredavClientError)
39
+ end
40
+
41
+ it "it raises error NotFoundError if resource was not found" do
42
+ uri = "event.ics"
43
+ FakeWeb.register_uri(:delete, "http://user@localhost:5232/user/calendar/#{uri}",
44
+ [{:body => "not found", :status => ["404", "Not Found"]}])
45
+ expect {
46
+ events.delete(uri)
47
+ }.to raise_error(SabredavClient::Errors::NotFoundError)
48
+ end
28
49
  end
29
50
  end
30
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sabredav_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Schwartau