atig 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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/ifilter/retweet'
5
4
  require 'atig/twitter_struct'
6
5
 
@@ -14,15 +13,15 @@ describe Atig::IFilter::Retweet do
14
13
  end
15
14
 
16
15
  it "should throw normal status" do
17
- filtered("hello").should be_text("hello")
16
+ expect(filtered("hello")).to be_text("hello")
18
17
  end
19
18
 
20
19
  it "should prefix RT for Retweet" do
21
- filtered("RT: hello...",
20
+ expect(filtered("RT: hello...",
22
21
  'retweeted_status'=>{ 'text' => 'hello',
23
22
  'user' => {
24
23
  'screen_name' => 'mzp'
25
- } }).
26
- should be_text("#{@rt}RT @mzp: hello")
24
+ } })).
25
+ to be_text("#{@rt}RT @mzp: hello")
27
26
  end
28
27
  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/ifilter/retweet_time'
5
4
  require 'atig/twitter_struct'
6
5
 
@@ -10,16 +9,16 @@ describe Atig::IFilter::RetweetTime do
10
9
  end
11
10
 
12
11
  it "should throw normal status" do
13
- filtered("hello").should be_text("hello")
12
+ expect(filtered("hello")).to be_text("hello")
14
13
  end
15
14
 
16
15
  it "should prefix RT for Retweet" do
17
- filtered("RT @mzp: hello",
16
+ expect(filtered("RT @mzp: hello",
18
17
  'retweeted_status'=>{ 'text' => 'hello',
19
18
  'created_at' => 'Sat Sep 25 14:33:19 +0000 2010',
20
19
  'user' => {
21
20
  'screen_name' => 'mzp'
22
- } }).
23
- should be_text("#{@rt}RT @mzp: hello \x0310[2010-09-25 23:33]\x0F")
21
+ } })).
22
+ to be_text("#{@rt}RT @mzp: hello \x0310[2010-09-25 14:33]\x0F")
24
23
  end
25
24
  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/ifilter/sanitize'
5
4
  require 'atig/twitter_struct'
6
5
 
@@ -10,16 +9,16 @@ describe Atig::IFilter::Sanitize do
10
9
  end
11
10
 
12
11
  it "should convert escape html" do
13
- filtered("&lt; &gt; &quot;").should be_text("< > \"")
12
+ expect(filtered("&lt; &gt; &quot;")).to be_text("< > \"")
14
13
  end
15
14
 
16
15
  it "should convert whitespace" do
17
- filtered("\r\n").should be_text(" ")
18
- filtered("\r").should be_text(" ")
19
- filtered("\n").should be_text(" ")
16
+ expect(filtered("\r\n")).to be_text(" ")
17
+ expect(filtered("\r")).to be_text(" ")
18
+ expect(filtered("\n")).to be_text(" ")
20
19
  end
21
20
 
22
21
  it "should delete \\000\\001 sequence" do
23
- filtered("\000\001").should be_text("")
22
+ expect(filtered("\000\001")).to be_text("")
24
23
  end
25
24
  end
@@ -1,29 +1,28 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/ifilter/xid'
5
4
  require 'atig/twitter_struct'
6
5
 
7
6
  describe Atig::IFilter::Sid, "when disable tid" do
8
7
  def filtered(text)
9
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
10
- :opts=>OpenStruct.new))
8
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(log:double('log'),
9
+ opts:OpenStruct.new))
11
10
  ifilter.call status(text,'sid'=>1)
12
11
  end
13
12
 
14
13
  it "should through text" do
15
- filtered("hello").should be_text("hello")
14
+ expect(filtered("hello")).to be_text("hello")
16
15
  end
17
16
  end
18
17
 
19
18
  describe Atig::IFilter::Sid, "when enable tid" do
20
19
  def filtered(text)
21
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
22
- :opts=>OpenStruct.new(:sid=>true)))
20
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(log:double('log'),
21
+ opts:OpenStruct.new(sid:true)))
23
22
  ifilter.call status(text,'sid'=>1)
24
23
  end
25
24
 
26
25
  it "should append sid" do
27
- filtered("hello").should be_text("hello \x0310[1]\x0F")
26
+ expect(filtered("hello")).to be_text("hello \x0310[1]\x0F")
28
27
  end
29
28
  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/ifilter/strip'
5
4
  require 'atig/twitter_struct'
