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/db/listenable'
5
4
 
6
5
  class SampleListener
@@ -24,9 +23,9 @@ describe Atig::Db::Listenable, "when it is called" do
24
23
  it "should call all listener" do
25
24
  @listeners.hi 1,2,3
26
25
 
27
- @args.length.should == 3
26
+ expect(@args.length).to eq(3)
28
27
  1.upto(2) {|i|
29
- @args[i].should == [1,2,3]
28
+ expect(@args[i]).to eq([1,2,3])
30
29
  }
31
30
  end
32
31
  end
@@ -1,11 +1,10 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/db/lists'
5
4
 
6
5
  describe Atig::Db::Lists do
7
6
  def user(id, name, protect, only)
8
- OpenStruct.new(:id => id, :screen_name=>name, :protected=>protect, :only=>only)
7
+ OpenStruct.new(id: id, screen_name:name, protected:protect, only:only)
9
8
  end
10
9
 
11
10
  before do
@@ -29,15 +28,15 @@ describe Atig::Db::Lists do
29
28
  @lists.update("a" => [ @alice, @bob ],
30
29
  "b" => [ @alice, @bob , @charriey ])
31
30
 
32
- @lists.find_by_screen_name('alice').sort.should == ["a", "b"]
33
- @lists.find_by_screen_name('charriey').should == ["b"]
31
+ expect(@lists.find_by_screen_name('alice').sort).to eq(["a", "b"])
32
+ expect(@lists.find_by_screen_name('charriey')).to eq(["b"])
34
33
  end
35
34
 
36
35
  it "should have lists" do
37
36
  @lists.update("a" => [ @alice, @bob ],
38
37
  "b" => [ @alice, @bob , @charriey ])
39
38
 
40
- @lists.find_by_list_name('a').should == [ @alice, @bob ]
39
+ expect(@lists.find_by_list_name('a')).to eq([ @alice, @bob ])
41
40
  end
42
41
 
43
42
  it "should have each" do
@@ -51,52 +50,52 @@ describe Atig::Db::Lists do
51
50
  @lists.each do|name,users|
52
51
  hash[name] = users
53
52
  end
54
- hash.should == data
53
+ expect(hash).to eq(data)
55
54
  end
56
55
 
57
56
  it "should call listener when new list" do
58
57
  @lists.update("a" => [ @alice, @bob ])
59
58
 
60
- @args.keys.should include(:new, :join)
61
- @args[:new].should == [ "a" ]
62
- @args[:join].should == [ "a", [ @alice, @bob ] ]
59
+ expect(@args.keys).to include(:new, :join)
60
+ expect(@args[:new]).to eq([ "a" ])
61
+ expect(@args[:join]).to eq([ "a", [ @alice, @bob ] ])
63
62
  end
64
63
 
65
64
  it "should call listener when partcial update" do
66
65
  @lists.update("a" => [ @alice ])
67
66
  @lists["a"].update([ @alice, @bob, @charriey ])
68
- @args[:join].should == ["a", [ @bob, @charriey ]]
67
+ expect(@args[:join]).to eq(["a", [ @bob, @charriey ]])
69
68
  end
70
69
 
71
70
  it "should call on_invalidated" do
72
71
  called = false
73
72
  @lists.on_invalidated do|name|
74
- name.should == "a"
73
+ expect(name).to eq("a")
75
74
  called = true
76
75
  end
77
76
  @lists.invalidate("a")
78
77
 
79
- called.should be_true
78
+ expect(called).to be_truthy
80
79
  end
81
80
 
82
81
  it "should call listener when delete list" do
83
82
  @lists.update("a" => [ @alice, @bob ])
84
83
  @lists.update({})
85
- @args.keys.should include(:new, :join, :del)
86
- @args[:del].should == ["a"]
84
+ expect(@args.keys).to include(:new, :join, :del)
85
+ expect(@args[:del]).to eq(["a"])
87
86
  end
88
87
 
89
88
  it "should call listener when join user" do
90
89
  @lists.update("a" => [ @alice ])
