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,54 +1,53 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/command/uptime'
5
4
 
6
5
  describe Atig::Command::Uptime do
7
6
  include CommandHelper
8
7
 
9
8
  before do
10
- ::Time.should_receive(:now).and_return(::Time.at(0))
9
+ expect(::Time).to receive(:now).and_return(::Time.at(0))
11
10
  @command = init Atig::Command::Uptime
12
11
  end
13
12
 
14
13
  it "should register uptime command" do
15
- @gateway.names.should == ['uptime']
14
+ expect(@gateway.names).to eq(['uptime'])
16
15
  end
17
16
 
18
17
  it "should return mm:ss(min)" do
19
- ::Time.should_receive(:now).and_return(::Time.at(0))
20
- @channel.should_receive(:notify).with("00:00")
18
+ expect(::Time).to receive(:now).and_return(::Time.at(0))
19
+ expect(@channel).to receive(:notify).with("00:00")
21
20
  call '#twitter', 'uptime', []
22
21
 
23
- @gateway.notified.should == '#twitter'
22
+ expect(@gateway.notified).to eq('#twitter')
24
23
  end
25
24
 
26
25
  it "should return mm:ss(max)" do
27
- ::Time.should_receive(:now).and_return(::Time.at(60*60-1))
28
- @channel.should_receive(:notify).with("59:59")
26
+ expect(::Time).to receive(:now).and_return(::Time.at(60*60-1))
27
+ expect(@channel).to receive(:notify).with("59:59")
29
28
  call '#twitter', 'uptime', []
30
29
 
31
- @gateway.notified.should == '#twitter'
30
+ expect(@gateway.notified).to eq('#twitter')
32
31
  end
33
32
 
34
33
  it "should return hh:mm:ss(min)" do
35
- ::Time.should_receive(:now).and_return(::Time.at(60*60))
36
- @channel.should_receive(:notify).with("01:00:00")
34
+ expect(::Time).to receive(:now).and_return(::Time.at(60*60))
35
+ expect(@channel).to receive(:notify).with("01:00:00")
37
36
  call '#twitter', 'uptime', []
38
- @gateway.notified.should == '#twitter'
37
+ expect(@gateway.notified).to eq('#twitter')
39
38
  end
40
39
 
41
40
  it "should return hh:mm:ss(max)" do
42
- ::Time.should_receive(:now).and_return(::Time.at(24*60*60-1))
43
- @channel.should_receive(:notify).with("23:59:59")
41
+ expect(::Time).to receive(:now).and_return(::Time.at(24*60*60-1))
42
+ expect(@channel).to receive(:notify).with("23:59:59")
44
43
  call '#twitter', 'uptime', []
45
- @gateway.notified.should == '#twitter'
44
+ expect(@gateway.notified).to eq('#twitter')
46
45
  end
47
46
 
48
47
  it "should return dd days hh:mm:ss" do
49
- ::Time.should_receive(:now).and_return(::Time.at(24*60*60))
50
- @channel.should_receive(:notify).with("1 days 00:00")
48
+ expect(::Time).to receive(:now).and_return(::Time.at(24*60*60))
49
+ expect(@channel).to receive(:notify).with("1 days 00:00")
51
50
  call '#twitter', 'uptime', []
52
- @gateway.notified.should == '#twitter'
51
+ expect(@gateway.notified).to eq('#twitter')
53
52
  end
54
53
  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/user_info'
5
4
 
6
5
  describe Atig::Command::UserInfo do
@@ -10,30 +9,28 @@ describe Atig::Command::UserInfo do
10
9
  @command = init Atig::Command::UserInfo
11
10
  @status = double "status"
12
11
  @user = double "user"
13
- @user.stub(:description).and_return('hogehoge')
14
- @user.stub(:status).and_return(@status)
12
+ allow(@user).to receive(:description).and_return('hogehoge')
13
+ allow(@user).to receive(:status).and_return(@status)
15
14
  end
16
15
 
17
16
  it "should show the source via DB" do
