atig 0.4.5 → 0.5.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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.travis.yml +3 -2
  4. data/Gemfile +2 -0
  5. data/README.mkdn +2 -0
  6. data/Rakefile +0 -6
  7. data/atig.gemspec +21 -20
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/{bin → exe}/atig +0 -0
  11. data/lib/atig/agent/agent.rb +4 -4
  12. data/lib/atig/agent/dm.rb +4 -4
  13. data/lib/atig/agent/following.rb +3 -3
  14. data/lib/atig/agent/list.rb +2 -2
  15. data/lib/atig/agent/list_status.rb +6 -6
  16. data/lib/atig/agent/stream_follow.rb +2 -2
  17. data/lib/atig/agent/user_stream.rb +3 -3
  18. data/lib/atig/basic_twitter.rb +1 -3
  19. data/lib/atig/bitly.rb +1 -1
  20. data/lib/atig/channel/channel.rb +1 -1
  21. data/lib/atig/channel/list.rb +3 -3
  22. data/lib/atig/channel/retweet.rb +1 -1
  23. data/lib/atig/channel/timeline.rb +1 -1
  24. data/lib/atig/command/autofix.rb +4 -4
  25. data/lib/atig/command/destroy.rb +1 -1
  26. data/lib/atig/command/dm.rb +2 -2
  27. data/lib/atig/command/favorite.rb +1 -1
  28. data/lib/atig/command/info.rb +2 -2
  29. data/lib/atig/command/reply.rb +2 -2
  30. data/lib/atig/command/retweet.rb +2 -2
  31. data/lib/atig/command/search.rb +2 -2
  32. data/lib/atig/command/status.rb +3 -3
  33. data/lib/atig/command/user.rb +3 -3
  34. data/lib/atig/command/version.rb +3 -3
  35. data/lib/atig/db/followings.rb +5 -6
  36. data/lib/atig/db/statuses.rb +12 -10
  37. data/lib/atig/db/transaction.rb +1 -1
  38. data/lib/atig/gateway/channel.rb +1 -2
  39. data/lib/atig/gateway/session.rb +13 -13
  40. data/lib/atig/http.rb +4 -4
  41. data/lib/atig/ifilter/expand_url.rb +1 -1
  42. data/lib/atig/ifilter/retweet.rb +1 -1
  43. data/lib/atig/ifilter/retweet_time.rb +1 -1
  44. data/lib/atig/ifilter/sanitize.rb +1 -1
  45. data/lib/atig/ifilter/strip.rb +1 -1
  46. data/lib/atig/ifilter/xid.rb +1 -1
  47. data/lib/atig/oauth.rb +3 -3
  48. data/lib/atig/ofilter/escape_url.rb +1 -1
  49. data/lib/atig/ofilter/footer.rb +1 -1
  50. data/lib/atig/ofilter/geo.rb +1 -1
  51. data/lib/atig/ofilter/short_url.rb +1 -1
  52. data/lib/atig/option.rb +1 -1
  53. data/lib/atig/optparse.rb +22 -11
  54. data/lib/atig/search.rb +4 -2
  55. data/lib/atig/stream.rb +1 -1
  56. data/lib/atig/twitter.rb +5 -4
  57. data/lib/atig/update_checker.rb +2 -2
  58. data/lib/atig/url_escape.rb +1 -1
  59. data/lib/atig/version.rb +1 -1
  60. data/lib/memory_profiler.rb +1 -1
  61. data/spec/command/autofix_spec.rb +7 -8
  62. data/spec/command/destroy_spec.rb +12 -13
  63. data/spec/command/dm_spec.rb +5 -6
  64. data/spec/command/favorite_spec.rb +11 -12
  65. data/spec/command/limit_spec.rb +6 -7
  66. data/spec/command/location_spec.rb +4 -5
  67. data/spec/command/name_spec.rb +2 -3
  68. data/spec/command/option_spec.rb +28 -29
  69. data/spec/command/refresh_spec.rb +3 -4
  70. data/spec/command/reply_spec.rb +22 -23
  71. data/spec/command/retweet_spec.rb +17 -18
  72. data/spec/command/spam_spec.rb +4 -5
  73. data/spec/command/status_spec.rb +19 -20
  74. data/spec/command/thread_spec.rb +20 -21
  75. data/spec/command/time_spec.rb +18 -21
  76. data/spec/command/uptime_spec.rb +17 -18
  77. data/spec/command/user_info_spec.rb +13 -16
  78. data/spec/command/user_spec.rb +13 -14
  79. data/spec/command/version_spec.rb +25 -29
  80. data/spec/command/whois_spec.rb +25 -26
  81. data/spec/command_helper.rb +2 -2
  82. data/spec/db/followings_spec.rb +22 -23
  83. data/spec/db/listenable_spec.rb +2 -3
  84. data/spec/db/lists_spec.rb +16 -17
  85. data/spec/db/roman_spec.rb +3 -5
  86. data/spec/db/sized_uniq_array_spec.rb +13 -14
  87. data/spec/db/statuses_spec.rb +69 -70
  88. data/spec/ifilter/expand_url_spec.rb +18 -20
  89. data/spec/ifilter/retweet_spec.rb +4 -5
  90. data/spec/ifilter/retweet_time_spec.rb +4 -5
  91. data/spec/ifilter/sanitize_spec.rb +5 -6
  92. data/spec/ifilter/sid_spec.rb +6 -7
  93. data/spec/ifilter/strip_spec.rb +3 -4
  94. data/spec/ifilter/tid_spec.rb +6 -7
  95. data/spec/levenshtein_spec.rb +2 -3
  96. data/spec/ofilter/escape_url_spec.rb +13 -14
  97. data/spec/ofilter/footer_spec.rb +10 -11
  98. data/spec/ofilter/geo_spec.rb +12 -13
  99. data/spec/ofilter/short_url_spec.rb +28 -29
  100. data/spec/option_spec.rb +23 -24
  101. data/spec/sized_hash_spec.rb +5 -6
  102. data/spec/spec_helper.rb +8 -6
  103. data/spec/update_checker_spec.rb +14 -15
  104. metadata +9 -32
  105. data/docs/_static/allow.png +0 -0
  106. data/docs/_static/emacs.png +0 -0
  107. data/docs/_static/irc_setting.png +0 -0
  108. data/docs/_static/irssi.png +0 -0
  109. data/docs/_static/limechat.png +0 -0
  110. data/docs/_static/limechat_s.png +0 -0
  111. data/docs/_static/oauth_channel.png +0 -0
  112. data/docs/_static/screenshot.png +0 -0
  113. data/docs/_static/structure.png +0 -0
  114. data/docs/_static/verify.png +0 -0
  115. data/docs/changelog.rst +0 -233
  116. data/docs/commandline_options.rst +0 -21
  117. data/docs/commands.rst +0 -84
  118. data/docs/conf.py +0 -194
  119. data/docs/config.rst +0 -159
  120. data/docs/feature.rst +0 -41
  121. data/docs/hacking_guide.rst +0 -43
  122. data/docs/index.rst +0 -102
  123. data/docs/irc.rst +0 -31
  124. data/docs/options.rst +0 -76
  125. data/docs/quickstart.rst +0 -96
  126. data/docs/resize.sh +0 -7
  127. data/docs/tiarra.rst +0 -2
  128. data/docs/tig.rst +0 -21
  129. data/requirements.txt +0 -5
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/refresh'
5
4
  require 'atig/command/info'