91
90
  @lists.update("a" => [ @alice, @bob, @charriey ])
92
91
 
93
- @args[:join].should == ["a", [ @bob, @charriey ]]
92
+ expect(@args[:join]).to eq(["a", [ @bob, @charriey ]])
94
93
  end
95
94
 
96
95
  it "should call listener when exit user" do
97
96
  @lists.update("a" => [ @alice, @bob, @charriey ])
98
97
  @lists.update("a" => [ @alice ])
99
- @args[:part].should == ["a", [ @bob, @charriey ]]
98
+ expect(@args[:part]).to eq(["a", [ @bob, @charriey ]])
100
99
  end
101
100
 
102
101
  it "should call listener when change user mode" do
@@ -104,6 +103,6 @@ describe Atig::Db::Lists do
104
103
  bob = user @bob.id, 'bob', false, false
105
104
  @lists.update("a" => [ @alice, bob ])
106
105
 
107
- @args[:mode].should == [ "a", [ bob ]]
106
+ expect(@args[:mode]).to eq([ "a", [ bob ]])
108
107
  end
109
108
  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/roman'
5
4
 
6
5
  describe Atig::Db::Roman do
@@ -9,9 +8,8 @@ describe Atig::Db::Roman do
9
8
  end
10
9
 
11
10
  it "should make readble tid" do
12
- @roman.make(0).should == 'a'
13
- @roman.make(1).should == 'i'
14
- @roman.make(2).should == 'u'
11
+ expect(@roman.make(0)).to eq('a')
12
+ expect(@roman.make(1)).to eq('i')
13
+ expect(@roman.make(2)).to eq('u')
15
14
  end
16
15
  end
17
-
@@ -1,13 +1,12 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
 
3
- require File.expand_path( '../../spec_helper', __FILE__ )
4
3
  require 'atig/db/sized_uniq_array'
5
4
  require 'ostruct'
6
5
 
7
6
  describe Atig::Db::SizedUniqArray do
8
7
  def item(id)
9
8
  item = double "Item-#{id}"
10
- item.stub(:id).and_return id
9
+ allow(item).to receive(:id).and_return id
11
10
  item
12
11
  end
13
12
 
@@ -24,40 +23,40 @@ describe Atig::Db::SizedUniqArray do
24
23
  end
25
24
 
26
25
  it "should include items" do
27
- @array.to_a.should == [ @item1, @item2, @item3 ]
26
+ expect(@array.to_a).to eq([ @item1, @item2, @item3 ])
28
27
  end
29
28
 
30
29
  it "should rorate array" do
31
30
  @array << @item4
32
- @array.to_a.should == [ @item2, @item3, @item4 ]
31
+ expect(@array.to_a).to eq([ @item2, @item3, @item4 ])
33
32
  end
34
33
 
35
34
  it "should have reverse_each" do
36
35
  xs = []
37
36
  @array.reverse_each {|x| xs << x }
38
- xs.should == [ @item3, @item2, @item1 ]
37
+ expect(xs).to eq([ @item3, @item2, @item1 ])
39
38
  end
40
39
 
41
40
  it "should not have duplicate element" do
42
41
  @array << item(1)
43
- @array.to_a.should == [ @item1, @item2, @item3 ]
42
+ expect(@array.to_a).to eq([ @item1, @item2, @item3 ])
44
43
  end
45
44
 
46
45
  it "should be accesible by index" do
47
- @array[0].should == @item1
48
- @array[1].should == @item2
49
- @array[2].should == @item3
46
+ expect(@array[0]).to eq(@item1)
47
+ expect(@array[1]).to eq(@item2)
48
+ expect(@array[2]).to eq(@item3)
50
49
  end
51
50
 
52
51
  it "should not change index" do
53
52
  @array << @item4
54
- @array[0].should == @item4
55
- @array[1].should == @item2
56
- @array[2].should == @item3
53
+ expect(@array[0]).to eq(@item4)
54
+ expect(@array[1]).to eq(@item2)
55
+ expect(@array[2]).to eq(@item3)
57
56
  end
