automatic 13.5.0 → 13.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Gemfile +11 -5
  2. data/README.md +4 -6
  3. data/VERSION +1 -1
  4. data/automatic.gemspec +61 -18
  5. data/doc/ChangeLog +25 -0
  6. data/doc/PLUGINS +202 -12
  7. data/doc/PLUGINS.ja +221 -30
  8. data/doc/README +1 -1
  9. data/doc/README.ja +1 -1
  10. data/lib/automatic.rb +3 -3
  11. data/lib/automatic/feed_parser.rb +2 -2
  12. data/lib/automatic/log.rb +12 -2
  13. data/lib/automatic/pipeline.rb +1 -1
  14. data/lib/automatic/recipe.rb +5 -2
  15. data/plugins/custom_feed/svn_log.rb +3 -3
  16. data/plugins/filter/absolute_uri.rb +8 -4
  17. data/plugins/filter/accept.rb +61 -0
  18. data/plugins/filter/full_feed.rb +4 -5
  19. data/plugins/filter/github_feed.rb +36 -0
  20. data/plugins/filter/ignore.rb +1 -1
  21. data/plugins/filter/image.rb +1 -1
  22. data/plugins/filter/image_source.rb +34 -10
  23. data/plugins/filter/one.rb +1 -1
  24. data/plugins/filter/rand.rb +1 -1
  25. data/plugins/filter/sanitize.rb +50 -0
  26. data/plugins/filter/sort.rb +1 -1
  27. data/plugins/filter/tumblr_resize.rb +1 -1
  28. data/plugins/publish/console.rb +3 -3
  29. data/plugins/publish/console_link.rb +30 -0
  30. data/plugins/publish/eject.rb +42 -0
  31. data/plugins/publish/fluentd.rb +42 -0
  32. data/plugins/publish/google_calendar.rb +3 -3
  33. data/plugins/publish/hatena_bookmark.rb +1 -1
  34. data/plugins/publish/hipchat.rb +45 -0
  35. data/plugins/publish/instapaper.rb +2 -1
  36. data/plugins/publish/memcached.rb +44 -0
  37. data/plugins/publish/pocket.rb +1 -1
  38. data/plugins/publish/twitter.rb +1 -1
  39. data/plugins/store/database.rb +3 -3
  40. data/plugins/store/full_text.rb +2 -2
  41. data/plugins/store/permalink.rb +1 -1
  42. data/plugins/store/target_link.rb +3 -2
  43. data/plugins/subscription/chan_toru.rb +56 -0
  44. data/plugins/subscription/feed.rb +1 -1
  45. data/plugins/subscription/g_guide.rb +48 -0
  46. data/plugins/subscription/google_reader_star.rb +3 -3
  47. data/plugins/subscription/link.rb +2 -2
  48. data/plugins/subscription/pocket.rb +49 -0
  49. data/plugins/subscription/text.rb +3 -12
  50. data/plugins/subscription/tumblr.rb +7 -1
  51. data/plugins/subscription/twitter.rb +1 -1
  52. data/plugins/subscription/twitter_search.rb +50 -0
  53. data/plugins/subscription/weather.rb +7 -41
  54. data/script/build +3 -0
  55. data/spec/fixtures/sampleRecipe.yml +1 -1
  56. data/spec/lib/automatic/log_spec.rb +31 -0
  57. data/spec/lib/automatic/pipeline_spec.rb +1 -1
  58. data/spec/lib/automatic/recipe_spec.rb +1 -1
  59. data/spec/lib/automatic_spec.rb +3 -3
  60. data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
  61. data/spec/plugins/filter/absolute_uri_spec.rb +1 -1
  62. data/spec/plugins/filter/accept_spec.rb +331 -0
  63. data/spec/plugins/filter/full_feed_spec.rb +4 -6
  64. data/spec/plugins/filter/github_feed_spec.rb +54 -0
  65. data/spec/plugins/filter/ignore_spec.rb +1 -1
  66. data/spec/plugins/filter/image_source_spec.rb +17 -3
  67. data/spec/plugins/filter/image_spec.rb +1 -1
  68. data/spec/plugins/filter/one_spec.rb +1 -1
  69. data/spec/plugins/filter/rand_spec.rb +1 -1
  70. data/spec/plugins/filter/sanitize_spec.rb +153 -0
  71. data/spec/plugins/filter/sort_spec.rb +1 -1
  72. data/spec/plugins/filter/tumblr_resize_spec.rb +1 -1
  73. data/spec/plugins/notify/ikachan_spec.rb +1 -1
  74. data/spec/plugins/publish/console_spec.rb +1 -1
  75. data/spec/plugins/publish/eject_spec.rb +40 -0
  76. data/spec/plugins/publish/fluentd_spec.rb +39 -0
  77. data/spec/plugins/publish/google_calendar_spec.rb +1 -1
  78. data/spec/plugins/publish/hatena_bookmark_spec.rb +1 -1
  79. data/spec/plugins/publish/hipchat_spec.rb +69 -0
  80. data/spec/plugins/publish/instapaper_spec.rb +42 -28
  81. data/spec/plugins/publish/memcached_spec.rb +63 -0
  82. data/spec/plugins/publish/pocket_spec.rb +33 -33
  83. data/spec/plugins/publish/twitter_spec.rb +57 -19
  84. data/spec/plugins/store/full_text_spec.rb +6 -1
  85. data/spec/plugins/store/permalink_spec.rb +18 -19
  86. data/spec/plugins/store/target_link_spec.rb +1 -1
  87. data/spec/plugins/subscription/chan_toru_spec.rb +56 -0
  88. data/spec/plugins/subscription/feed_spec.rb +1 -1
  89. data/spec/plugins/subscription/g_guide_spec.rb +76 -0
  90. data/spec/plugins/subscription/google_reader_star_spec.rb +1 -1
  91. data/spec/plugins/subscription/link_spec.rb +1 -1
  92. data/spec/plugins/subscription/pocket_spec.rb +57 -0
  93. data/spec/plugins/subscription/text_spec.rb +1 -14
  94. data/spec/plugins/subscription/tumblr_spec.rb +3 -2
  95. data/spec/plugins/subscription/twitter_search_spec.rb +57 -0
  96. data/spec/plugins/subscription/twitter_spec.rb +3 -2
  97. data/spec/plugins/subscription/weather_spec.rb +2 -15
  98. data/spec/spec_helper.rb +1 -0
  99. data/test/integration/test_chan_toru.yml +19 -0
  100. data/test/integration/test_fluentd.yml +20 -0
  101. data/test/integration/test_pocket.yml +21 -0
  102. data/test/integration/test_sanitize.yml +22 -0
  103. data/test/integration/test_twitter_search.yml +21 -0
  104. metadata +145 -24
  105. data/plugins/publish/mail.rb +0 -64
  106. data/plugins/publish/smtp.rb +0 -48
  107. data/spec/plugins/publish/mail_spec.rb +0 -53
  108. data/spec/plugins/publish/smtp_spec.rb +0 -49
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Oct 16, 2012
5
5
  # Updated:: Apr 5, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -44,7 +44,13 @@ module Automatic::Plugin