6
5
 
@@ -12,9 +11,9 @@ describe Atig::Command::Refresh do
12
11
  end
13
12
 
14
13
  it "should refresh all" do
15
- @followings.should_receive(:invalidate)
16
- @lists.should_receive(:invalidate).with(:all)
17
- @channel.should_receive(:notify).with("refresh followings/lists...")
14
+ expect(@followings).to receive(:invalidate)
15
+ expect(@lists).to receive(:invalidate).with(:all)
16
+ expect(@channel).to receive(:notify).with("refresh followings/lists...")
18
17
 
19
18
  call '#twitter','refresh', []
20
19
  end
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/reply'
5
4
 
6
5
  describe Atig::Command::Reply do
@@ -14,65 +13,65 @@ describe Atig::Command::Reply do
14
13
 
15
14
  stub_status(:find_by_tid,'a' => entry)
16
15
  stub_status(:find_by_sid,'mzp:a' => entry)
17
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default => [])
16
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default: [])
18
17
  end
19
18
 
20
19
  it "should have '/me status' name" do
21
- @gateway.names.should == %w(mention re reply rp)
20
+ expect(@gateway.names).to eq(%w(mention re reply rp))
22
21
  end
23
22
 
24
23
  it "should post the status" do
25
- @api.should_receive(:post).
26
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
24
+ expect(@api).to receive(:post).
25
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
27
26
  and_return(@res)