58
57
 
59
58
  it "should return index when add element" do
60
- (@array << @item4).should == 0
61
- (@array << @item3).should == nil
59
+ expect(@array << @item4).to eq(0)
60
+ expect(@array << @item3).to eq(nil)
62
61
  end
63
62
  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 'fileutils'
5
4
  require 'atig/db/statuses'
6
5
 
7
6
  describe Atig::Db::Statuses do
8
7
  def status(id, text, time)
9
- OpenStruct.new(:id => id, :text => text, :created_at => time.strftime("%a %b %d %H:%M:%S +0000 %Y"))
8
+ OpenStruct.new(id: id, text: text, created_at: time.strftime("%a %b %d %H:%M:%S +0000 %Y"))
10
9
  end
11
10
 
12
11
  def user(name)
13
- OpenStruct.new(:screen_name => name, :id => name)
12
+ OpenStruct.new(screen_name: name, id: name)
14
13
  end
15
14
 
16
15
  before do
@@ -26,9 +25,9 @@ describe Atig::Db::Statuses do
26
25
  @alice = user 'alice'
27
26
  @bob = user 'bob'
28
27
 
29
- @db.add :status => @a , :user => @alice, :source => :srcA
30
- @db.add :status => @b , :user => @bob , :source => :srcB
31
- @db.add :status => @c , :user => @alice, :source => :srcC
28
+ @db.add status: @a , user: @alice, source: :srcA
29
+ @db.add status: @b , user: @bob , source: :srcB
30
+ @db.add status: @c , user: @alice, source: :srcC
32
31
  end
33
32
 
34
33
  after(:all) do
@@ -43,142 +42,142 @@ describe Atig::Db::Statuses do
43
42
  entry = nil
44
43
  @db.listen{|x| entry = x }
45
44
 
46
- @db.add :status => @d, :user => @alice, :source => :timeline, :fuga => :hoge
45
+ @db.add status: @d, user: @alice, source: :timeline, fuga: :hoge
47
46
 
48
- entry.source.should == :timeline
49
- entry.status.should == @d
50
- entry.tid.should match(/\w+/)
51
- entry.sid.should match(/\w+/)
52
- entry.user.should == @alice
53
- entry.source.should == :timeline
54
- entry.fuga.should == :hoge
47
+ expect(entry.source).to eq(:timeline)
48
+ expect(entry.status).to eq(@d)
49
+ expect(entry.tid).to match(/\w+/)
50
+ expect(entry.sid).to match(/\w+/)
51
+ expect(entry.user).to eq(@alice)
52
+ expect(entry.source).to eq(:timeline)
53
+ expect(entry.fuga).to eq(:hoge)
55
54
  end
56
55
 
57
56
  it "should not contain duplicate" do
58
57
  called = false
59
58
  @db.listen{|*_| called = true }
60
59
 
61
- @db.add :status => @c, :user => @bob, :source => :timeline
62
- called.should be_false
60
+ @db.add status: @c, user: @bob, source: :timeline
61
+ expect(called).to be_falsey
63
62
  end
64
63
 
65
64
  it "should be found by id" do
66
65
  entry = @db.find_by_id 1
67
- entry.id.should == 1
68
- entry.status.should == @a
69
- entry.user .should == @alice
70
- entry.tid .should match(/\w+/)
71
- entry.sid.should match(/\w+/)
66
+ expect(entry.id).to eq(1)
67
+ expect(entry.status).to eq(@a)
68
+ expect(entry.user) .to eq(@alice)
69
+ expect(entry.tid) .to match(/\w+/)
70
+ expect(entry.sid).to match(/\w+/)
72
71
  end
73
72
 
74
73
  it "should have unique tid" do
75
74
  db = Atig::Db::Statuses.new 'test.db'
76
- db.add :status => @d , :user => @alice, :source => :srcA
75
+ db.add status: @d , user: @alice, source: :srcA
77
76
 
78
77
  a = @db.find_by_id(1)
79
78
  d = @db.find_by_id(4)