6
5
 
@@ -10,14 +9,14 @@ describe Atig::IFilter::Strip do
10
9
  end
11
10
 
12
11
  it "should strip *tw*" do
13
- @ifilter.call(status("hoge *tw*")).should be_text("hoge")
12
+ expect(@ifilter.call(status("hoge *tw*"))).to be_text("hoge")
14
13
  end
15
14
 
16
15
  it "should strip _" do
17
- @ifilter.call(status("hoge _")).should be_text("hoge")
16
+ expect(@ifilter.call(status("hoge _"))).to be_text("hoge")
18
17
  end
19
18
 
20
19
  it "should strip white-space" do
21
- @ifilter.call(status(" hoge ")).should be_text("hoge")
20
+ expect(@ifilter.call(status(" hoge "))).to be_text("hoge")
22
21
  end
23
22
  end
@@ -1,29 +1,28 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/ifilter/xid'
5
4
  require 'atig/twitter_struct'
6
5
 
7
6
  describe Atig::IFilter::Tid, "when disable tid" do
8
7
  def filtered(text)
9
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
10
- :opts=>OpenStruct.new))
8
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(log:double('log'),
9
+ opts:OpenStruct.new))
11
10
  ifilter.call status(text,'tid'=>1)
12
11
  end
13
12
 
14
13
  it "should through text" do
15
- filtered("hello").should be_text("hello")
14
+ expect(filtered("hello")).to be_text("hello")
16
15
  end
17
16
  end
18
17
 
19
18
  describe Atig::IFilter::Tid, "when enable tid" do
20
19
  def filtered(text)
21
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
22
- :opts=>OpenStruct.new(:tid=>true)))
20
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(log:double('log'),
21
+ opts:OpenStruct.new(tid:true)))
23
22
  ifilter.call status(text,'tid'=>1)
24
23
  end
25
24
 
26
25
  it "should append tid" do
27
- filtered("hello").should be_text("hello \x0310[1]\x0F")
26
+ expect(filtered("hello")).to be_text("hello \x0310[1]\x0F")
28
27
  end
29
28
  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/levenshtein'
5
4
 
6
5
  target = [Atig::Levenshtein, Atig::Levenshtein::PureRuby]
@@ -16,8 +15,8 @@ target.each do |m|
16
15
  ["", "foo", 3],
17
16
  ["あああ", "ああい", 1],
18
17
  ].each do |a, b, expected|