18
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(@user)
19
- @channel.
20
- should_receive(:message).
21
- with(anything, Net::IRC::Constants::NOTICE).
22
- and_return{|s,_|
23
- s.status.text.should == "\x01hogehoge\x01"
17
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
18
+ expect(@channel).
19
+ to receive(:message).
20
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
21
+ expect(s.status.text).to eq("\x01hogehoge\x01")
24
22
  }
25
23
  call '#twitter','userinfo',%w(mzp)
26
24
  end
27
25
 
28
26
  it "should show the source via API" do
29
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(nil)
30
- @api.should_receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
27
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(nil)
28
+ expect(@api).to receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
31
29
 
32
- @channel.
33
- should_receive(:message).
34
- with(anything, Net::IRC::Constants::NOTICE).
35
- and_return{|s,_|
36
- s.status.text.should == "\x01hogehoge\x01"
30
+ expect(@channel).
31
+ to receive(:message).
32
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
33
+ expect(s.status.text).to eq("\x01hogehoge\x01")
37
34
  }
38
35
 
39
36
  call '#twitter','userinfo',%w(mzp)
@@ -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/user'
5
4
 
6
5
  describe Atig::Command::User do
@@ -10,23 +9,23 @@ describe Atig::Command::User do
10
9
  end
11
10
 
12
11
  it "should have '/me status' name" do
13
- @gateway.names.should == ['user', 'u']
12
+ expect(@gateway.names).to eq(['user', 'u'])
14
13
  end
15
14
 
16
15
  it "should" do
17
16
  foo = entry user(1,'mzp'),status('foo')
18
17
  bar = entry user(1,'mzp'),status('bar')
19
18
  baz = entry user(1,'mzp'),status('baz')
20
- @api.
21
- should_receive(:get).
19
+ expect(@api).
20
+ to receive(:get).
22
21
  with('statuses/user_timeline',:count=>20,:screen_name=>'mzp').
23
22
  and_return([foo, bar, baz])
24
- @statuses.should_receive(:add).with(any_args).at_least(3)
25
- @statuses.
26
- should_receive(:find_by_screen_name).
23
+ expect(@statuses).to receive(:add).with(any_args).at_least(3)
24
+ expect(@statuses).
25
+ to receive(:find_by_screen_name).
27
26
  with('mzp',:limit=>20).
28
27
  and_return([foo, bar, baz])
29
- @channel.should_receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
28
+ expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
30
29
  call "#twitter","user",%w(mzp)
31
30
  end
32
31
 
@@ -34,16 +33,16 @@ describe Atig::Command::User do
34
33
  foo = entry user(1,'mzp'),status('foo')
35
34
  bar = entry user(1,'mzp'),status('bar')
36
35
  baz = entry user(1,'mzp'),status('baz')
37
- @api.
38
- should_receive(:get).
36
+ expect(@api).
37
+ to receive(:get).
39
38
  with('statuses/user_timeline',:count=>200,:screen_name=>'mzp').
40
39
  and_return([foo, bar, baz])
41
- @statuses.should_receive(:add).with(any_args).at_least(3)
42
- @statuses.
43
- should_receive(:find_by_screen_name).
40
+ expect(@statuses).to receive(:add).with(any_args).at_least(3)
41
+ expect(@statuses).
42
+ to receive(:find_by_screen_name).
44
43
  with('mzp',:limit=>200).
45
44
  and_return([foo, bar, baz])
46
- @channel.should_receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
45
+ expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
47
46
  call "#twitter","user",%w(mzp 200)
48
47
  end
49
48
  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/version'
5
4
 
6
5
  describe Atig::Command::Version do
@@ -9,56 +8,53 @@ describe Atig::Command::Version do
9
8
  before do
10
9
  @command = init Atig::Command::Version
11
10
  @status = double "status"