80
- a.tid.should_not == d.tid
81
- a.sid.should_not == d.cid
79
+ expect(a.tid).not_to eq(d.tid)
80
+ expect(a.sid).not_to eq(d.cid)
82
81
  end
83
82
 
84
83
  it "should be found all" do
85
84
  db = @db.find_all
86
- db.size.should == 3
85
+ expect(db.size).to eq(3)
87
86
  a,b,c = db
88
87
 
89
- a.status.should == @c
90
- a.user .should == @alice
91
- a.tid .should match(/\w+/)
92
- a.sid .should match(/\w+/)
88
+ expect(a.status).to eq(@c)
89
+ expect(a.user) .to eq(@alice)
90
+ expect(a.tid) .to match(/\w+/)
91
+ expect(a.sid) .to match(/\w+/)
93
92
 
94
- b.status.should == @b
95
- b.user .should == @bob
96
- b.tid .should match(/\w+/)
97
- b.sid .should match(/\w+/)
93
+ expect(b.status).to eq(@b)
94
+ expect(b.user) .to eq(@bob)
95
+ expect(b.tid) .to match(/\w+/)
96
+ expect(b.sid) .to match(/\w+/)
98
97
 
99
- c.status.should == @a
100
- c.user.should == @alice
101
- c.tid.should match(/\w+/)
102
- c.sid.should match(/\w+/)
98
+ expect(c.status).to eq(@a)
99
+ expect(c.user).to eq(@alice)
100
+ expect(c.tid).to match(/\w+/)
101
+ expect(c.sid).to match(/\w+/)
103
102
  end
104
103
 
105
104
  it "should be found by tid" do
106
105
  entry = @db.find_by_id(1)
107
- @db.find_by_tid(entry.tid).should == entry
106
+ expect(@db.find_by_tid(entry.tid)).to eq(entry)
108
107
  end
109
108
 
110
109
  it "should be found by sid" do
111
110
  entry = @db.find_by_id(1)
112
- @db.find_by_sid(entry.sid).should == entry
111
+ expect(@db.find_by_sid(entry.sid)).to eq(entry)
113
112
  end
114
113
 
115
114
  it "should be found by tid" do
116
- @db.find_by_tid('__').should be_nil
115
+ expect(@db.find_by_tid('__')).to be_nil
117
116
  end
118
117
 
119
118
  it "should be found by user" do
120
119
  a,b = *@db.find_by_user(@alice)
121
120
 
122
- a.status.should == @c
123
- a.user .should == @alice
124
- a.tid .should match(/\w+/)
125
- a.sid .should match(/\w+/)
121
+ expect(a.status).to eq(@c)
122
+ expect(a.user) .to eq(@alice)
123
+ expect(a.tid) .to match(/\w+/)
124
+ expect(a.sid) .to match(/\w+/)
126
125
 
127
- b.status.should == @a
128
- b.user.should == @alice
129
- b.tid.should match(/\w+/)
130
- b.sid.should match(/\w+/)
126
+ expect(b.status).to eq(@a)
127
+ expect(b.user).to eq(@alice)
128
+ expect(b.tid).to match(/\w+/)
129
+ expect(b.sid).to match(/\w+/)
131
130
  end
132
131
 
133
132
  it "should be found by screen_name" do
134
133
  db = @db.find_by_screen_name('alice')
135
- db.size.should == 2
134
+ expect(db.size).to eq(2)
136
135
  a,b = db
137
136
 
138
- a.status.should == @c
139
- a.user .should == @alice
140
- a.tid .should match(/\w+/)
141
- a.sid .should match(/\w+/)
137
+ expect(a.status).to eq(@c)
138
+ expect(a.user) .to eq(@alice)
139
+ expect(a.tid) .to match(/\w+/)
140
+ expect(a.sid) .to match(/\w+/)
142
141
 