28
27
 
29
28
  call '#twitter', "reply", %w(a abc @mzp)
30
29
 
31
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
32
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
30
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
31
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
33
32
  end
34
33
 
35
34
  it "should post the status by sid" do
36
- @api.should_receive(:post).
37
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
35
+ expect(@api).to receive(:post).
36
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
38
37
  and_return(@res)
39
38
 
40
39
  call '#twitter', "reply", %w(mzp:a abc @mzp)
41
40
 
42
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
43
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
41
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
42
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
44
43
  end
45
44
 
46
45
  it "should post the status by API" do
47
- @api.should_receive(:post).
48
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
46
+ expect(@api).to receive(:post).
47
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
49
48
  and_return(@res)
50
49
 
51
50
  call '#twitter', "reply", %w(a abc @mzp)
52
51
 
53
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
54
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
52
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
53
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
55
54
  end
56
55
 
57
56
  it "should post the status with screen_name" do
58
- @api.should_receive(:post).
59
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
57
+ expect(@api).to receive(:post).
58
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
60
59
  and_return(@res)
61
60
 
62
61
  call '#twitter', "reply", %w(mzp abc @mzp)
63
62
 
64
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
65
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
63
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
64
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
66
65
  end
67
66
 
68
67
  it "should add screen name as prefix" do
69
- @api.should_receive(:post).
70
- with('statuses/update', {:status=>'@mzp mzp', :in_reply_to_status_id=>'1'}).
68
+ expect(@api).to receive(:post).
69
+ with('statuses/update', {status:'@mzp mzp', in_reply_to_status_id:'1'}).
71
70
  and_return(@res)
72
71
 
73
72
  call '#twitter', "reply", %w(a mzp)
74
73
 
75
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
76
- @gateway.filtered.should == { :status => '@mzp mzp', :in_reply_to_status_id=>'1'}
74
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
75
+ expect(@gateway.filtered).to eq({ status: '@mzp mzp', in_reply_to_status_id:'1'})
77
76
  end
78
77
  end
@@ -1,16 +1,15 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/retweet'
5
4
 
6
5
  describe Atig::Command::Retweet do
7
6
  include CommandHelper
8
7
  before do
9
8
  bitly = double("Bitly")
10
- bitly.stub(:shorten).and_return{|s|
9
+ allow(bitly).to receive(:shorten){|s|
11
10
  "[#{s}]"
12
11
  }
13
- Atig::Bitly.stub(:no_login).and_return(bitly)
12
+ allow(Atig::Bitly).to receive(:no_login).and_return(bitly)
14
13
 
15
14
  @command = init Atig::Command::Retweet
16
15
 
@@ -20,46 +19,46 @@ describe Atig::Command::Retweet do
20
19
 
21
20
  stub_status(:find_by_tid,'a' => entry)
22
21
  stub_status(:find_by_sid,'mzp:a' => entry)
23
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
22
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default:[])
24
23
  end
25
24
 
26
25
  it "should have command name" do
27
- @gateway.names.should == %w(ort rt retweet qt)
26
+ expect(@gateway.names).to eq(%w(ort rt retweet qt))
28
27
  end
29
28
 
30
29
  it "should post official retweet without comment" do
31
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
30
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
32
31
  call "#twitter", 'rt', %w(a)
33
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
32
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
34
33
  end
35
34
 
36
35
  it "should post official retweet without comment by screen name" do
37
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
36
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
38
37
  call "#twitter", 'rt', %w(mzp)
39
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
38
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
40
39
  end
41
40
 
42
41
  it "should post official retweet without comment by sid" do