19
- m.levenshtein(a.split(//), b.split(//)).should == expected
20
- m.levenshtein(b.split(//), a.split(//)).should == expected
18
+ expect(m.levenshtein(a.split(//), b.split(//))).to eq(expected)
19
+ expect(m.levenshtein(b.split(//), a.split(//))).to eq(expected)
21
20
  end
22
21
  end
23
22
  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/ofilter/escape_url'
5
4
 
6
5
  class Atig::OFilter::EscapeUrl
@@ -10,22 +9,22 @@ end
10
9
  describe Atig::OFilter::EscapeUrl do
11
10
  before do
12
11
  @logger = double('Logger')
13
- @logger.should_receive(:info).at_most(:once)
14
- @logger.should_receive(:error).at_most(:once)
15
- @logger.should_receive(:debug).at_most(:once)
12
+ expect(@logger).to receive(:info).at_most(:once)
13
+ expect(@logger).to receive(:error).at_most(:once)
14
+ expect(@logger).to receive(:debug).at_most(:once)
16
15
  end
17
16
 
18
17
  def filtered(text,opt={})
19
- esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(:log=>@logger,:opts=>nil))
20
- esc.call :status => text
18
+ esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(log:@logger,:opts=>nil))
19
+ esc.call status: text
21
20
  end
22
21
 
23
22
  it "through normal url" do
24
- filtered("http://example.com").should == { :status => "http://example.com"}
23
+ expect(filtered("http://example.com")).to eq({ status: "http://example.com"})
25
24
  end
26
25
 
27
26
  it "escape only url" do
28
- filtered("あああ http://example.com/あああ").should == { :status => "あああ http://example.com/%E3%81%82%E3%81%82%E3%81%82" }
27
+ expect(filtered("あああ http://example.com/あああ")).to eq({ status: "あああ http://example.com/%E3%81%82%E3%81%82%E3%81%82" })
29
28
  end
30
29
  end
31
30
 
@@ -33,18 +32,18 @@ if defined? ::Punycode then
33
32
  describe Atig::OFilter::EscapeUrl,"when punycode is enabled" do
34
33
  before do
35
34
  @logger = double('Logger')
36
- @logger.should_receive(:info).at_most(:once)
37
- @logger.should_receive(:error).at_most(:once)
38
- @logger.should_receive(:debug).at_most(:once)
35
+ expect(@logger).to receive(:info).at_most(:once)
36
+ expect(@logger).to receive(:error).at_most(:once)
37
+ expect(@logger).to receive(:debug).at_most(:once)
39
38
  end
40
39
 
41
40
  def filtered(text,opt={})
42
- esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(:log=>@logger,:opts=>nil))
43
- esc.call :status => text
41
+ esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(log:@logger,:opts=>nil))
42
+ esc.call status: text
44
43
  end
45
44
 
46
45
  it "escape international URL" do
47
- filtered("http://あああ.com").should == {:status => "http://xn--l8jaa.com" }
46
+ expect(filtered("http://あああ.com")).to eq({status: "http://xn--l8jaa.com" })
48
47
  end
49
48
  end
50
49
  end
@@ -1,32 +1,31 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/ofilter/footer'
5
4
  require 'ostruct'
6
5
 
7
6
  describe Atig::OFilter::Footer do
8
7
  before do
9
8
  @opts = OpenStruct.new
10
- @filter = Atig::OFilter::Footer.new(OpenStruct.new(:opts=>@opts))
9
+ @filter = Atig::OFilter::Footer.new(OpenStruct.new(opts:@opts))
11
10
  end
12
11
 
13
12
  it "should pass through" do
14
- @filter.call(:status => 'hi').should == {
15
- :status => "hi"
16
- }
13
+ expect(@filter.call(status: 'hi')).to eq({
14
+ status: "hi"
15
+ })
17
16
  end
18
17
 
19
18
  it "should append footer" do
20
19
  @opts.footer = '*tw*'
21
- @filter.call(:status => 'hi').should == {
22
- :status => "hi *tw*"
23
- }
20
+ expect(@filter.call(status: 'hi')).to eq({
21
+ status: "hi *tw*"
22
+ })
24
23
  end
25
24
 
26
25
  it "should not append footer" do
27
26
  @opts.footer = false
28
- @filter.call(:status => 'hi').should == {
29
- :status => "hi"
30
- }
27
+ expect(@filter.call(status: 'hi')).to eq({
28
+ status: "hi"
29
+ })
31
30
  end
32
31
  end
@@ -1,33 +1,32 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/ofilter/geo'
5
4
  require 'ostruct'
6
5
 
7
6
  describe Atig::OFilter::Geo,"when disabled" do
8
7
  def filtered(text,opt={})
9
- geo = Atig::OFilter::Geo.new(OpenStruct.new(:opts=>OpenStruct.new(opt)))
10
- geo.call :status => text
8
+ geo = Atig::OFilter::Geo.new(OpenStruct.new(opts:OpenStruct.new(opt)))
9
+ geo.call status: text
11
10
  end
12
11
 
13
12
  it "should through" do
14
- filtered("hi").should == {
15
- :status => "hi"
16
- }
13
+ expect(filtered("hi")).to eq({
14
+ status: "hi"
15
+ })
17
16
  end
18
17
  end
19
18
 
20
19
  describe Atig::OFilter::Geo,"when enabled" do
21
20
  def filtered(text,opt={})
22
- geo = Atig::OFilter::Geo.new(OpenStruct.new(:opts=>OpenStruct.new(opt)))
23
- geo.call :status => text
21
+ geo = Atig::OFilter::Geo.new(OpenStruct.new(opts:OpenStruct.new(opt)))
22
+ geo.call status: text
24
23
  end
25
24
 
26
25
  it "add lat & long" do
27
- filtered("hi",:ll=>"42.1,43.1").should == {
28
- :status => "hi",
29
- :lat => 42.1,
30
- :long => 43.1
31
- }
26
+ expect(filtered("hi",:ll=>"42.1,43.1")).to eq({
27
+ status: "hi",
28
+ lat: 42.1,
29
+ long: 43.1
30
+ })
32
31
  end
33
32
  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/ofilter/short_url'
5
4
  require 'ostruct'
6
5
 
@@ -8,17 +7,17 @@ describe Atig::OFilter::ShortUrl,"when no-login bitly" do
8
7
  before do
9
8
  logger = double('Logger')
10
9
  bitly = double("Bitly")
11
- bitly.stub(:shorten).and_return{|s|
10
+ allow(bitly).to receive(:shorten){|s|
12
11
  "[#{s}]"
13
12
  }
14
- Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
15
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>true)))
13
+ expect(Atig::Bitly).to receive(:no_login).with(logger).and_return(bitly)
14
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>true)))
16
15
  end
17
16
 
18
17
  it "should shorten url by bitly" do
19
- @ofilter.call({:status => "this is http://example.com/a http://example.com/b"}).should == {
20
- :status => "this is [http://example.com/a] [http://example.com/b]"
21
- }
18
+ expect(@ofilter.call({status: "this is http://example.com/a http://example.com/b"})).to eq({
19
+ status: "this is [http://example.com/a] [http://example.com/b]"
20
+ })
22
21
  end
23
22
  end
24
23
 
@@ -26,17 +25,17 @@ describe Atig::OFilter::ShortUrl,"when no-login bitly with size" do
26
25
  before do
27
26
  logger = double('Logger')
28
27
  bitly = double("Bitly")
29
- bitly.stub(:shorten).and_return{|s|
28
+ allow(bitly).to receive(:shorten){|s|
30
29
  "[#{s}]"
31
30
  }
32
- Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
33
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>13)))
31
+ expect(Atig::Bitly).to receive(:no_login).with(logger).and_return(bitly)
32
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>13)))
34
33
  end