143
- b.status.should == @a
144
- b.user.should == @alice
145
- b.tid.should match(/\w+/)
146
- b.sid.should match(/\w+/)
142
+ expect(b.status).to eq(@a)
143
+ expect(b.user).to eq(@alice)
144
+ expect(b.tid).to match(/\w+/)
145
+ expect(b.sid).to match(/\w+/)
147
146
  end
148
147
 
149
148
  it "should be found by screen_name with limit" do
150
- xs = @db.find_by_screen_name('alice', :limit => 1)
151
- xs.size.should == 1
149
+ xs = @db.find_by_screen_name('alice', limit: 1)
150
+ expect(xs.size).to eq(1)
152
151
 
153
152
  a,_ = xs
154
- a.status.should == @c
155
- a.user .should == @alice
156
- a.tid .should match(/\w+/)
157
- a.sid .should match(/\w+/)
153
+ expect(a.status).to eq(@c)
154
+ expect(a.user) .to eq(@alice)
155
+ expect(a.tid) .to match(/\w+/)
156
+ expect(a.sid) .to match(/\w+/)
158
157
  end
159
158
 
160
159
  it "should remove by id" do
161
160
  @db.remove_by_id 1
162
- @db.find_by_id(1).should be_nil
161
+ expect(@db.find_by_id(1)).to be_nil
163
162
  end
164
163
 
165
164
  it "should have uniq tid/sid when removed" do
166
165
  old = @db.find_by_id 3
167
166
  @db.remove_by_id 3
168
- @db.add :status => @c , :user => @alice, :source => :src
167
+ @db.add status: @c , user: @alice, source: :src
169
168
  new = @db.find_by_id 3
170
169
 
171
- old.tid.should_not == new.tid
172
- old.sid.should_not == new.sid
170
+ expect(old.tid).not_to eq(new.tid)
171
+ expect(old.sid).not_to eq(new.sid)
173
172
  end
174
173
 
175
174
  it "should cleanup" do
176
- Atig::Db::Statuses::Size = 10 unless defined? Atig::Db::Statuses::Size # hack
175
+ Atig::Db::Statuses::Size = 10 unless defined? Atig::Db::Statuses::Size # hack
177
176
  Atig::Db::Statuses::Size.times do|i|
178
177
  s = status i+100, 'a', Time.utc(2010,1,5)+i+1
179
- @db.add :status => s , :user => @alice , :source => :srcB
178
+ @db.add status: s , user: @alice , source: :srcB
180
179
  end
181
180
  @db.cleanup
182
- @db.find_by_status_id(@a.id).should == nil
181
+ expect(@db.find_by_status_id(@a.id)).to eq(nil)
183
182
  end
184
183
  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/expand_url'
5
4
  require 'atig/twitter_struct'
6
5
 
@@ -10,57 +9,57 @@ end
10
9
 
11
10
  describe Atig::IFilter::ExpandUrl, "when disable whole url" do
12
11
  def filtered(text)
13
- ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(:log=>double('log'),:opts=>OpenStruct.new)
12
+ ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(log:double('log'),:opts=>OpenStruct.new)
14
13
  ifilter.call status(text)
15
14
  end
16
15
 
17
16
  it "should expand bit.ly" do
18
- filtered("This is http://bit.ly/hoge").should be_text("This is [http://bit.ly/hoge]")
19
- filtered("This is http://bitly.com/hoge").should be_text("This is [http://bitly.com/hoge]")
17
+ expect(filtered("This is http://bit.ly/hoge")).to be_text("This is [http://bit.ly/hoge]")
18
+ expect(filtered("This is http://bitly.com/hoge")).to be_text("This is [http://bitly.com/hoge]")
20
19
  end
21
20
 
22
21
  it "should expand htn.to" do
23
- filtered("This is http://htn.to/TZdkXg").should be_text("This is [http://htn.to/TZdkXg]")
24
- filtered("This is http://htnnto/TZdkXg").should be_text("This is http://htnnto/TZdkXg")
22
+ expect(filtered("This is http://htn.to/TZdkXg")).to be_text("This is [http://htn.to/TZdkXg]")
23
+ expect(filtered("This is http://htnnto/TZdkXg")).to be_text("This is http://htnnto/TZdkXg")
25
24
  end
