automatic 14.1.0 → 14.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +2 -2
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/automatic.gemspec +17 -9
  7. data/bin/automatic +4 -4
  8. data/doc/ChangeLog +27 -0
  9. data/doc/PLUGINS +36 -6
  10. data/doc/PLUGINS.ja +35 -7
  11. data/doc/README +4 -4
  12. data/doc/README.ja +3 -3
  13. data/lib/automatic.rb +2 -1
  14. data/lib/automatic/feed_maker.rb +80 -0
  15. data/lib/automatic/feed_parser.rb +6 -50
  16. data/lib/automatic/recipe.rb +1 -1
  17. data/lib/automatic/version.rb +1 -1
  18. data/plugins/filter/accept.rb +4 -3
  19. data/plugins/filter/github_feed.rb +12 -11
  20. data/plugins/filter/ignore.rb +3 -3
  21. data/plugins/filter/image_source.rb +10 -10
  22. data/plugins/filter/one.rb +4 -3
  23. data/plugins/filter/rand.rb +3 -3
  24. data/plugins/filter/sanitize.rb +2 -3
  25. data/plugins/provide/fluentd.rb +5 -4
  26. data/plugins/publish/amazon_s3.rb +58 -0
  27. data/plugins/publish/fluentd.rb +5 -4
  28. data/plugins/publish/google_calendar.rb +2 -2
  29. data/plugins/publish/hipchat.rb +1 -1
  30. data/plugins/publish/twitter.rb +1 -1
  31. data/plugins/store/database.rb +4 -4
  32. data/plugins/store/file.rb +95 -0
  33. data/plugins/store/full_text.rb +1 -1
  34. data/plugins/store/permalink.rb +1 -1
  35. data/plugins/subscription/feed.rb +2 -2
  36. data/plugins/subscription/g_guide.rb +3 -2
  37. data/plugins/subscription/link.rb +4 -3
  38. data/plugins/subscription/pocket.rb +12 -11
  39. data/plugins/subscription/text.rb +35 -44
  40. data/plugins/subscription/tumblr.rb +3 -3
  41. data/plugins/subscription/twitter.rb +1 -1
  42. data/plugins/subscription/twitter_search.rb +11 -12
  43. data/plugins/subscription/weather.rb +7 -6
  44. data/plugins/subscription/xml.rb +4 -3
  45. data/spec/fixtures/sampleFeeds.tsv +1 -0
  46. data/spec/fixtures/sampleFeeds2.tsv +2 -0
  47. data/spec/lib/automatic/pipeline_spec.rb +4 -4
  48. data/spec/lib/automatic_spec.rb +3 -3
  49. data/spec/plugins/filter/github_feed_spec.rb +9 -8
  50. data/spec/plugins/filter/image_source_spec.rb +7 -7
  51. data/spec/plugins/notify/ikachan_spec.rb +3 -3
  52. data/spec/plugins/provide/fluentd_spec.rb +6 -5
  53. data/spec/plugins/publish/amazon_s3_spec.rb +40 -0
  54. data/spec/plugins/publish/console_spec.rb +3 -3
  55. data/spec/plugins/publish/fluentd_spec.rb +5 -4
  56. data/spec/plugins/publish/google_calendar_spec.rb +5 -5
  57. data/spec/plugins/publish/hatena_bookmark_spec.rb +10 -10
  58. data/spec/plugins/publish/hipchat_spec.rb +6 -6
  59. data/spec/plugins/publish/instapaper_spec.rb +6 -6
  60. data/spec/plugins/publish/memcached_spec.rb +3 -3
  61. data/spec/plugins/publish/pocket_spec.rb +3 -3
  62. data/spec/plugins/publish/twitter_spec.rb +4 -4
  63. data/spec/plugins/store/{target_link_spec.rb → file_spec.rb} +10 -10
  64. data/spec/plugins/subscription/pocket_spec.rb +3 -3
  65. data/spec/plugins/subscription/text_spec.rb +32 -2
  66. data/spec/plugins/subscription/twitter_search_spec.rb +3 -3
  67. data/test/integration/test_fluentd.yml +1 -0
  68. data/test/integration/test_image2local.yml +6 -2
  69. data/test/integration/test_text2feed.yml +8 -0
  70. data/test/integration/test_tumblr2local.yml +6 -0
  71. metadata +26 -7
  72. data/plugins/store/target_link.rb +0 -55
@@ -37,7 +37,7 @@ module Automatic::Plugin
37
37
  private