43
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
42
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
44
43
  call "#twitter", 'rt', %w(mzp:a)
45
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
44
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
46
45
  end
47
46
 
48
47
  it "should post un-official retweet with comment" do
49
- @api.should_receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
48
+ expect(@api).to receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
50
49
  call "#twitter", 'rt', %w(a aaa)
51
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
50
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
52
51
  end
53
52
 
54
53
  it "should post un-official retweet with comment by screen name" do
55
- @api.should_receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
54
+ expect(@api).to receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
56
55
  call "#twitter", 'rt', %w(mzp aaa)
57
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
56
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
58
57
  end
59
58
 
60
59
  it "should post un-official retweet with long comment" do
61
- @api.should_receive(:post).with('statuses/update',:status=> "#{'a' * 95} RT @mzp: b [http://twitter.com/mzp/status/1]").and_return(@res)
62
- call "#twitter", 'rt', ['a', 'a' * 95 ]
63
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
60
+ expect(@api).to receive(:post).with('statuses/update',:status=> "#{'a' * 94} RT @mzp: b [https://twitter.com/mzp/status/1]").and_return(@res)
61
+ call "#twitter", 'rt', ['a', 'a' * 94 ]
62
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
64
63
  end
65
64
  end
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/spam'
5
4
 
6
5
  describe Atig::Command::Spam do
@@ -10,17 +9,17 @@ describe Atig::Command::Spam do
10
9
  end
11
10
 
12
11
  it "はspamコマンドを提供する" do
13
- @gateway.names.should == %w(spam SPAM)
12
+ expect(@gateway.names).to eq(%w(spam SPAM))
14
13
  end
15
14
 
16
15
  it "は指定されたscreen_nameを通報する" do
17
16
  user = user(1,'examplespammer')
18
- @api.
19
- should_receive(:post).
17
+ expect(@api).
18
+ to receive(:post).
20
19
  with('report_spam',:screen_name=> 'examplespammer').
21
20
  and_return(user)
22
21
 
23
- @channel.should_receive(:notify).with("Report examplespammer as SPAMMER")
22
+ expect(@channel).to receive(:notify).with("Report examplespammer as SPAMMER")
24
23
  call "#twitter", 'spam', %w(examplespammer)
25
24
  end
26
25
  end
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/status'
5
4
 
6
5
  describe Atig::Command::Status do
@@ -10,56 +9,56 @@ describe Atig::Command::Status do
10
9
  end
11
10
 
12
11
  it "should have '/me status' name" do
13
- @gateway.names.should == ['status']
12
+ expect(@gateway.names).to eq(['status'])
14
13
  end
15
14
 
16
15
  it "should post the status by API" do
17
16
  res = status('blah blah')
18
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
19
- @api.should_receive(:post).with('statuses/update', {:status=>'blah blah'}).and_return(res)
17
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
18
+ expect(@api).to receive(:post).with('statuses/update', {status:'blah blah'}).and_return(res)
20
19
 
21
20
  call '#twitter', "status", %w(blah blah)
22
21
 
23
- @gateway.updated.should == [ res, '#twitter' ]
24
- @gateway.filtered.should == { :status => 'blah blah' }
22
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
23
+ expect(@gateway.filtered).to eq({ status: 'blah blah' })
25
24
  end
26
25
 
27
26
  it "should post with japanese language" do
28
27
  res = status("あ"*140)
29
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
30
- @api.should_receive(:post).with('statuses/update', {:status=>"あ"*140}).and_return(res)
28
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
29
+ expect(@api).to receive(:post).with('statuses/update', {status:"あ"*140}).and_return(res)
31
30
 
32
31
  call '#twitter', "status", ["あ" * 140]
33
32
 
34
- @gateway.updated.should == [ res, '#twitter' ]
35
- @gateway.filtered.should == { :status => "あ" * 140 }
33
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
34
+ expect(@gateway.filtered).to eq({ status: "あ" * 140 })
36
35
  end
37
36
 
38
37
  it "should post the status even if has long URL" do
39
38
  res = status("https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off")
