automatic 13.1.0 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. data/README.md +1 -1
  2. data/VERSION +1 -1
  3. data/assets/siteinfo/items_all.json +52139 -0
  4. data/automatic.gemspec +16 -5
  5. data/bin/automatic +2 -2
  6. data/bin/automatic-config +8 -2
  7. data/doc/ChangeLog +19 -0
  8. data/doc/PLUGINS +79 -18
  9. data/doc/PLUGINS.ja +79 -17
  10. data/doc/README +10 -15
  11. data/doc/README.ja +10 -15
  12. data/lib/automatic.rb +2 -2
  13. data/plugins/filter/full_feed.rb +76 -0
  14. data/plugins/filter/ignore.rb +4 -12
  15. data/plugins/filter/{reverse.rb → sort.rb} +12 -6
  16. data/plugins/publish/instapaper.rb +77 -0
  17. data/plugins/store/target_link.rb +6 -2
  18. data/plugins/subscription/feed.rb +6 -2
  19. data/plugins/subscription/google_reader_star.rb +63 -0
  20. data/plugins/subscription/link.rb +6 -2
  21. data/plugins/subscription/tumblr.rb +14 -10
  22. data/plugins/subscription/twitter.rb +6 -2
  23. data/spec/lib/automatic_spec.rb +2 -2
  24. data/spec/plugins/filter/full_feed_spec.rb +48 -0
  25. data/spec/plugins/filter/ignore_spec.rb +184 -15
  26. data/spec/plugins/filter/sort_spec.rb +189 -0
  27. data/spec/plugins/publish/instapaper_spec.rb +56 -0
  28. data/spec/plugins/store/target_link_spec.rb +17 -1
  29. data/spec/plugins/subscription/feed_spec.rb +28 -1
  30. data/spec/plugins/subscription/google_reader_star_spec.rb +45 -0
  31. data/spec/plugins/subscription/link_spec.rb +29 -2
  32. data/spec/plugins/subscription/tumblr_spec.rb +17 -2
  33. data/spec/plugins/subscription/twitter_spec.rb +29 -2
  34. data/test/integration/test_absoluteurl.yml +25 -0
  35. data/test/integration/test_fulltext.yml +7 -1
  36. data/test/integration/test_googlestar.yml +19 -0
  37. data/test/integration/test_image2local.yml +4 -1
  38. data/test/integration/{test_reverse.yml → test_instapaper.yml} +9 -2
  39. data/test/integration/test_link2local.yml +34 -0
  40. data/test/integration/test_sort.yml +36 -0
  41. data/test/integration/test_tumblr2local.yml +16 -4
  42. metadata +16 -5
  43. data/spec/plugins/filter/reverse_spec.rb +0 -54
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Filter::Ignore
3
3
  # Author:: 774 <http://id774.net>
4
- # Updated:: Jun 14, 2012
4
+ # Updated:: Jan 19, 2013
5
5
  # Copyright:: 774 Copyright (c) 2012
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
@@ -10,10 +10,10 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
10
  require 'filter/ignore'
11
11
 
12
12
  describe Automatic::Plugin::FilterIgnore do