38
38
 
39
39
  def create_rss(url)
40
- Automatic::Log.puts("info", "Parsing: #{url}")
40
+ Automatic::Log.puts("info", "Parsing Twitter: #{url}")
41
41
  html = open(url).read
42
42
  unless html.nil?
43
43
  rss = RSS::Maker.make("2.0") {|maker|
@@ -1,8 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Subscription::TwitterSearch
3
3
  # Author:: soramugi <http://soramugi.net>
4
+ # 774 <http://id774.net>
4
5
  # Created:: May 30, 2013
5
- # Updated:: Jan 15, 2014
6
+ # Updated:: Feb 21, 2014
6
7
  # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
@@ -26,19 +27,17 @@ module Automatic::Plugin
26
27
  retries = 0
27
28
  retry_max = @config['retry'].to_i || 0
28
29
  begin
29
- feeds = []
30
+ return_feeds = []
30
31
  @client.search(@config['search'],@config['opt']).results.each do |status|
31
-
32
- dummy = Hashie::Mash.new
33
- dummy.title = 'Twitter Search'
34
- dummy.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}"
35
- dummy.description = status.text
36
- dummy.author = status.user['screen_name']
37
- dummy.date = status.created_at
38
-
39
- feeds << dummy
32
+ hashie = Hashie::Mash.new
33
+ hashie.title = 'Twitter Search'
34
+ hashie.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}"
35
+ hashie.description = status.text
36
+ hashie.author = status.user['screen_name']
37
+ hashie.date = status.created_at
38
+ return_feeds << hashie
40
39
  end
41
- @pipeline << Automatic::FeedParser.create(feeds)
40
+ @pipeline << Automatic::FeedMaker.create_pipeline(return_feeds)
42
41
  rescue
43
42
  retries += 1
44
43
  Automatic::Log.puts("error", "ErrorCount: #{retries}")
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Subscription::Weather
3
3
  # Author:: soramugi <http://soramugi.net>
4
+ # 774 <http://id774.net>
4
5
  # Created:: May 12, 2013
5
- # Updated:: May 12, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
9
10
  module Automatic::Plugin
@@ -21,10 +22,10 @@ module Automatic::Plugin
21
22
  def run
22
23
  weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil?
23
24
  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])
25
+ hashie = Hashie::Mash.new
26
+ hashie.title = weather
27
+ hashie.link = 'http://weather.dummy.' + @day
28
+ @pipeline << Automatic::FeedMaker.create_pipeline([hashie])
28
29
  end
29
30
  @pipeline
30
31
  end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Xml
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jul 12, 2013
5
- # Updated:: Jan 15, 2014
5
+ # Updated:: Feb 21, 2014
6
6
  # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -36,13 +36,14 @@ module Automatic::Plugin
36
36
  end
37
37
 
38
38
  private
39
+
39
40
  def create_rss(url)
40
- Automatic::Log.puts("info", "Parsing: #{url}")
41
+ Automatic::Log.puts("info", "Parsing XML: #{url}")
41
42
  hash = Hash.from_xml(open(url).read)
42
43
  json = hash.to_json
43
44
  data = ActiveSupport::JSON.decode(json)
44
45
  unless data.nil?
45
- rss = Automatic::FeedParser.content_provide(url, data)
46
+ rss = Automatic::FeedMaker.content_provide(url, data)
46
47
  sleep ||= @config['interval'].to_i
47
48
  @return_feeds << rss
48
49
  end
@@ -0,0 +1 @@
1
+ testTitle http://dummy.from.file testDescription testAuthor testComments
@@ -0,0 +1,2 @@
1
+ testTitle1 http://dummy.from.file1 testDescription1 testComments1
2
+ testTitle2 http://dummy.from.file2 testDescription2 testAuthor2
@@ -3,8 +3,8 @@
3
3
  # Author:: ainame
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 10, 2012
6
- # Updated:: Jun 16, 2012
7
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 25, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 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'))
@@ -38,10 +38,10 @@ describe Automatic::Pipeline do
38
38
 
39
39
  describe "#run" do
40
40
  it "run a recipe with FilterIgnore module" do
41
- plugin = mock("plugin")
41
+ plugin = double("plugin")
42
42
  plugin.should_receive(:module).and_return("FilterIgnore")
43
43
  plugin.should_receive(:config)
44
- recipe = mock("recipe")
44
+ recipe = double("recipe")
45
45
  recipe.should_receive(:each_plugin).and_yield(plugin)