40
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
41
- @api.should_receive(:post).with('statuses/update', {:status=>'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'}).and_return(res)
39
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
40
+ expect(@api).to receive(:post).with('statuses/update', {status:'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'}).and_return(res)
42
41
 
43
42
  call '#twitter', "status", ['https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off']
44
43
 
45
- @gateway.updated.should == [ res, '#twitter' ]
46
- @gateway.filtered.should == { :status => 'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'}
44
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
45
+ expect(@gateway.filtered).to eq({ status: 'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'})
47
46
  end
48
47
 
49
48
  it "should not post same post" do
50
49
  e = entry user(1,'mzp'), status('blah blah')
51
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return([ e ] )
52
- @channel.should_receive(:notify).with("You can't submit the same status twice in a row.")
50
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return([ e ] )
51
+ expect(@channel).to receive(:notify).with("You can't submit the same status twice in a row.")
53
52
 
54
53
  call '#twitter', "status", %w(blah blah)
55
- @gateway.notified.should == '#twitter'
54
+ expect(@gateway.notified).to eq('#twitter')
56
55
  end
57
56
 
58
57
  it "should not post over 140" do
59
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
60
- @channel.should_receive(:notify).with("You can't submit the status over 140 chars")
58
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
59
+ expect(@channel).to receive(:notify).with("You can't submit the status over 140 chars")
61
60
 
62
61
  call '#twitter', "status", [ 'a' * 141 ]
63
- @gateway.notified.should == '#twitter'
62
+ expect(@gateway.notified).to eq('#twitter')
64
63
  end
65
64
  end
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/thread'
5
4
 
6
5
  describe Atig::Command::Thread do
@@ -16,75 +15,75 @@ describe Atig::Command::Thread do
16
15
  ]
17
16
  @command = init Atig::Command::Thread
18
17
  @messages = []
19
- @channel.stub(:message).and_return{|entry,_|
18
+ allow(@channel).to receive(:message){|entry,_|
20
19
  @messages.unshift entry
21
20
  }
22
- @statuses.stub(:find_by_status_id).with(anything).and_return{|id|
21
+ allow(@statuses).to receive(:find_by_status_id).with(anything){|id|
23
22
  @entries[id.to_i]
24
23
  }
25
24
  end
26
25
 
27
26
  it "should provide thread command" do
28
- @gateway.names.should == %w( thread )
27
+ expect(@gateway.names).to eq(%w( thread ))
29
28
  end
30
29
 
31
30
  it "should show the tweet" do
32
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[0])
31
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[0])
33
32
 
34
33
  call "#twitter","thread",%w(a)
35
34
 
36
- @messages.should == [ @entries[0] ]
35
+ expect(@messages).to eq([ @entries[0] ])
37
36
  end
38
37
 
39
38
  it "should chain the tweets" do
40
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[1])
39
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[1])
41
40
 
42
41
  call "#twitter","thread",%w(a)
43
42
 
44
- @messages.should == @entries[1..3]
43
+ expect(@messages).to eq(@entries[1..3])
45
44
  end
46
45
 
47
46
  it "should chain the tweets by screen name" do
48
- @statuses.should_receive(:find_by_tid).with('mzp').and_return(nil)
49
- @statuses.should_receive(:find_by_sid).with('mzp').and_return(nil)
50
- @statuses.should_receive(:find_by_screen_name).with('mzp',:limit=>1).and_return([ @entries[1] ])
47
+ expect(@statuses).to receive(:find_by_tid).with('mzp').and_return(nil)
48
+ expect(@statuses).to receive(:find_by_sid).with('mzp').and_return(nil)
49
+ expect(@statuses).to receive(:find_by_screen_name).with('mzp',:limit=>1).and_return([ @entries[1] ])
51
50
 
52
51
  call "#twitter","thread",%w(mzp)
53
52
 
54
- @messages.should == @entries[1..3]
53
+ expect(@messages).to eq(@entries[1..3])
55
54
  end
56
55
 
57
56
  it "should chain the tweets by sid" do
58
- @statuses.should_receive(:find_by_tid).with('mzp:a').and_return(nil)
59
- @statuses.should_receive(:find_by_sid).with('mzp:a').and_return(@entries[1])
57
+ expect(@statuses).to receive(:find_by_tid).with('mzp:a').and_return(nil)
58
+ expect(@statuses).to receive(:find_by_sid).with('mzp:a').and_return(@entries[1])
60
59
 