44
44
  Automatic::Log.puts("info", "Parsing: #{url}")
45
45
  html = open(url).read
46
46
  unless html.nil?
47
+ uri = URI.parse(url)
47
48
  rss = Automatic::FeedParser.parse(html)
49
+ rss.items.each {|item|
50
+ unless item.link =~ Regexp.new(uri.host)
51
+ item.link = nil
52
+ end
53
+ }
48
54
  sleep @config['interval'].to_i unless @config['interval'].nil?
49
55
  @return_feeds << rss
50
56
  end
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 9, 2012
5
5
  # Updated:: Apr 5, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::TwitterSearch
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: May 30, 2013
5
+ # Updated:: May 30, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ module Automatic::Plugin
10
+ class SubscriptionTwitterSearch
11
+ require 'twitter'
12
+
13
+ def initialize(config, pipeline=[])
14
+ @config = config
15
+ @pipeline = pipeline
16
+ @client = Twitter::Client.new(
17
+ :consumer_key => @config['consumer_key'],
18
+ :consumer_secret => @config['consumer_secret'],
19
+ :oauth_token => @config['oauth_token'],
20
+ :oauth_token_secret => @config['oauth_token_secret']
21
+ )
22
+ end
23
+
24
+ def run
25
+ @pipeline = []
26
+ retries = 0
27
+ begin
28
+ feeds = []
29
+ @client.search(@config['search'],@config['opt']).results.each do |status|
30
+
31
+ dummy = Hashie::Mash.new
32
+ dummy.title = 'Twitter Search'
33
+ dummy.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}"
34
+ dummy.description = status.text
35
+ dummy.author = status.user['screen_name']
36
+ dummy.date = status.created_at
37
+
38
+ feeds << dummy
39
+ end
40
+ @pipeline << Automatic::FeedParser.create(feeds)
41
+ rescue
42
+ retries += 1
43
+ Automatic::Log.puts("error", "ErrorCount: #{retries}")
44
+ sleep @config['interval'].to_i unless @config['interval'].nil?
45
+ retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
46
+ end
47
+ @pipeline
48
+ end
49
+ end
50
+ end
@@ -3,33 +3,10 @@
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # Created:: May 12, 2013
5
5
  # Updated:: May 12, 2013