26
25
 
27
26
  it "should expand tmblr.co" do
28
- filtered("This is http://tmblr.co/Z0rNbyxhxUK5").should be_text("This is [http://tmblr.co/Z0rNbyxhxUK5]")
27
+ expect(filtered("This is http://tmblr.co/Z0rNbyxhxUK5")).to be_text("This is [http://tmblr.co/Z0rNbyxhxUK5]")
29
28
  end
30
29
 
31
30
  it "should expand nico.ms" do
32
- filtered("This is http://nico.ms/sm11870888").should be_text("This is [http://nico.ms/sm11870888]")
31
+ expect(filtered("This is http://nico.ms/sm11870888")).to be_text("This is [http://nico.ms/sm11870888]")
33
32
  end
34
33
 
35
34
  it "should through other url" do
36
- filtered("http://example.com").should be_text("http://example.com")
35
+ expect(filtered("http://example.com")).to be_text("http://example.com")
37
36
  end
38
37
  end
39
38
 
40
39
  describe Atig::IFilter::ExpandUrl, "when enable whole url" do
41
40
  def filtered(text)
42
41
  context = OpenStruct.new(
43
- :log => double('log'),
44
- :opts => OpenStruct.new(:untiny_whole_urls=>true))
42
+ log: double('log'),
43
+ opts: OpenStruct.new(untiny_whole_urls:true))
45
44
  ifilter = Atig::IFilter::ExpandUrl.new(context)
46
45
  ifilter.call status(text)
47
46
  end
48
47
 
49
48
  it "should expand bit.ly" do
50
- filtered("This is http://bit.ly/hoge").should be_text("This is [http://bit.ly/hoge]")
49
+ expect(filtered("This is http://bit.ly/hoge")).to be_text("This is [http://bit.ly/hoge]")
51
50
  end
52
51
 
53
52
  it "should expand other url" do
54
- filtered("http://example.com").should be_text("[http://example.com]")
55
- filtered("https://example.com").should be_text("[https://example.com]")
53
+ expect(filtered("http://example.com")).to be_text("[http://example.com]")
54
+ expect(filtered("https://example.com")).to be_text("[https://example.com]")
56
55
  end
57
56
  end
58
57
 
59
58
  describe Atig::IFilter::ExpandUrl, "when has urls entities" do
60
59
  def filtered(text, opts)
61
60
  context = OpenStruct.new(
62
- :log => double('log'),
63
- :opts => OpenStruct.new)
61
+ log: double('log'),
62
+ opts: OpenStruct.new)
64
63
  ifilter = Atig::IFilter::ExpandUrl.new(context)
65
64
  ifilter.call status(text, opts)
66
65
  end
@@ -77,9 +76,8 @@ describe Atig::IFilter::ExpandUrl, "when has urls entities" do
77
76
  }]
78
77
  }
79
78
  }
80
- filtered("http://t.co/1Vyoux4kB8", opts).should be_text("http://example.com/")
81
- filtered("http://t.co/1Vyoux4kB8 http://t.co/V1441ye6g2", opts).should
82
- be_text("http://example.com/ http://expmaple.org/")
79
+ expect(filtered("http://t.co/1Vyoux4kB8", opts)).to be_text("http://example.com/")
80
+ expect(filtered("http://t.co/1Vyoux4kB8 http://t.co/V1441ye6g2", opts)).to be_text("http://example.com/ http://example.org/")
83
81
  end
84
82
 
85
83
  it "should expand recursive shorten URL" do
@@ -91,6 +89,6 @@ describe Atig::IFilter::ExpandUrl, "when has urls entities" do
91
89
  }]
92
90
  }
93
91
  }
94
- filtered("http://t.co/h8sqL5ZMuz", opts).should be_text("[http://bit.ly/1LM4fW]")
92
+ expect(filtered("http://t.co/h8sqL5ZMuz", opts)).to be_text("[http://bit.ly/1LM4fW]")
95
93
  end
96
94
  end