46
46
  Automatic::Pipeline.run(recipe).should == []
47
47
  end
@@ -3,8 +3,8 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 9, 2012
6
- # Updated:: Jan 24, 2014
7
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 26, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 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'))
@@ -27,7 +27,7 @@ describe Automatic do
27
27
  describe "#version" do
28
28
  subject { Automatic.const_get(:VERSION) }
29
29
 
30
- it { expect(subject).to eq "14.1.0" }
30
+ it { expect(subject).to eq "14.2.0" }
31
31
  end
32
32
 
33
33
  describe "#(root)_dir" do
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Filter::GithubFeed
3
3
  # Author:: Kohei Hasegawa <http://github.com/banyan>
4
+ # 774 <http://id774.net>
4
5
  # Created:: Jun 6, 2013
5
- # Updated:: Jun 6, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
9
10
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -35,18 +36,18 @@ describe Automatic::Plugin::FilterGithubFeed do
35
36
  specify {
36
37
  subject.run
37
38
 
38
- subject.instance_variable_get(:@pipeline)[0].items[0].link
39
+ subject.instance_variable_get(:@return_feeds)[0].items[0].link
39
40
  .should == '1'
40
- subject.instance_variable_get(:@pipeline)[0].items[0].title
41
+ subject.instance_variable_get(:@return_feeds)[0].items[0].title
41
42
  .should == 'title1'
42
- subject.instance_variable_get(:@pipeline)[0].items[0].description
43
+ subject.instance_variable_get(:@return_feeds)[0].items[0].description
43
44
  .should == 'description1'
44
45
 
45
- subject.instance_variable_get(:@pipeline)[0].items[1].link
46
+ subject.instance_variable_get(:@return_feeds)[0].items[1].link
46
47
  .should == '0'
47
- subject.instance_variable_get(:@pipeline)[0].items[1].title
48
+ subject.instance_variable_get(:@return_feeds)[0].items[1].title
48
49
  .should == 'title0'
49
- subject.instance_variable_get(:@pipeline)[0].items[1].description
50
+ subject.instance_variable_get(:@return_feeds)[0].items[1].description
50
51
  .should == 'description0'
51
52
  }
52
53
  end
@@ -3,8 +3,8 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 1, 2012
6
- # Updated:: Jun 14, 2012
7
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 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.dirname(__FILE__) + '../../../spec_helper')
@@ -25,7 +25,7 @@ describe Automatic::Plugin::FilterImageSource do
25
25
  its(:run) { should have(1).feeds }
26
26
  specify {
27
27
  subject.run
28
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
28
+ subject.instance_variable_get(:@return_feeds)[0].items[0].link.
29
29
  should == "http://27.media.tumblr.com/tumblr_lzrubkfPlt1qb8vzto1_500.png"
30
30
  }
31
31
  end
@@ -46,7 +46,7 @@ describe Automatic::Plugin::FilterImageSource do
46
46
  its(:run) { should have(1).feeds }
47
47
  specify {
48
48
  subject.run
49
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
49
+ subject.instance_variable_get(:@return_feeds)[0].items[0].link.
50
50
  should == "http://24.media.tumblr.com/tumblr_m07wttnIdy1qzoj1jo1_400.jpg"
51
51
  }
52
52
  end
@@ -65,13 +65,13 @@ describe Automatic::Plugin::FilterImageSource do
65
65
 
66
66
  describe "#run" do
67
67
  before do
68
- subject.stub!(:rewrite_link).and_return(['http://huge.png'])
68
+ subject.stub(:rewrite_link).and_return(['http://huge.png'])
69
69
  end
70
70
 
71
71
  its(:run) { should have(1).feeds }
72
72
  specify {
73
73
  subject.run
74
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
74
+ subject.instance_variable_get(:@return_feeds)[0].items[0].link.
75
75
  should == 'http://huge.png'
76
76
  }
77
77
  end
@@ -80,7 +80,7 @@ describe Automatic::Plugin::FilterImageSource do
80
80
  before do
81
81
  open = Hashie::Mash.new
82
82
  open.read = '<img src="http://a.png"><br /><img src="http://b.png">'
83
- subject.stub!(:open).and_return(open)
83
+ subject.stub(:open).and_return(open)
84
84
  end
85
85
 
86
86
  its(:run) { subject.run[0].items.length.should == 2 }