6
- # Copyright:: soramugi Copyright (c) 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
10
- class WeatherFeed
11
- def initialize
12
- @link = 'http://weather.dummy'
13
- @title = 'weather-dummy'
14
- end
15
-
16
- def link
17
- @link
18
- end
19
-
20
- def title
21
- @title
22
- end
23
-
24
- def set_link(link)
25
- @link = link
26
- end
27
-
28
- def set_title(title)
29
- @title = title
30
- end
31
- end
32
-
33
10
  class SubscriptionWeather
34
11
  require 'weather_hacker'
35
12
 
@@ -42,24 +19,13 @@ module Automatic::Plugin
42
19
  end
43
20
 
44
21
  def run
45
- retries = 0
46
- begin
47
- weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil?
48
- if weather != nil
49
- dummyfeed = WeatherFeed.new
50
- dummyfeed.set_title(weather)
51
- dummyfeed.set_link(dummyfeed.link + '.' + @day)
52
- dummyfeeds = []
53
- dummyfeeds << dummyfeed
54
- @pipeline << Automatic::FeedParser.create(dummyfeeds)
55
- end
56
- rescue
57
- retries += 1
58
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{dummyfeed}")
59
- sleep @config['interval'].to_i unless @config['interval'].nil?
60
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
22
+ weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil?
23
+ if weather != nil
24
+ dummy = Hashie::Mash.new
25
+ dummy.title = weather
26
+ dummy.link = 'http://weather.dummy.' + @day
27
+ @pipeline << Automatic::FeedParser.create([dummy])
61
28
  end
62
-
63
29
  @pipeline
64
30
  end
65
31
  end
@@ -6,6 +6,8 @@
6
6
  #
7
7
  # Maintainer: id774 <idnanashi@gmail.com>
8
8
  #
9
+ # v1.5 6/28,2013
10
+ # Always using latest gems.
9
11
  # v1.4 5/13,2013
10
12
  # Fix bundler environment.
11
13
  # v1.3 2/26,2013