35
34
 
36
35
  it "should only shorten large url" do
37
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
38
- :status => "this is [http://example.com/a] http://a.com"
39
- }
36
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
37
+ status: "this is [http://example.com/a] http://a.com"
38
+ })
40
39
  end
41
40
  end
42
41
 
@@ -44,17 +43,17 @@ describe Atig::OFilter::ShortUrl,"when login bitly" do
44
43
  before do
45
44
  logger = double('Logger')
46
45
  bitly = double("Bitly")
47
- bitly.stub(:shorten).and_return{|s|
46
+ allow(bitly).to receive(:shorten){|s|
48
47
  "[#{s}]"
49
48
  }
50
- Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
51
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>'username:api_key')))
49
+ expect(Atig::Bitly).to receive(:login).with(logger,"username","api_key").and_return(bitly)
50
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>'username:api_key')))
52
51
  end
53
52
 
54
53
  it "should only shorten large url" do
55
- @ofilter.call({:status => "this is http://example.com/a http://example.com/b"}).should == {
56
- :status => "this is [http://example.com/a] [http://example.com/b]"
57
- }
54
+ expect(@ofilter.call({status: "this is http://example.com/a http://example.com/b"})).to eq({
55
+ status: "this is [http://example.com/a] [http://example.com/b]"
56
+ })
58
57
  end
59
58
  end
60
59
 
@@ -62,17 +61,17 @@ describe Atig::OFilter::ShortUrl,"when login bitly with size" do
62
61
  before do
63
62
  logger = double('Logger')
64
63
  bitly = double("Bitly")
65
- bitly.stub(:shorten).and_return{|s|
64
+ allow(bitly).to receive(:shorten){|s|
66
65
  "[#{s}]"
67
66
  }
68
- Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
69
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>'username:api_key:13')))
67
+ expect(Atig::Bitly).to receive(:login).with(logger,"username","api_key").and_return(bitly)
68
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>'username:api_key:13')))
70
69
  end
71
70
 
72
71
  it "should only shorten large url" do
73
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
74
- :status => "this is [http://example.com/a] http://a.com"
75
- }
72
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
73
+ status: "this is [http://example.com/a] http://a.com"
74
+ })
76
75
  end
77
76
  end
78
77
 
@@ -80,12 +79,12 @@ describe Atig::OFilter::ShortUrl,"when nop" do
80
79
  before do
81
80
  logger = double('Logger')
82
81
 
83
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new()))
82
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new()))
84
83
  end
85
84
 
86
85
  it "should only not do anything" do
87
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
88
- :status => "this is http://example.com/a http://a.com"
89
- }
86
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
87
+ status: "this is http://example.com/a http://a.com"
88
+ })
90
89
  end
91
90
  end