@@ -19,7 +19,7 @@ describe Automatic::Plugin::NotifyIkachan do
19
19
  }
20
20
 
21
21
  it "should post title and link in the feed" do
22
- ikachan = mock("ikachan")
22
+ ikachan = double("ikachan")
23
23
  ikachan.should_receive(:post).with("http://github.com", "GitHub")
24
24
  ikachan.should_receive(:params)
25
25
  subject.instance_variable_set(:@ikachan, ikachan)
@@ -44,9 +44,9 @@ describe Automatic::Plugin::Ikachan do
44
44
  link = "http://www.google.com"
45
45
 
46
46
  require 'net/http'
47
- res = stub("res")
47
+ res = double("res")
48
48
  res.should_receive(:code).and_return("200")
49
- http = mock("http")
49
+ http = double("http")
50
50
  http.should_receive(:post).with("/join", "channel=#room")
51
51
  http.should_receive(:post).with(
52
52
  "/notice", "channel=#room&message=#{link}").and_return(res)
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Provide::Fluentd
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jul 12, 2013
5
- # Updated:: Jul 12, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 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')
@@ -22,7 +22,7 @@ describe Automatic::Plugin::ProvideFluentd do
22
22
  json = hash.to_json
23
23
  data = ActiveSupport::JSON.decode(json)
24
24
  url = "http://id774.net/test/xml/data"
25
- rss = Automatic::FeedParser.content_provide(url, data)
25
+ rss = Automatic::FeedMaker.content_provide(url, data)
26
26
  feeds << rss
27
27
 
28
28
  subject {
@@ -30,14 +30,15 @@ describe Automatic::Plugin::ProvideFluentd do
30
30
  {
31
31
  'host' => "localhost",
32
32
  'port' => "10000",
33
- 'tag' => "automatic_spec.provide_fluentd"
33
+ 'tag' => "automatic_spec.provide_fluentd",
34
+ 'mode' => "test"
34
35
  },
35
36
  feeds
36
37
  )
37
38
  }
38
39
 
39
40
  its (:run) {
40
- fluentd = mock("fluentd")
41
+ fluentd = double("fluentd")
41
42
  subject.run.should have(1).feed
42
43
  subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.class == Hash
43
44
  subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.should == expect
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Publish::AmazonS3
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Feb 25, 2014
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 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 'publish/amazon_s3'
12
+
13
+ describe Automatic::Plugin::PublishAmazonS3 do
14
+ context 'when feed' do
15
+ describe 'should forward the feeds' do
16
+ subject {
17
+ Automatic::Plugin::PublishAmazonS3.new(
18
+ {
19
+ 'access_key' => "aabbcc",
20
+ 'secret_key' => "ddeeff",
21
+ 'bucket_name' => "test_bucket",
22
+ 'target_path' => "test/tmp",
23
+ 'mode' => "test"
24
+ },
25
+ AutomaticSpec.generate_pipeline{
26
+ feed {
27
+ item "http://github.com", "hoge",
28
+ "<a>fuga</a>"
29
+ }
30
+ }
31
+ )
32
+ }
33
+
34
+ its (:run) {
35
+ subject.run.should have(1).feed
36
+ }
37
+ end
38
+
39
+ end
40
+ end
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Publish::Console
3
3
  # Author:: 774 <http://id774.net>
4
- # Updated:: Jun 14, 2012
5
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
4
+ # Updated:: Feb 25, 2014
5
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
8
8
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -21,7 +21,7 @@ describe Automatic::Plugin::PublishConsole do
21
21
  }
22
22
 
23
23
  it "should output pretty inspect of feeds" do
24
- output = mock("output")
24
+ output = double("output")
25
25
  output.should_receive(:puts).
26
26
  with("info", @pipeline[0].items[0].pretty_inspect)
27
27
  subject.instance_variable_set(:@output, output)
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Publish::Fluentd
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jun 21, 2013
5
- # Updated:: Jun 21, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 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')
@@ -18,7 +18,8 @@ describe Automatic::Plugin::PublishFluentd do
18
18
  {
19
19
  'host' => "localhost",
20
20
  'port' => "10000",
21
- 'tag' => "automatic_spec.publish_fluent"
21
+ 'tag' => "automatic_spec.publish_fluent",
22
+ 'mode' => "test"
22
23
  },