@@ -29,6 +31,7 @@ kickstart() {
29
31
  exec_rspec() {
30
32
  $RACK_ROOT/bin/automatic -v
31
33
  bundle install --path vendor/gems
34
+ bundle update
32
35
  bundle exec rake simplecov
33
36
  }
34
37
 
@@ -3,7 +3,7 @@ global:
3
3
  cache:
4
4
  base: /tmp
5
5
  log:
6
- level: info
6
+ level: none
7
7
 
8
8
  plugins:
9
9
  - module: SubscriptionFeed
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Auaotmatic::Log
3
+ # Author:: soramugi
4
+ # Created:: May 19, 2013
5
+ # Updated:: May 19, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper'))
10
+ require 'automatic'
11
+ require 'automatic/log'
12
+
13
+ describe Automatic::Log do
14
+ context "with a puts" do
15
+ ['info', 'warn', 'error'].each {|level|
16
+ its (level) {
17
+ subject.level(level)
18
+ subject.puts(level, 'log spec').should_not == nil
19
+ }
20
+ }
21
+ end
22
+
23
+ context "with a not puts" do
24
+ ['warn', 'error', 'none'].each {|level|
25
+ its (level) {
26
+ subject.level(level)
27
+ subject.puts('info', 'log spec').should == nil
28
+ }
29
+ }
30
+ end
31
+ end
@@ -4,7 +4,7 @@
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 10, 2012
6
6
  # Updated:: Jun 16, 2012
7
- # Copyright:: ainame Copyright (c) 2012
7
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper'))
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jun 14, 2012
5
5
  # Updated:: Jun 14, 2012
6
- # Copyright:: ainame Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper'))
@@ -3,8 +3,8 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 9, 2012
6
- # Updated:: May 18, 2013
7
- # Copyright:: kzgs Copyright (c) 2012-2013
6
+ # Updated:: Jun 27, 2013
7
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
@@ -26,7 +26,7 @@ describe Automatic do
26
26
 
27
27
  describe "#version" do
28
28
  specify {
29
- Automatic.const_get(:VERSION).should == "13.5.0"
29
+ Automatic.const_get(:VERSION).should == "13.6.0"
30
30
  }
31
31
  end
32
32
 
@@ -3,7 +3,7 @@
3
3
  # Author:: kzgs
4
4
  # Created:: Feb 29, 2012
5
5
  # Updated:: Nov 3, 2012
6
- # Copyright:: kzgs Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jun 20, 2012
5
5
  # Updated:: Sep 18, 2012
6
- # Copyright:: 774 Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -0,0 +1,331 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Filter::Accept
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: Jun 4, 2013
5
+ # Updated:: Jun 4, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
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/accept'
12
+
13
+ describe Automatic::Plugin::FilterAccept do
14
+
15
+ context "with contain by title" do
16
+
17
+ subject {
18
+ Automatic::Plugin::FilterAccept.new({
19
+ 'title' => [""],
20
+ },
21
+ AutomaticSpec.generate_pipeline {
22
+ feed { item "http://github.com", "foo" }
23
+ feed { item "http://google.com", "hi" }
24
+ })
25
+ }
26
+
27
+ describe "#run" do
28
+ its(:run) { should have(2).feeds }
29
+ end
30
+ end
31
+
32
+ context "with contain by title" do
33
+ subject {
34
+ Automatic::Plugin::FilterAccept.new({
35
+ 'title' => ["foo"],
36
+ },
37
+ AutomaticSpec.generate_pipeline {
38
+ feed { item "http://github.com", "foo" }
39
+ feed { item "http://google.com", "hi" }
40
+ feed { item "http://google.com", "hi" }
41
+ })
42
+ }
43
+
44
+ describe "#run" do
45
+ its(:run) { should have(1).feeds }
46
+ end
47
+ end
48
+
49
+ context "with contain by title" do
50
+ subject {
51
+ Automatic::Plugin::FilterAccept.new({
52
+ 'title' => ["o"],
53
+ },
54
+ AutomaticSpec.generate_pipeline {
55
+ feed { item "http://github.com", "foo" }
56
+ feed { item "http://google.com", "hi" }
57
+ })
58
+ }
59
+
60
+ describe "#run" do
61
+ its(:run) { should have(1).feeds }
62
+ end
63
+ end
64
+
65
+ context "with contain by links" do
66
+ subject {
67
+ Automatic::Plugin::FilterAccept.new({
68
+ 'link' => ["comment"],
69
+ },
70
+ AutomaticSpec.generate_pipeline {
71
+ feed { item "http://github.com" }
72
+ feed { item "http://google.com" }
73
+ })
74
+ }
75
+
76
+ describe "#run" do
77
+ its(:run) { should have(0).feeds }
78
+ end
79
+ end
80
+
81
+ context "with contain by links" do
82
+ subject {
83
+ Automatic::Plugin::FilterAccept.new({
84
+ 'link' => ["comment"],
85
+ },
86
+ AutomaticSpec.generate_pipeline {
87
+ feed { item "http://github.com" }
88
+ feed { item "http://google.com/comment" }
89
+ })
90
+ }
91
+
92
+ describe "#run" do
93
+ its(:run) { should have(1).feeds }
94
+ end
95
+ end
96
+
97
+ context "with contain by links" do
98
+ subject {
99
+ Automatic::Plugin::FilterAccept.new({
100
+ 'link' => ["hoge"],
101
+ },
102
+ AutomaticSpec.generate_pipeline {
103
+ feed { item "http://github.com" }
104
+ feed { item "http://google.com" }
105
+ })
106
+ }
107
+
108
+ describe "#run" do
109
+ its(:run) { should have(0).feeds }
110
+ end
111
+ end
112
+
113
+ context "with contain by links" do
114
+ subject {
115
+ Automatic::Plugin::FilterAccept.new({
116
+ 'link' => ["hoge"],
117
+ },
118
+ AutomaticSpec.generate_pipeline {
119
+ feed { item "http://github.com/hoge" }
120
+ feed { item "http://google.com" }
121
+ })
122
+ }
123
+
124
+ describe "#run" do
125
+ its(:run) { should have(1).feeds }
126
+ end
127
+ end
128
+
129
+ context "with contain by links" do
130
+ subject {
131
+ Automatic::Plugin::FilterAccept.new({
132
+ 'link' => ["github"],
133
+ },
134
+ AutomaticSpec.generate_pipeline {
135
+ feed { item "http://github.com" }
136
+ feed { item "http://google.com" }
137
+ })
138
+ }
139
+
140
+ describe "#run" do
141
+ its(:run) { should have(1).feeds }
142
+ end
143
+ end
144
+
145
+ context "with contain by links" do
146
+ subject {
147
+ Automatic::Plugin::FilterAccept.new({
148
+ 'link' => [""],
149
+ },
150
+ AutomaticSpec.generate_pipeline {
151
+ feed { item "http://github.com" }
152
+ feed { item "http://google.com" }
153
+ })
154
+ }
155
+
156
+ describe "#run" do
157
+ its(:run) { should have(2).feeds }
158
+ end
159
+ end
160
+
161
+ context "with contain by description" do
162
+ subject {
163
+ Automatic::Plugin::FilterAccept.new({
164
+ 'description' => ["comment"],
165
+ },
166
+ AutomaticSpec.generate_pipeline {
167
+ feed { item "http://github.com" }
168
+ feed { item "http://google.com" }
169
+ })
170
+ }
171
+
172
+ describe "#run" do
173
+ its(:run) { should have(0).feeds }
174
+ end
175
+ end
176
+
177
+ context "with contain by description" do
178
+ subject {
179
+ Automatic::Plugin::FilterAccept.new({
180
+ 'description' => [""],
181
+ },
182
+ AutomaticSpec.generate_pipeline {
183
+ feed { item "http://github.com" }
184
+ feed { item "http://google.com" }
185
+ })
186
+ }
187
+
188
+ describe "#run" do
189
+ its(:run) { should have(2).feeds }
190
+ end
191
+ end
192
+
193
+ context "with contain by description" do
194
+ subject {
195
+ Automatic::Plugin::FilterAccept.new({
196
+ 'description' => ["bbb"],
197
+ },
198
+ AutomaticSpec.generate_pipeline {
199
+ # url, title, description, pubDate, author, source, enclosure
200
+ feed {
201
+ item "http://hogefuga.com", "",
202
+ "aaabbbccc"
203
+ }
204
+ feed {
205
+ item "http://aaabbbccc.com", "",
206
+ "hogefugahoge"
207
+ }
208
+ feed {
209
+ item "http://aaabbbccc.com", "",
210
+ "aaaccc"
211
+ }
212
+ feed {
213
+ item "http://aaaccc.com", "",
214
+ "aaabbbccc"
215
+ }
216
+ }
217
+ )}
218
+
219
+ describe "#run" do
220
+ its(:run) { should have(2).feeds }
221
+ end
222
+ end
223
+
224
+ context "with contain by description" do
225
+ subject {
226
+ Automatic::Plugin::FilterAccept.new({
227
+ 'description' => ["aaaa"],
228
+ },
229
+ AutomaticSpec.generate_pipeline {
230
+ feed {
231
+ item "http://hogefuga.com", "",
232
+ "aaaabbbccc"
233
+ }
234
+ feed {
235
+ item "http://aaaabbbccc.com", "",
236
+ "hogefugahoge"
237
+ }
238
+ feed {
239
+ item "http://aaabbbccc.com", "",
240
+ "aaaaaaaaaacccdd"
241
+ }
242
+ feed {
243
+ item "http://aaaaccc.com", "",
244
+ "aabbbccc"
245
+ }
246
+ feed {
247
+ item "http://aaaaccc.com", "",
248
+ "aabbbcccdd"
249
+ }
250
+ }
251
+ )}
252
+
253
+ describe "#run" do
254
+ its(:run) { should have(2).feeds }
255
+ end
256
+ end
257
+
258
+ context "with item base contain by links" do
259
+ subject {
260
+ Automatic::Plugin::FilterAccept.new({
261
+ 'link' => ["dddd"],
262
+ },
263
+ AutomaticSpec.generate_pipeline {
264
+ feed {
265
+ item "http://hogefuga.com", "",
266
+ "aaaabbbccc"
267
+ item "http://hogefuga.com", "",
268
+ "aaaabbbcccdddd"
269
+ }
270
+ feed {
271
+ item "http://aaaabbbccc.com", "",
272
+ "hogefugahoge"
273
+ }
274
+ feed {
275
+ item "http://aaabbbcccdddd.com", "",
276
+ "aaaaaaaaaacccdd"
277
+ }
278
+ feed {
279
+ item "http://aaaaccc.com", "",
280
+ "aabbbccc"
281
+ item "http://aabbcccdddd.com", "",
282
+ "aabbbcccddd"
283
+ }
284
+ feed {
285
+ item "http://cccdddd.com", "",
286
+ "aabbbcccdd"
287
+ }
288
+ }
289
+ )}
290
+
291
+ describe "#run" do
292
+ its(:run) { should have(3).feeds }
293
+ end
294
+ end
295
+
296
+ context "with item base contain by description" do
297
+ subject {
298
+ Automatic::Plugin::FilterAccept.new({
299
+ 'description' => ["aaaa"],
300
+ },
301
+ AutomaticSpec.generate_pipeline {
302
+ feed {
303
+ item "http://hogefuga.com", "",
304
+ "aaaabbbccc"
305
+ }
306
+ feed {
307
+ item "http://aaaabbbccc.com", "",
308
+ "hogefugahoge"
309
+ }
310
+ feed {
311
+ item "http://aaabbbccc.com", "",
312
+ "aaaaaaaaaacccdd"
313
+ }
314
+ feed {
315
+ item "http://aaccc.com", "",
316
+ "aaaabbbccc"
317
+ item "http://aabbccc.com", "",
318
+ "aabbbccc"
319
+ }
320
+ feed {
321
+ item "http://cccddd.com", "",
322
+ "aabbbcccdd"
323
+ }
324
+ }
325
+ )}
326
+
327
+ describe "#run" do
328
+ its(:run) { should have(3).feeds }
329
+ end
330
+ end
331
+ end