12
- @status.stub(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
11
+ allow(@status).to receive(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
13
12
  @user = double "user"
14
- @user.stub(:status).and_return(@status)
13
+ allow(@user).to receive(:status).and_return(@status)
15
14
  end
16
15
 
17
16
  it "should provide version command" do
18
- @gateway.names.should == ['version']
17
+ expect(@gateway.names).to eq(['version'])
19
18
  end
20
19
 
21
20
  it "should show the source via DB" do
22
- @statuses.
23
- should_receive(:find_by_screen_name).
21
+ expect(@statuses).
22
+ to receive(:find_by_screen_name).
24
23
  with('mzp',:limit => 1).
25
24
  and_return([ entry(@user,@status) ])
26
- @channel.
27
- should_receive(:message).
28
- with(anything, Net::IRC::Constants::NOTICE).
29
- and_return{|s,_|
30
- s.status.text.should == "\x01Echofon <http://echofon.com/>\x01"
25
+ expect(@channel).
26
+ to receive(:message).
27
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
28
+ expect(s.status.text).to eq("\x01Echofon <http://echofon.com/>\x01")
31
29
  }
32
30
  call '#twitter','version',%w(mzp)
33
31
  end
34
32
 
35
33
  it "should show the source of web" do
36
34
  status = double "status"
37
- status.stub(:source).and_return('web')
38
- @statuses.
39
- should_receive(:find_by_screen_name).
35
+ allow(status).to receive(:source).and_return('web')
36
+ expect(@statuses).
37
+ to receive(:find_by_screen_name).
40
38
  with('mzp',:limit => 1).
41
39
  and_return([ entry(@user,status) ])
42
- @channel.
43
- should_receive(:message).
44
- with(anything, Net::IRC::Constants::NOTICE).
45
- and_return{|s,_|
46
- s.status.text.should == "\x01web\x01"
40
+ expect(@channel).
41
+ to receive(:message).
42
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
43
+ expect(s.status.text).to eq("\x01web\x01")
47
44
  }
48
45
  call '#twitter','version',%w(mzp)
49
46
  end
50
47
 
51
48
  it "should show the source via API" do
52
- @statuses.stub(:find_by_screen_name).and_return(@status)
53
- @statuses.should_receive(:find_by_screen_name).with('mzp',:limit => 1).and_return(nil)
54
- @statuses.should_receive(:add).with(:status => @status, :user => @user, :source=>:version)
55
- @api.should_receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
56
-
57
- @channel.
58
- should_receive(:message).
59
- with(anything, Net::IRC::Constants::NOTICE).
60
- and_return{|s,_|
61
- s.status.text.should == "\x01Echofon <http://echofon.com/>\x01"
49
+ allow(@statuses).to receive(:find_by_screen_name).and_return(@status)
50
+ expect(@statuses).to receive(:find_by_screen_name).with('mzp',:limit => 1).and_return(nil)
51
+ expect(@statuses).to receive(:add).with(status: @status, user: @user, source: :version)
52
+ expect(@api).to receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
53
+
54
+ expect(@channel).
55
+ to receive(:message).
56
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
57
+ expect(s.status.text).to eq("\x01Echofon <http://echofon.com/>\x01")
62
58
  }
63
59
 
64
60
  call '#twitter','version',%w(mzp)
@@ -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/whois'
5
4
  require 'atig/command/info'
6
5
 
@@ -17,61 +16,61 @@ describe Atig::Command::Whois do
17
16
  before do
18
17
  @command = init Atig::Command::Whois
19
18
  @status = double 'status'
20
- @status.stub(:created_at).and_return(time(::Time.at(42)))
19
+ allow(@status).to receive(:created_at).and_return(time(::Time.at(42)))
21
20
  @user = double "user"
22
- @user.stub(:name) .and_return('name')
23
- @user.stub(:id) .and_return('10')
24
- @user.stub(:screen_name).and_return('screen_name')
25
- @user.stub(:description).and_return('blah blah')
26
- @user.stub(:protected) .and_return(false)
27
- @user.stub(:location) .and_return('Tokyo, Japan')
28
- @user.stub(:created_at) .and_return(time(::Time.at(0)))
29
- @user.stub(:status) .and_return(@status)
21
+ allow(@user).to receive(:name) .and_return('name')
22
+ allow(@user).to receive(:id) .and_return('10')
23
+ allow(@user).to receive(:screen_name).and_return('screen_name')
24
+ allow(@user).to receive(:description).and_return('blah blah')
25
+ allow(@user).to receive(:protected) .and_return(false)
26
+ allow(@user).to receive(:location) .and_return('Tokyo, Japan')
27
+ allow(@user).to receive(:created_at) .and_return(time(::Time.at(0)))
28
+ allow(@user).to receive(:status) .and_return(@status)
30
29
 
31
- ::Time.stub(:now).and_return(::Time.at(50))
32
- @followings.stub(:find_by_screen_name).with('mzp').and_return(@user)
30
+ allow(::Time).to receive(:now).and_return(::Time.at(50))
31
+ allow(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
33
32
  end
34
33
 
35
34
  it "should proide whois command" do
36
- @command.command_name.should == %w(whois)
35
+ expect(@command.command_name).to eq(%w(whois))
37
36
  end
38
37
 
39
38
  it "should show profile" do
40
39
  commands = []
41
- @gateway.should_receive(:post){|_,command,_,_,*params|
40
+ expect(@gateway).to receive(:post){|_,command,_,_,*params|
42
41
  commands << command
43
42
  case command
44
43
  when RPL_WHOISUSER
45
- params.should == ['id=10', 'twitter.com', "*", 'name / blah blah']
44
+ expect(params).to eq(['id=10', 'twitter.com', "*", 'name / blah blah'])
46
45
  when RPL_WHOISSERVER
47
- params.should == ['twitter.com', 'Tokyo, Japan']
46
+ expect(params).to eq(['twitter.com', 'Tokyo, Japan'])
48
47
  when RPL_WHOISIDLE
49
- params.should == ["8", "0", "seconds idle, signon time"]
48
+ expect(params).to eq(["8", "0", "seconds idle, signon time"])
50
49
  when RPL_ENDOFWHOIS
51
- params.should == ["End of WHOIS list"]
50
+ expect(params).to eq(["End of WHOIS list"])
52
51
  end
53
52
  }.at_least(4)
54
53
  call '#twitter','whois',%w(mzp)
55
- commands.should == [ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS]
54
+ expect(commands).to eq([ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS])
56
55
  end
57
56
 
58
57
  it "should append /protect if the user is protected" do
59
- @user.stub(:protected).and_return(true)
58
+ allow(@user).to receive(:protected).and_return(true)
60
59
  commands = []
61
- @gateway.should_receive(:post){|_,command,_,_,*params|
60
+ expect(@gateway).to receive(:post){|_,command,_,_,*params|
62
61
  commands << command
63
62
  case command
64
63
  when RPL_WHOISUSER
65
- params.should == ['id=10', 'twitter.com/protected', "*", 'name / blah blah']
64
+ expect(params).to eq(['id=10', 'twitter.com/protected', "*", 'name / blah blah'])
66
65
  when RPL_WHOISSERVER
67
- params.should == ['twitter.com/protected', 'Tokyo, Japan']
66
+ expect(params).to eq(['twitter.com/protected', 'Tokyo, Japan'])
68
67
  when RPL_WHOISIDLE
69
- params.should == ["8", "0", "seconds idle, signon time"]
68
+ expect(params).to eq(["8", "0", "seconds idle, signon time"])
70
69
  when RPL_ENDOFWHOIS
71
- params.should == ["End of WHOIS list"]
70
+ expect(params).to eq(["End of WHOIS list"])
72
71
  end
73
72
  }.at_least(4)
74
73
  call '#twitter','whois',%w(mzp)
75
- commands.should == [ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS]
74
+ expect(commands).to eq([ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS])
76
75
  end
77
76
  end
@@ -66,7 +66,7 @@ module CommandHelper
66
66
  def init(klass)
67
67
  @log = double 'log'
68
68
  @opts = Atig::Option.new({})
69
- context = OpenStruct.new :log=>@log, :opts=>@opts
69
+ context = OpenStruct.new log:@log, opts:@opts
70
70
 
71
71
  @channel = double 'channel'
72
72
  @gateway = FakeGateway.new @channel
@@ -88,7 +88,7 @@ module CommandHelper
88
88
  end
89
89
 
90
90
  def stub_status(key, hash)
91
- @statuses.stub(key).and_return{|arg,*_|
91
+ allow(@statuses).to receive(key){|arg,*_|
92
92
  hash.fetch(arg, hash[:default])
93
93
  }
94
94
  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/db/followings'
5
4
 
6
5
  describe Atig::Db::Followings,"when it is empty" do
@@ -14,13 +13,13 @@ describe Atig::Db::Followings,"when it is empty" do
14
13
  end
15
14
 
16
15
  it "should be emtpy" do
17
- @db.empty?.should be_true
16
+ expect(@db.empty?).to be_truthy
18
17
  end
19
18
  end
20
19
 
21
20
  describe Atig::Db::Followings,"when updated users" do
22
21
  def user(id, name, protect, only)
23
- OpenStruct.new(:id => id, :screen_name=>name, :protected=>protect, :only=>only)
22
+ OpenStruct.new(id: id, screen_name:name, protected:protect, only:only)
24
23
  end
25
24
 
26
25
  before do
@@ -43,7 +42,7 @@ describe Atig::Db::Followings,"when updated users" do
43
42
  end
44
43
 
45
44
  it "should return size" do
46
- @db.size.should == 2
45
+ expect(@db.size).to eq(2)
47
46
  end
48
47
 
49
48
  it "should be invalidated" do
@@ -53,56 +52,56 @@ describe Atig::Db::Followings,"when updated users" do
53
52
  end
54
53
  @db.invalidate
55
54
 
56
- called.should be_true
55
+ expect(called).to be_truthy
57
56
  end
58
57
 
59
58
  it "should not empty" do
60
- @db.empty?.should be_false
59
+ expect(@db.empty?).to be_falsey
61
60
  end
62
61
 
63
62
  it "should call listener with :join" do
64
63
  @db.update [ @alice, @bob, @charriey ]
65
- @listen[:join].should == [ @charriey ]
66
- @listen[:part].should == nil
67
- @listen[:mode].should == nil
64
+ expect(@listen[:join]).to eq([ @charriey ])
65
+ expect(@listen[:part]).to eq(nil)
66
+ expect(@listen[:mode]).to eq(nil)
68
67
  end
69
68
 
70
69
  it "should call listener with :part" do
71
70
  @db.update [ @alice ]
72
- @listen[:join].should == nil
73
- @listen[:part].should == [ @bob ]
74
- @listen[:mode].should == nil
71
+ expect(@listen[:join]).to eq(nil)
72
+ expect(@listen[:part]).to eq([ @bob ])
73
+ expect(@listen[:mode]).to eq(nil)
75
74
  end
76
75
 
77
76
  it "should not found removed user[BUG]" do
78
- @db.include?(@bob).should == true
77
+ expect(@db.include?(@bob)).to eq(true)
79
78
  @db.update [ @alice ]
80
79
  # now, @bob is not member
81
- @db.include?(@bob).should == false
80
+ expect(@db.include?(@bob)).to eq(false)
82
81
  end
83
82
 
84
83
  it "should call listener with :mode" do
85
84
  bob = user 5,'bob', false, false
86
85
 
87
86
  @db.update [ @alice, bob ]
88
- @listen[:join].should == nil
89
- @listen[:part].should == nil
90
- @listen[:mode].should == [ bob ]
87
+ expect(@listen[:join]).to eq(nil)
88
+ expect(@listen[:part]).to eq(nil)
89
+ expect(@listen[:mode]).to eq([ bob ])
91
90
  end
92
91
 
93
92
  it "should have users" do
94
- @db.users.should == [ @alice, @bob ]
93
+ expect(@db.users).to eq([ @alice, @bob ])
95
94
  end
96
95
 
97
96
  it "should be found by screen_name" do
98
- @db.find_by_screen_name('alice').should == @alice
99
- @db.find_by_screen_name('???').should == nil
97
+ expect(@db.find_by_screen_name('alice')).to eq(@alice)
98
+ expect(@db.find_by_screen_name('???')).to eq(nil)
100
99
  end
101
100
 
102
101
  it "should check include" do
103
102
  alice = user @alice.id,'alice', true, true
104
- @db.include?(@charriey).should be_false
105
- @db.include?(@alice).should be_true
106
- @db.include?(alice).should be_true
103
+ expect(@db.include?(@charriey)).to be_falsey
104
+ expect(@db.include?(@alice)).to be_truthy
105
+ expect(@db.include?(alice)).to be_truthy
107
106
  end
108
107
  end