23
24
  AutomaticSpec.generate_pipeline{
24
25
  feed {
@@ -30,7 +31,7 @@ describe Automatic::Plugin::PublishFluentd do
30
31
  }
31
32
 
32
33
  its (:run) {
33
- fluentd = mock("fluentd")
34
+ fluentd = double("fluentd")
34
35
  subject.run.should have(1).feed
35
36
  }
36
37
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::CustomFeed::SVNFLog
3
3
  # Author:: kzgs
4
4
  # Created:: Feb 26, 2012
5
- # Updated:: Mar 3, 2012
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 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')
@@ -24,7 +24,7 @@ describe Automatic::Plugin::PublishGoogleCalendar do
24
24
  }
25
25
 
26
26
  it "should post the link in the feed" do
27
- gc = mock("gc")
27
+ gc = double("gc")
28
28
  gc.should_receive(:add).with("今日 GitHub")
29
29
  subject.instance_variable_set(:@gc, gc)
30
30
  subject.run.should have(1).feed
@@ -50,7 +50,7 @@ describe Automatic::Plugin::Googlecalendar do
50
50
  end
51
51
 
52
52
  def all_day_event_mock(title, where, date=nil)
53
- event = mock("event")
53
+ event = double("event")
54
54
  {
55
55
  :title => title,
56
56
  :st => date.nil? ? nil : Time.mktime(date.year, date.month, date.day),
@@ -69,7 +69,7 @@ def all_day_event_mock(title, where, date=nil)
69
69
  end
70
70
 
71
71
  def cal_mock(event_mock)
72
- cal = mock("cal")
72
+ cal = double("cal")
73
73
  cal.should_receive(:create_event).and_return {
74
74
  event_mock
75
75
  }
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Publish::HatenaBookmark
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 22, 2012
5
- # Updated:: Mar 7, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 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')
@@ -21,7 +21,7 @@ describe Automatic::Plugin::PublishHatenaBookmark do
21
21
  }
22
22
 
23
23
  it "should post the link with prefix 'http' in the feed" do
24
- hb = mock("hb")
24
+ hb = double("hb")
25
25
  hb.should_receive(:post).with("http://github.com", nil)
26
26
  subject.instance_variable_set(:@hb, hb)
27
27
  subject.run.should have(1).feed
@@ -39,7 +39,7 @@ describe Automatic::Plugin::PublishHatenaBookmark do
39
39
  }
40
40
 
41
41
  it "should post the link with prefix '//...' in the feed" do
42
- hb = mock("hb")
42
+ hb = double("hb")
43
43
  hb.should_receive(:post).with("http://github.com", nil)
44
44
  subject.instance_variable_set(:@hb, hb)
45
45
  subject.run.should have(1).feed
@@ -57,7 +57,7 @@ describe Automatic::Plugin::PublishHatenaBookmark do
57
57
  }
58
58
 
59
59
  it "should post the link with prefix 'https' in the feed" do
60
- hb = mock("hb")
60
+ hb = double("hb")
61
61
  hb.should_receive(:post).with("https://github.com", nil)
62
62
  subject.instance_variable_set(:@hb, hb)
63
63
  subject.run.should have(1).feed
@@ -75,7 +75,7 @@ describe Automatic::Plugin::PublishHatenaBookmark do
75
75
  }
76
76
 
77
77
  it "should post the link with others in the feed" do
78
- hb = mock("hb")
78
+ hb = double("hb")
79
79
  hb.should_receive(:post).with("http://github.com", nil)
80
80
  subject.instance_variable_set(:@hb, hb)
81
81
  subject.run.should have(1).feed
@@ -106,9 +106,9 @@ describe Automatic::Plugin::HatenaBookmark do
106
106
  comment = "Can we trust them ?"
107
107
 
108
108
  require 'net/http'
109
- res = stub("res")
109
+ res = double("res")
110
110
  res.should_receive(:code).and_return("201")
111
- http = mock("http")
111
+ http = double("http")
112
112
  http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
113
113
  subject.wsse("", "")).and_return(res)
114
114
  http.should_receive(:start).and_yield(http)
@@ -121,9 +121,9 @@ describe Automatic::Plugin::HatenaBookmark do
121
121
  comment = "Can we trust them ?"
122
122
 
123
123
  require 'net/http'
124
- res = stub("res")
124
+ res = double("res")
125
125
  res.should_receive(:code).twice.and_return("400")
126
- http = mock("http")
126
+ http = double("http")
127
127
  http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
128
128
  subject.wsse("", "")).and_return(res)
129
129
  http.should_receive(:start).and_yield(http)