61
60
  call "#twitter","thread",%w(mzp:a)
62
61
 
63
- @messages.should == @entries[1..3]
62
+ expect(@messages).to eq(@entries[1..3])
64
63
  end
65
64
 
66
65
 
67
66
 
68
67
  it "should chain the tweets with limit" do
69
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[1])
68
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[1])
70
69
 
71
70
  call "#twitter","thread",%w(a 2)
72
71
 
73
- @messages.should == @entries[1..2]
72
+ expect(@messages).to eq(@entries[1..2])
74
73
  end
75
74
 
76
75
  it "should get new tweets" do
77
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[4])
76
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[4])
78
77
  user = user 1, 'mzp'
79
78
  status = status '','user'=>user
80
79
  entry = entry user,status,'new-entry'
81
- @statuses.should_receive(:add).with(:status => status, :user => user, :source=>:thread).and_return{
80
+ expect(@statuses).to receive(:add).with(status: status, user: user, source: :thread){
82
81
  @entries << entry
83
82
  }
84
- @api.should_receive(:get).with('statuses/show/5').and_return(status)
83
+ expect(@api).to receive(:get).with('statuses/show/5').and_return(status)
85
84
 
86
85
  call "#twitter","thread",%w(a)
87
86
 
88
- @messages.should == [@entries[4], entry]
87
+ expect(@messages).to eq([@entries[4], entry])
89
88
  end
90
89
  end
@@ -1,6 +1,5 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/time'
5
4
 
6
5
  describe Atig::Command::Time do
@@ -8,8 +7,8 @@ describe Atig::Command::Time do
8
7
 
9
8
  def user(offset, tz)
10
9
  u = double "user-#{offset}"
11
- u.stub(:utc_offset).and_return(offset)
12
- u.stub(:time_zone).and_return(tz)
10
+ allow(u).to receive(:utc_offset).and_return(offset)
11
+ allow(u).to receive(:time_zone).and_return(tz)
13
12
  u
14
13
  end
15
14
 
@@ -19,33 +18,31 @@ describe Atig::Command::Time do
19
18
  end
20
19
 
21
20
  it "should provide time command" do
22
- @gateway.names.should == ['time']
21
+ expect(@gateway.names).to eq(['time'])
23
22
  end
24
23
 
25
24
  it "should show offset time on DB" do
26
- ::Time.should_receive(:now).and_return(Time.at(0))
27
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(@user)
28
- @channel.
29
- should_receive(:message).
30
- with(anything, Net::IRC::Constants::NOTICE).
31
- and_return{|s,_|
32
- s.status.text.should == "\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01"
25
+ expect(::Time).to receive(:now).and_return(Time.at(0))
26
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
27
+ expect(@channel).
28
+ to receive(:message).
29
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
30
+ expect(s.status.text).to eq("\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01")
33
31
  }
34
32
  call '#twitter', 'time', ['mzp']
35
- @gateway.notified.should == '#twitter'
33
+ expect(@gateway.notified).to eq('#twitter')
36
34
  end
37
35
 
38
36
  it "should show offset time via API" do
39
- ::Time.should_receive(:now).and_return(Time.at(0))
40
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(nil)
41
- @api.should_receive(:get).with('users/show', :screen_name=>'mzp').and_return(@user)
42
- @channel.
43
- should_receive(:message).
44
- with(anything, Net::IRC::Constants::NOTICE).
45
- and_return{|s,_|
46
- s.status.text.should == "\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01"
37
+ expect(::Time).to receive(:now).and_return(Time.at(0))
38
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(nil)
39
+ expect(@api).to receive(:get).with('users/show', screen_name:'mzp').and_return(@user)
40
+ expect(@channel).
41
+ to receive(:message).
42
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
43
+ expect(s.status.text).to eq("\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01")
47
44
  }
48
45
  call '#twitter', 'time', ['mzp']
49
- @gateway.notified.should == '#twitter'
46
+ expect(@gateway.notified).to eq('#twitter')
50
47
  end
51
48
  end