13
- context "with exclusion by description" do
13
+ context "with exclusion by links" do
14
14
  subject {
15
15
  Automatic::Plugin::FilterIgnore.new({
16
- 'exclude' => ["comment"],
16
+ 'link' => ["comment"],
17
17
  },
18
18
  AutomaticSpec.generate_pipeline {
19
19
  feed { item "http://github.com" }
@@ -26,26 +26,26 @@ describe Automatic::Plugin::FilterIgnore do
26
26
  end
27
27
  end
28
28
 
29
- context "with exclusion by description" do
29
+ context "with exclusion by links" do
30
30
  subject {
31
31
  Automatic::Plugin::FilterIgnore.new({
32
- 'exclude' => [""],
32
+ 'link' => ["comment"],
33
33
  },
34
34
  AutomaticSpec.generate_pipeline {
35
35
  feed { item "http://github.com" }
36
- feed { item "http://google.com" }
36
+ feed { item "http://google.com/comment" }
37
37
  })
38
38
  }
39
39
 
40
40
  describe "#run" do
41
- its(:run) { should have(0).feeds }
41
+ its(:run) { should have(1).feeds }
42
42
  end
43
43
  end
44
44
 
45
- context "with exclusion by description" do
45
+ context "with exclusion by links" do
46
46
  subject {
47
47
  Automatic::Plugin::FilterIgnore.new({
48
- 'description' => ["comment"],
48
+ 'link' => ["hoge"],
49
49
  },
50
50
  AutomaticSpec.generate_pipeline {
51
51
  feed { item "http://github.com" }
@@ -58,23 +58,23 @@ describe Automatic::Plugin::FilterIgnore do
58
58
  end
59
59
  end
60
60
 
61
- context "with exclusion by description" do
61
+ context "with exclusion by links" do
62
62
  subject {
63
63
  Automatic::Plugin::FilterIgnore.new({
64
- 'description' => [""],
64
+ 'link' => ["hoge"],
65
65
  },
66
66
  AutomaticSpec.generate_pipeline {
67
- feed { item "http://github.com" }
67
+ feed { item "http://github.com/hoge" }
68
68
  feed { item "http://google.com" }
69
69
  })
70
70
  }
71
71
 
72
72
  describe "#run" do
73
- its(:run) { should have(0).feeds }
73
+ its(:run) { should have(1).feeds }
74
74
  end
75
75
  end
76
76
 
77
- context "with exclusion by link" do
77
+ context "with exclusion by links" do
78
78
  subject {
79
79
  Automatic::Plugin::FilterIgnore.new({
80
80
  'link' => ["github"],
@@ -90,7 +90,7 @@ describe Automatic::Plugin::FilterIgnore do
90
90
  end
91
91
  end
92
92
 
93
- context "with exclusion by link" do
93
+ context "with exclusion by links" do
94
94
  subject {
95
95
  Automatic::Plugin::FilterIgnore.new({
96
96
  'link' => [""],
@@ -106,4 +106,173 @@ describe Automatic::Plugin::FilterIgnore do
106
106
  end
107
107
  end
108
108
 
109
+ context "with exclusion by description" do
110
+ subject {
111
+ Automatic::Plugin::FilterIgnore.new({
112
+ 'description' => ["comment"],
113
+ },
114
+ AutomaticSpec.generate_pipeline {
115
+ feed { item "http://github.com" }
116
+ feed { item "http://google.com" }
117
+ })
118
+ }
119
+
120
+ describe "#run" do
121
+ its(:run) { should have(2).feeds }
122
+ end
123
+ end
124
+
125
+ context "with exclusion by description" do
126
+ subject {
127
+ Automatic::Plugin::FilterIgnore.new({
128
+ 'description' => [""],
129
+ },
130
+ AutomaticSpec.generate_pipeline {
131
+ feed { item "http://github.com" }
132
+ feed { item "http://google.com" }
133
+ })
134
+ }
135
+
136
+ describe "#run" do
137
+ its(:run) { should have(0).feeds }
138
+ end
139
+ end
140
+
141
+ context "with exclusion by description" do
142
+ subject {
143
+ Automatic::Plugin::FilterIgnore.new({
144
+ 'description' => ["bbb"],
145
+ },
146
+ AutomaticSpec.generate_pipeline {
147
+ feed {
148
+ item "http://hogefuga.com", "",
149
+ "aaabbbccc"
150
+ }
151
+ feed {
152
+ item "http://aaabbbccc.com", "",
153
+ "hogefugahoge"
154
+ }
155
+ feed {
156
+ item "http://aaabbbccc.com", "",
157
+ "aaaccc"
158
+ }
159
+ feed {
160
+ item "http://aaaccc.com", "",
161
+ "aaabbbccc"
162
+ }
163
+ }
164
+ )}
165
+
166
+ describe "#run" do
167
+ its(:run) { should have(2).feeds }
168
+ end
169
+ end
170
+
171
+ context "with exclusion by description" do
172
+ subject {
173
+ Automatic::Plugin::FilterIgnore.new({
174
+ 'description' => ["aaaa"],
175
+ },
176
+ AutomaticSpec.generate_pipeline {
177
+ feed {
178
+ item "http://hogefuga.com", "",
179
+ "aaaabbbccc"
180
+ }
181
+ feed {
182
+ item "http://aaaabbbccc.com", "",
183
+ "hogefugahoge"
184
+ }
185
+ feed {
186
+ item "http://aaabbbccc.com", "",
187
+ "aaaaaaaaaacccdd"
188
+ }
189
+ feed {
190
+ item "http://aaaaccc.com", "",
191
+ "aabbbccc"
192
+ }
193
+ feed {
194
+ item "http://aaaaccc.com", "",
195
+ "aabbbcccdd"
196
+ }
197
+ }
198
+ )}
199
+
200
+ describe "#run" do
201
+ its(:run) { should have(3).feeds }
202
+ end
203
+ end
204
+
205
+ context "with item base exclusion by links" do
206
+ subject {
207
+ Automatic::Plugin::FilterIgnore.new({
208
+ 'link' => ["dddd"],
209
+ },
210
+ AutomaticSpec.generate_pipeline {
211
+ feed {
212
+ item "http://hogefuga.com", "",
213
+ "aaaabbbccc"
214
+ item "http://hogefuga.com", "",
215
+ "aaaabbbcccdddd"
216
+ }
217
+ feed {
218
+ item "http://aaaabbbccc.com", "",
219
+ "hogefugahoge"
220
+ }
221
+ feed {
222
+ item "http://aaabbbcccdddd.com", "",
223
+ "aaaaaaaaaacccdd"
224
+ }
225
+ feed {
226
+ item "http://aaaaccc.com", "",
227
+ "aabbbccc"
228
+ item "http://aabbcccdddd.com", "",
229
+ "aabbbcccddd"
230
+ }
231
+ feed {
232
+ item "http://cccdddd.com", "",
233
+ "aabbbcccdd"
234
+ }
235
+ }
236
+ )}
237
+
238
+ describe "#run" do
239
+ its(:run) { should have(3).feeds }
240
+ end
241
+ end
242
+
243
+ context "with item base exclusion by description" do
244
+ subject {
245
+ Automatic::Plugin::FilterIgnore.new({
246
+ 'description' => ["aaaa"],
247
+ },
248
+ AutomaticSpec.generate_pipeline {
249
+ feed {
250
+ item "http://hogefuga.com", "",
251
+ "aaaabbbccc"
252
+ }
253
+ feed {
254
+ item "http://aaaabbbccc.com", "",
255
+ "hogefugahoge"
256
+ }
257
+ feed {
258
+ item "http://aaabbbccc.com", "",
259
+ "aaaaaaaaaacccdd"
260
+ }
261
+ feed {
262
+ item "http://aaccc.com", "",
263
+ "aaaabbbccc"
264
+ item "http://aabbccc.com", "",
265
+ "aabbbccc"
266
+ }
267
+ feed {
268
+ item "http://cccddd.com", "",
269
+ "aabbbcccdd"
270
+ }
271
+ }
272
+ )}
273
+
274
+ describe "#run" do
275
+ its(:run) { should have(3).feeds }
276
+ end
277
+ end
109
278
  end
@@ -0,0 +1,189 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Filter::Sort
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Mar 23, 2012
5
+ # Updated:: Jan 23, 2013
6
+ # Copyright:: 774 Copyright (c) 2012
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'filter/sort'
12
+
13
+ describe Automatic::Plugin::FilterSort do
14
+ context "It should be asc sorted" do
15
+ subject {
16
+ Automatic::Plugin::FilterSort.new(
17
+ {
18
+ 'sort' => "asc"
19
+ },
20
+ AutomaticSpec.generate_pipeline {
21
+ feed {
22
+ item "http://aaa.png", "",
23
+ "<img src=\"http://aaa.png\">",
24
+ "Fri, 23 Mar 2012 00:10:00 +0000"
25
+ item "http://bbb.png", "",
26
+ "<img src=\"http://bbb.png\">",
27
+ "Sun, 25 Mar 2012 01:05:00 +0000"
28
+ item "http://ccc.png", "",
29
+ "<img src=\"http://ccc.png\">",
30
+ "Thu, 22 Mar 2012 00:15:00 +0000"
31
+ item "http://ddd.png", "",
32
+ "<img src=\"http://ddd.png\">",
33
+ "Fri, 23 Mar 2012 00:00:08 +0000"
34
+ item "http://eee.png", "",
35
+ "<img src=\"http://eee.png\">",
36
+ "Fri, 23 Nov 2012 00:09:00 +0000"
37
+ }})}
38
+
39
+ describe "#run" do
40
+ its(:run) { should have(1).feeds }
41
+
42
+ specify {
43
+ subject.run
44
+ subject.instance_variable_get(:@pipeline)[0].items[0].link.
45
+ should == "http://ccc.png"
46
+ subject.instance_variable_get(:@pipeline)[0].items[1].link.
47
+ should == "http://ddd.png"
48
+ subject.instance_variable_get(:@pipeline)[0].items[2].link.
49
+ should == "http://aaa.png"
50
+ subject.instance_variable_get(:@pipeline)[0].items[3].link.
51
+ should == "http://bbb.png"
52
+ subject.instance_variable_get(:@pipeline)[0].items[4].link.
53
+ should == "http://eee.png"
54
+ }
55
+ end
56
+ end
57
+
58
+ context "It should be asc sorted" do
59
+ subject {
60
+ Automatic::Plugin::FilterSort.new(
61
+ {
62
+ 'sort' => "asc"
63
+ },
64
+ AutomaticSpec.generate_pipeline {
65
+ feed {
66
+ item "http://aaa.png", "",
67
+ "<img src=\"http://aaa.png\">",
68
+ "Sat, 24 Mar 2012 01:15:00 +0000"
69
+ item "http://bbb.png", "",
70
+ "<img src=\"http://bbb.png\">",
71
+ "Thu, 22 Mar 2012 02:05:00 +0000"
72
+ item "http://ccc.png", "",
73
+ "<img src=\"http://ccc.png\">",
74
+ "Fri, 23 Mar 2012 02:00:00 +0000"
75
+ item "http://ddd.png", "",
76
+ "<img src=\"http://ddd.png\">",
77
+ "Fri, 23 Mar 2012 01:40:00 +0000"
78
+ item "http://eee.png", "",
79
+ "<img src=\"http://eee.png\">",
80
+ "Fri, 23 Nov 2012 00:00:35 +0000"
81
+ }})}
82
+
83
+ describe "#run" do
84
+ its(:run) { should have(1).feeds }
85
+
86
+ specify {
87
+ subject.run
88
+ subject.instance_variable_get(:@pipeline)[0].items[0].link.
89
+ should == "http://bbb.png"
90
+ subject.instance_variable_get(:@pipeline)[0].items[1].link.
91
+ should == "http://ddd.png"
92
+ subject.instance_variable_get(:@pipeline)[0].items[2].link.
93
+ should == "http://ccc.png"
94
+ subject.instance_variable_get(:@pipeline)[0].items[3].link.
95
+ should == "http://aaa.png"
96
+ subject.instance_variable_get(:@pipeline)[0].items[4].link.
97
+ should == "http://eee.png"
98
+ }
99
+ end
100
+ end
101
+
102
+ context "It should be desc sorted" do
103
+ subject {
104
+ Automatic::Plugin::FilterSort.new(
105
+ {
106
+ 'sort' => "desc"
107
+ },
108
+ AutomaticSpec.generate_pipeline {
109
+ feed {
110
+ item "http://aaa.png", "",
111
+ "<img src=\"http://aaa.png\">",
112
+ "Fri, 23 Mar 2012 00:10:00 +0000"
113
+ item "http://bbb.png", "",
114
+ "<img src=\"http://bbb.png\">",
115
+ "Sun, 25 Mar 2012 01:05:00 +0000"
116
+ item "http://ccc.png", "",
117
+ "<img src=\"http://ccc.png\">",
118
+ "Thu, 22 Mar 2012 00:15:00 +0000"
119
+ item "http://ddd.png", "",
120
+ "<img src=\"http://ddd.png\">",
121
+ "Fri, 23 Mar 2012 00:00:08 +0000"
122
+ item "http://eee.png", "",
123
+ "<img src=\"http://eee.png\">",
124
+ "Fri, 23 Nov 2012 00:09:00 +0000"
125
+ }})}
126
+
127
+ describe "#run" do
128
+ its(:run) { should have(1).feeds }
129
+
130
+ specify {
131
+ subject.run
132
+ subject.instance_variable_get(:@pipeline)[0].items[4].link.
133
+ should == "http://ccc.png"
134
+ subject.instance_variable_get(:@pipeline)[0].items[3].link.
135
+ should == "http://ddd.png"
136
+ subject.instance_variable_get(:@pipeline)[0].items[2].link.
137
+ should == "http://aaa.png"
138
+ subject.instance_variable_get(:@pipeline)[0].items[1].link.
139
+ should == "http://bbb.png"
140
+ subject.instance_variable_get(:@pipeline)[0].items[0].link.
141
+ should == "http://eee.png"
142
+ }
143
+ end
144
+ end
145
+
146
+ context "It should be desc sorted" do
147
+ subject {
148
+ Automatic::Plugin::FilterSort.new(
149
+ {
150
+ 'sort' => "desc"
151
+ },
152
+ AutomaticSpec.generate_pipeline {
153
+ feed {
154
+ item "http://aaa.png", "",
155
+ "<img src=\"http://aaa.png\">",
156
+ "Sat, 24 Mar 2012 01:15:00 +0000"
157
+ item "http://bbb.png", "",
158
+ "<img src=\"http://bbb.png\">",
159
+ "Thu, 22 Mar 2012 02:05:00 +0000"
160
+ item "http://ccc.png", "",
161
+ "<img src=\"http://ccc.png\">",
162
+ "Fri, 23 Mar 2012 02:00:00 +0000"
163
+ item "http://ddd.png", "",
164
+ "<img src=\"http://ddd.png\">",
165
+ "Fri, 23 Mar 2012 01:40:00 +0000"
166
+ item "http://eee.png", "",
167
+ "<img src=\"http://eee.png\">",
168
+ "Fri, 23 Nov 2012 00:00:35 +0000"
169
+ }})}
170
+
171
+ describe "#run" do
172
+ its(:run) { should have(1).feeds }
173
+
174
+ specify {
175
+ subject.run
176
+ subject.instance_variable_get(:@pipeline)[0].items[4].link.
177
+ should == "http://bbb.png"
178
+ subject.instance_variable_get(:@pipeline)[0].items[3].link.
179
+ should == "http://ddd.png"
180
+ subject.instance_variable_get(:@pipeline)[0].items[2].link.
181
+ should == "http://ccc.png"
182
+ subject.instance_variable_get(:@pipeline)[0].items[1].link.
183
+ should == "http://aaa.png"
184
+ subject.instance_variable_get(:@pipeline)[0].items[0].link.
185
+ should == "http://eee.png"
186
+ }
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Publish::Instapaper
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: Feb 9, 2013
5
+ # Updated:: Feb 9, 2013
6
+ # Copyright:: soramugi Copyright (c) 2013
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'publish/instapaper'
12
+
13
+ describe Automatic::Plugin::PublishInstapaper do
14
+ subject {
15
+ Automatic::Plugin::PublishInstapaper.new(
16
+ {"email" => "email@example.com", "password" => "pswd"},
17
+ AutomaticSpec.generate_pipeline{
18
+ feed { item "http://github.com" }
19
+ }
20
+ )
21
+ }
22
+
23
+ it "should post the link in the feed" do
24
+ instapaper = mock("instapaper")
25
+ instapaper.should_receive(:add).with("http://github.com", nil, '')
26
+ subject.instance_variable_set(:@instapaper, instapaper)
27
+ subject.run.should have(1).feed
28
+ end
29
+ end
30
+
31
+ describe Automatic::Plugin::Instapaper do
32
+ describe "#add" do
33
+ subject {
34
+ Automatic::Plugin::Instapaper.new("email@example.com", "pswd")
35
+ }
36
+ url = "http://www.google.com"
37
+ title = "automatic test"
38
+ description = "automatic test"
39
+
40
+ specify {
41
+ res = stub("res")
42
+ res.should_receive(:code).and_return("201")
43
+
44
+ subject.should_receive(:request).and_return(res)
45
+ subject.add(url, title, description)
46
+ }
47
+
48
+ specify {
49
+ res = mock("res")
50
+ res.should_receive(:code).twice.and_return("403")
51
+
52
+ subject.should_receive(:request).and_return(res)
53
+ subject.add(url, title, description)
54
+ }
55
+ end
56
+ end
@@ -3,7 +3,7 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 4, 2012
6
- # Updated:: Jun 14, 2012
6
+ # Updated:: Feb 9, 2013
7
7
  # Copyright:: kzgs Copyright (c) 2012
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
@@ -39,4 +39,20 @@ describe Automatic::Plugin::StoreTargetLink do
39
39
  end
40
40
  end
41
41
 
42
+ it "should error and retry during file download" do
43
+ Dir.mktmpdir do |dir|
44
+ instance = Automatic::Plugin::StoreTargetLink.new(
45
+ {
46
+ "path" => dir,
47
+ 'retry' => 1,
48
+ 'interval' => 2
49
+ },
50
+ AutomaticSpec.generate_pipeline {
51
+ feed { item "aaa" }
52
+ }
53
+ )
54
+ instance.run.should have(1).feed
55
+ end
56
+ end
57
+
42
58
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Subscription::Feed
3
3
  # Author:: 774 <http://id774.net>
4
- # Updated:: Jun 14, 2012
4
+ # Updated:: Feb 8, 2013
5
5
  # Copyright:: 774 Copyright (c) 2012
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
@@ -41,4 +41,31 @@ describe Automatic::Plugin::SubscriptionFeed do
41
41
 
42
42
  its(:run) { should have(1).feed }
43
43
  end
44
+
45
+ context "with retry to feeds whose valid URL" do
46
+ subject {
47
+ Automatic::Plugin::SubscriptionFeed.new(
48
+ { 'feeds' => [
49
+ "https://github.com/id774/automaticruby/commits/master.atom"],
50
+ 'retry' => 3,
51
+ 'interval' => 5
52
+ }
53
+ )
54
+ }
55
+
56
+ its(:run) { should have(1).feed }
57
+ end
58
+
59
+ context "with retry to feeds whose invalid URL" do
60
+ subject {
61
+ Automatic::Plugin::SubscriptionFeed.new(
62
+ { 'feeds' => ["invalid_url"],
63
+ 'retry' => 1,
64
+ 'interval' => 1
65
+ }
66
+ )
67
+ }
68
+
69
+ its(:run) { should be_empty }
70
+ end
44
71
  end
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::GoogleReaderStar
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: Feb 10, 2013
5
+ # Updated:: Feb 10, 2013
6
+ # Copyright:: soramugi Copyright (c) 2013
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'subscription/google_reader_star'
12
+
13
+ describe Automatic::Plugin::SubscriptionGoogleReaderStar do
14
+ context "with empty feeds" do
15
+ subject {
16
+ Automatic::Plugin::SubscriptionGoogleReaderStar.new(
17
+ { 'feeds' => [] }
18
+ )
19
+ }
20
+
21
+ its(:run) { should be_empty }
22
+ end
23
+
24
+ context "with feeds whose invalid URL" do
25
+ subject {
26
+ Automatic::Plugin::SubscriptionGoogleReaderStar.new(
27
+ { 'feeds' => ["invalid_url"] }
28
+ )
29
+ }
30
+
31
+ its(:run) { should be_empty }
32
+ end
33
+
34
+ context "with feeds whose valid URL" do
35
+ subject {
36
+ Automatic::Plugin::SubscriptionGoogleReaderStar.new(
37
+ { 'feeds' => [
38
+ "http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred"]
39
+ }
40
+ )
41
+ }
42
+
43
+ its(:run) { should have(1).feed }
44
+ end
45
+ end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Link
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 18, 2012
5
- # Updated:: Jan 8, 2013
5
+ # Updated:: Feb 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -35,11 +35,38 @@ describe Automatic::Plugin::SubscriptionLink do
35
35
  Automatic::Plugin::SubscriptionLink.new(
36
36
  { 'urls' => [
37
37
  "http://id774.net"],
38
- 'interval' => 5
38
+ 'interval' => 1
39
39
  }
40
40
  )
41
41
  }
42
42
 
43
43
  its(:run) { should have(1).item }
44
44
  end
45
+
46
+ context "with retry to URLs whose valid URL" do
47
+ subject {
48
+ Automatic::Plugin::SubscriptionLink.new(
49
+ { 'urls' => [
50
+ "http://id774.net"],
51
+ 'interval' => 2,
52
+ 'retry' => 3
53
+ }
54
+ )
55
+ }
56
+
57
+ its(:run) { should have(1).item }
58
+ end
59
+
60
+ context "with retry to URLs whose invalid URL" do
61
+ subject {
62
+ Automatic::Plugin::SubscriptionLink.new(
63
+ { 'urls' => ["invalid_url"],
64
+ 'interval' => 1,
65
+ 'retry' => 1
66
+ }
67
+ )
68
+ }
69
+
70
+ its(:run) { should be_empty }
71
+ end
45
72
  end