[DRE-commits] [atig] 01/05: Imported Upstream version 0.5.0
Youhei SASAKI
uwabami-guest at moszumanska.debian.org
Sun Dec 27 13:56:57 UTC 2015
This is an automated email from the git hooks/post-receive script.
uwabami-guest pushed a commit to annotated tag debian/0.5.0-1
in repository atig.
commit 2dce0cd6155996bab5bc72630e94be213885c3fc
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date: Wed Nov 11 04:20:08 2015 +0900
Imported Upstream version 0.5.0
---
.rspec | 1 +
.travis.yml | 5 +-
Gemfile | 2 +
Gemfile.lock | 80 +++++----
README.mkdn | 2 +
Rakefile | 6 -
atig.gemspec | 41 ++---
bin/console | 14 ++
bin/setup | 7 +
checksums.yaml.gz | Bin 270 -> 0 bytes
docs/_static/allow.png | Bin 38377 -> 0 bytes
docs/_static/emacs.png | Bin 159051 -> 0 bytes
docs/_static/irc_setting.png | Bin 30415 -> 0 bytes
docs/_static/irssi.png | Bin 214034 -> 0 bytes
docs/_static/limechat.png | Bin 238135 -> 0 bytes
docs/_static/limechat_s.png | Bin 97747 -> 0 bytes
docs/_static/oauth_channel.png | Bin 39819 -> 0 bytes
docs/_static/screenshot.png | Bin 85373 -> 0 bytes
docs/_static/structure.png | Bin 22875 -> 0 bytes
docs/_static/verify.png | Bin 27702 -> 0 bytes
docs/changelog.rst | 233 -------------------------
docs/commandline_options.rst | 21 ---
docs/commands.rst | 84 ---------
docs/conf.py | 194 ---------------------
docs/config.rst | 159 -----------------
docs/feature.rst | 41 -----
docs/hacking_guide.rst | 43 -----
docs/index.rst | 102 -----------
docs/irc.rst | 31 ----
docs/options.rst | 76 --------
docs/quickstart.rst | 96 ----------
docs/resize.sh | 7 -
docs/tiarra.rst | 2 -
docs/tig.rst | 21 ---
{bin => exe}/atig | 0
lib/atig/agent/agent.rb | 8 +-
lib/atig/agent/dm.rb | 8 +-
lib/atig/agent/following.rb | 6 +-
lib/atig/agent/list.rb | 4 +-
lib/atig/agent/list_status.rb | 12 +-
lib/atig/agent/stream_follow.rb | 4 +-
lib/atig/agent/user_stream.rb | 6 +-
lib/atig/basic_twitter.rb | 4 +-
lib/atig/bitly.rb | 2 +-
lib/atig/channel/channel.rb | 2 +-
lib/atig/channel/list.rb | 6 +-
lib/atig/channel/retweet.rb | 2 +-
lib/atig/channel/timeline.rb | 2 +-
lib/atig/command/autofix.rb | 8 +-
lib/atig/command/destroy.rb | 2 +-
lib/atig/command/dm.rb | 4 +-
lib/atig/command/favorite.rb | 2 +-
lib/atig/command/info.rb | 4 +-
lib/atig/command/reply.rb | 4 +-
lib/atig/command/retweet.rb | 4 +-
lib/atig/command/search.rb | 4 +-
lib/atig/command/status.rb | 6 +-
lib/atig/command/user.rb | 6 +-
lib/atig/command/version.rb | 6 +-
lib/atig/db/followings.rb | 11 +-
lib/atig/db/statuses.rb | 22 +--
lib/atig/db/transaction.rb | 2 +-
lib/atig/gateway/channel.rb | 3 +-
lib/atig/gateway/session.rb | 26 +--
lib/atig/http.rb | 8 +-
lib/atig/ifilter/expand_url.rb | 2 +-
lib/atig/ifilter/retweet.rb | 2 +-
lib/atig/ifilter/retweet_time.rb | 2 +-
lib/atig/ifilter/sanitize.rb | 2 +-
lib/atig/ifilter/strip.rb | 2 +-
lib/atig/ifilter/xid.rb | 2 +-
lib/atig/oauth.rb | 6 +-
lib/atig/ofilter/escape_url.rb | 2 +-
lib/atig/ofilter/footer.rb | 2 +-
lib/atig/ofilter/geo.rb | 2 +-
lib/atig/ofilter/short_url.rb | 2 +-
lib/atig/option.rb | 2 +-
lib/atig/optparse.rb | 33 ++--
lib/atig/search.rb | 6 +-
lib/atig/stream.rb | 2 +-
lib/atig/twitter.rb | 9 +-
lib/atig/update_checker.rb | 4 +-
lib/atig/url_escape.rb | 2 +-
lib/atig/version.rb | 2 +-
lib/memory_profiler.rb | 2 +-
metadata.yml | 357 --------------------------------------
requirements.txt | 5 -
spec/command/autofix_spec.rb | 15 +-
spec/command/destroy_spec.rb | 25 ++-
spec/command/dm_spec.rb | 11 +-
spec/command/favorite_spec.rb | 23 ++-
spec/command/limit_spec.rb | 13 +-
spec/command/location_spec.rb | 9 +-
spec/command/name_spec.rb | 5 +-
spec/command/option_spec.rb | 57 +++---
spec/command/refresh_spec.rb | 7 +-
spec/command/reply_spec.rb | 45 +++--
spec/command/retweet_spec.rb | 35 ++--
spec/command/spam_spec.rb | 9 +-
spec/command/status_spec.rb | 39 ++---
spec/command/thread_spec.rb | 41 +++--
spec/command/time_spec.rb | 39 ++---
spec/command/uptime_spec.rb | 35 ++--
spec/command/user_info_spec.rb | 29 ++--
spec/command/user_spec.rb | 27 ++-
spec/command/version_spec.rb | 54 +++---
spec/command/whois_spec.rb | 51 +++---
spec/command_helper.rb | 4 +-
spec/db/followings_spec.rb | 45 +++--
spec/db/listenable_spec.rb | 5 +-
spec/db/lists_spec.rb | 33 ++--
spec/db/roman_spec.rb | 8 +-
spec/db/sized_uniq_array_spec.rb | 27 ++-
spec/db/statuses_spec.rb | 139 ++++++++-------
spec/ifilter/expand_url_spec.rb | 38 ++--
spec/ifilter/retweet_spec.rb | 9 +-
spec/ifilter/retweet_time_spec.rb | 9 +-
spec/ifilter/sanitize_spec.rb | 11 +-
spec/ifilter/sid_spec.rb | 13 +-
spec/ifilter/strip_spec.rb | 7 +-
spec/ifilter/tid_spec.rb | 13 +-
spec/levenshtein_spec.rb | 5 +-
spec/ofilter/escape_url_spec.rb | 27 ++-
spec/ofilter/footer_spec.rb | 21 ++-
spec/ofilter/geo_spec.rb | 25 ++-
spec/ofilter/short_url_spec.rb | 57 +++---
spec/option_spec.rb | 47 +++--
spec/sized_hash_spec.rb | 11 +-
spec/spec_helper.rb | 14 +-
spec/update_checker_spec.rb | 29 ++--
130 files changed, 801 insertions(+), 2271 deletions(-)
diff --git a/.rspec b/.rspec
index 7eb1831..a92d32a 100644
--- a/.rspec
+++ b/.rspec
@@ -1,2 +1,3 @@
+--require spec_helper
--color
--profile
diff --git a/.travis.yml b/.travis.yml
index 832662b..767d78d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,8 @@
language: ruby
rvm:
- - 1.9.3
- 2.0.0
- - 2.1.0
+ - 2.1
+ - 2.2
+ - ruby-head
script: bundle exec rake spec
diff --git a/Gemfile b/Gemfile
index fa75df1..edf06a3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,5 @@
source 'https://rubygems.org'
gemspec
+
+gem 'rspec', '~> 3.0.0.beta2'
diff --git a/Gemfile.lock b/Gemfile.lock
index 258c15f..b2e8380 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- atig (0.4.4)
+ atig (0.5.0)
net-irc
oauth
sqlite3 (>= 1.3.2)
@@ -10,43 +10,55 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- coveralls (0.7.0)
- multi_json (~> 1.3)
- rest-client
- simplecov (>= 0.7)
- term-ansicolor
- thor
+ coveralls (0.8.3)
+ json (~> 1.8)
+ rest-client (>= 1.6.8, < 2)
+ simplecov (~> 0.10.0)
+ term-ansicolor (~> 1.3)
+ thor (~> 0.19.1)
diff-lcs (1.2.5)
- docile (1.1.2)
- mime-types (2.0)
- multi_json (1.8.4)
+ docile (1.1.5)
+ domain_name (0.5.25)
+ unf (>= 0.0.5, < 1.0.0)
+ http-cookie (1.0.2)
+ domain_name (~> 0.5)
+ json (1.8.3)
+ mime-types (2.6.2)
net-irc (0.0.9)
+ netrc (0.11.0)
oauth (0.4.7)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- rspec (2.14.1)
- rspec-core (~> 2.14.0)
- rspec-expectations (~> 2.14.0)
- rspec-mocks (~> 2.14.0)
- rspec-core (2.14.7)
- rspec-expectations (2.14.4)
- diff-lcs (>= 1.1.3, < 2.0)
- rspec-mocks (2.14.4)
- simplecov (0.8.2)
+ rake (10.4.2)
+ rest-client (1.8.0)
+ http-cookie (>= 1.0.2, < 2.0)
+ mime-types (>= 1.16, < 3.0)
+ netrc (~> 0.7)
+ rspec (3.0.0)
+ rspec-core (~> 3.0.0)
+ rspec-expectations (~> 3.0.0)
+ rspec-mocks (~> 3.0.0)
+ rspec-core (3.0.4)
+ rspec-support (~> 3.0.0)
+ rspec-expectations (3.0.4)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.0.0)
+ rspec-mocks (3.0.4)
+ rspec-support (~> 3.0.0)
+ rspec-support (3.0.4)
+ simplecov (0.10.0)
docile (~> 1.1.0)
- multi_json
- simplecov-html (~> 0.8.0)
- simplecov-html (0.8.0)
- sqlite3 (1.3.8)
- term-ansicolor (1.2.2)
- tins (~> 0.8)
- thor (0.18.1)
- tins (0.13.1)
+ json (~> 1.8)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.0)
+ sqlite3 (1.3.11)
+ term-ansicolor (1.3.2)
+ tins (~> 1.0)
+ thor (0.19.1)
+ tins (1.6.0)
twitter-text (1.7.0)
unf (~> 0.1.0)
- unf (0.1.3)
+ unf (0.1.4)
unf_ext
- unf_ext (0.0.6)
+ unf_ext (0.0.7.1)
PLATFORMS
ruby
@@ -55,4 +67,8 @@ DEPENDENCIES
atig!
bundler
coveralls
- rspec
+ rake
+ rspec (~> 3.0.0.beta2)
+
+BUNDLED WITH
+ 1.10.6
diff --git a/README.mkdn b/README.mkdn
index e83839c..0408de1 100644
--- a/README.mkdn
+++ b/README.mkdn
@@ -1,6 +1,8 @@
Atig.rb - Another Twitter Irc Gateway
===========================================
+[](https://rubygems.org/gems/atig) [](https://codeclimate.com/github/atig/atig) [](https://travis-ci.org/atig/atig)
+
OVERVIEW
--------
Atig.rb is Twitter Irc Gateway.
diff --git a/Rakefile b/Rakefile
index 97c068c..28a2ec8 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,10 +17,4 @@ RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
end
-desc "building document with sphinx"
-task :docs do
- build_dir = "docs/_build"
- `LC_CTYPE=C sphinx-build -b html -d #{build_dir}/doctrees -D latex_paper_size=a4 docs #{build_dir}/html`
-end
-
task :default => [:spec, :clean]
diff --git a/atig.gemspec b/atig.gemspec
index 72e2cb3..ec4ba82 100644
--- a/atig.gemspec
+++ b/atig.gemspec
@@ -1,28 +1,29 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/atig/version', __FILE__)
-Gem::Specification.new do |gem|
- gem.authors = ["MIZUNO Hiroki", "SHIBATA Hiroshi", ]
- gem.email = ["mzp at ocaml.jp", "shibata.hiroshi at gmail.com"]
- gem.description = %q{Atig.rb is Twitter Irc Gateway.}
- gem.summary = %q{Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.}
- gem.homepage = "https://github.com/mzp/atig"
+Gem::Specification.new do |spec|
+ spec.name = "atig"
+ spec.version = Atig::VERSION
+ spec.authors = ["MIZUNO Hiroki", "SHIBATA Hiroshi", ]
+ spec.email = ["mzp at ocaml.jp", "shibata.hiroshi at gmail.com"]
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- gem.files = `git ls-files`.split("\n")
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- gem.name = "atig"
- gem.require_paths = ["lib"]
- gem.version = Atig::VERSION
+ spec.summary = %q{Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.}
+ spec.description = %q{Atig.rb is Twitter Irc Gateway.}
+ spec.homepage = "https://github.com/atig/atig"
- gem.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
+ spec.bindir = "exe"
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+ spec.require_paths = ["lib"]
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
- gem.add_dependency 'sqlite3', ['>= 1.3.2']
- gem.add_dependency 'net-irc', ['>= 0']
- gem.add_dependency 'oauth', ['>= 0']
- gem.add_dependency 'twitter-text', ['~> 1.7.0']
+ spec.add_dependency 'sqlite3', ['>= 1.3.2']
+ spec.add_dependency 'net-irc', ['>= 0']
+ spec.add_dependency 'oauth', ['>= 0']
+ spec.add_dependency 'twitter-text', ['~> 1.7.0']
- gem.add_development_dependency 'bundler'
- gem.add_development_dependency 'rspec'
- gem.add_development_dependency 'coveralls'
+ spec.add_development_dependency 'bundler'
+ spec.add_development_dependency 'rake'
+ spec.add_development_dependency 'coveralls'
end
diff --git a/bin/console b/bin/console
new file mode 100755
index 0000000..cd1f7cc
--- /dev/null
+++ b/bin/console
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+require "bundler/setup"
+require "atig"
+
+# You can add fixtures and/or initialization code here to make experimenting
+# with your gem easier. You can also use a different console, if you like.
+
+# (If you use this, don't forget to add pry to your Gemfile!)
+# require "pry"
+# Pry.start
+
+require "irb"
+IRB.start
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..b65ed50
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -euo pipefail
+IFS=$'\n\t'
+
+bundle install
+
+# Do any other automated setup that you need to do here
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index 6cf44aa..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/docs/_static/allow.png b/docs/_static/allow.png
deleted file mode 100644
index c441295..0000000
Binary files a/docs/_static/allow.png and /dev/null differ
diff --git a/docs/_static/emacs.png b/docs/_static/emacs.png
deleted file mode 100644
index c451f3d..0000000
Binary files a/docs/_static/emacs.png and /dev/null differ
diff --git a/docs/_static/irc_setting.png b/docs/_static/irc_setting.png
deleted file mode 100644
index c5406a1..0000000
Binary files a/docs/_static/irc_setting.png and /dev/null differ
diff --git a/docs/_static/irssi.png b/docs/_static/irssi.png
deleted file mode 100644
index 0678312..0000000
Binary files a/docs/_static/irssi.png and /dev/null differ
diff --git a/docs/_static/limechat.png b/docs/_static/limechat.png
deleted file mode 100644
index 833e080..0000000
Binary files a/docs/_static/limechat.png and /dev/null differ
diff --git a/docs/_static/limechat_s.png b/docs/_static/limechat_s.png
deleted file mode 100644
index 3f6e7e3..0000000
Binary files a/docs/_static/limechat_s.png and /dev/null differ
diff --git a/docs/_static/oauth_channel.png b/docs/_static/oauth_channel.png
deleted file mode 100644
index c258ab0..0000000
Binary files a/docs/_static/oauth_channel.png and /dev/null differ
diff --git a/docs/_static/screenshot.png b/docs/_static/screenshot.png
deleted file mode 100644
index e30aa0d..0000000
Binary files a/docs/_static/screenshot.png and /dev/null differ
diff --git a/docs/_static/structure.png b/docs/_static/structure.png
deleted file mode 100644
index 9de2664..0000000
Binary files a/docs/_static/structure.png and /dev/null differ
diff --git a/docs/_static/verify.png b/docs/_static/verify.png
deleted file mode 100644
index 231ee84..0000000
Binary files a/docs/_static/verify.png and /dev/null differ
diff --git a/docs/changelog.rst b/docs/changelog.rst
deleted file mode 100644
index ecccbc8..0000000
--- a/docs/changelog.rst
+++ /dev/null
@@ -1,233 +0,0 @@
-更新履歴
-==============
-
-v0.4.4(2013-12-29)
-------------------------------
-http://github.com/mzp/atig/tree/v0.4.4
-
-機能変更
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - サポート対象を Ruby 1.9.3 以降にしました
- - follower 取得時の1回の取得数を100件に拡張しました
-
- v0.4.3(2013-10-18)
-------------------------------
-http://github.com/mzp/atig/tree/v0.4.3
-
-不具合修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - 短縮 URL の展開が動かない問題を修正しました
-
-v0.4.2(2013-10-13)
-------------------------------
-http://github.com/mzp/atig/tree/v0.4.2
-
-機能変更
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - タイムラインの取得間隔を 1 分にしました
-
-v0.4.1(2013-08-02)
-------------------------------
-http://github.com/mzp/atig/tree/v0.4.1
-
-不具合修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - '&' が置換されない問題を修正しました
- - reply が取得できない不具合を修正しました
- - list の追加・削除 API が 1.0 のままだった問題を修正しました
-
-v0.4.0(2013-06-12)
-------------------------------
-http://github.com/mzp/atig/tree/v0.4.0
-
-機能変更
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Twitter API 1.1に対応しました
-
-v0.3.12(2013-04-02)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.12
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - v0.3.10-11 で --tmpdir オプションが動作していない不具合を直しました
-
-v0.3.11(2013-04-02)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.11
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - v0.3.10 で起動できない不具合を直しました
-
- v0.3.10(2013-04-02)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.10
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - 一時ファイルの作成先を指定することができる --tmpdir オプションを追加しました
-
-v0.3.9(2013-03-01)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.9
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Ruby 2.0 以降で動かした場合に Twitter のレスポンスを取得出来ない不具合を修正しました
-
-v0.3.8(2013-02-03)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.8
-
-機能変更
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - atig を rubygems からインストールしている場合はバージョンアップのチェックを行わないようにしました
-
-v0.3.7(2013-01-27)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.7
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Twitter の Userstream に対応しました
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Ruby 2.0.0(r38955) で動かない問題を直しました
- - github の API の変更によりバージョンチェックが動かない問題を直しました
-
- v0.3.6(2012-05-14)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.6
-
-機能変更
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Ruby 2.0.0 以降で iconv ライブラリが削除されることに伴う UTF7 サポートの終了
-
-v0.3.5(2012-05-07)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.5
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - ユーザーが作成したリストが表示されない問題を修正しました
-
- v0.3.4(2012-01-30)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.4
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Ruby 1.8 で動かない問題を修正しました
-
- v0.3.3(2012-01-24)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.3
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - gem コマンドでインストールできるようにしました
-
-機能修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - Ruby 1.9 に対応しました
- - SQLite3-1.3.5 に対応しました
- - bundler に対応しました
- - HTTP アクセス時の media-range から Quality 指定を削除しました
- - bit.ly の API 変更に追従しました
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - 非公式RTが実行できない不具合を修正
-
- v0.3.2(2010-10-10)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.2
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - :doc:`config`: `Atig::IFilter::RetweetTime` を追加しました
-
-機能修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - DBのデータ削除の周期を減らしました
- - DMチャンネルでのDMの送信に対応しました
- - :doc:`commands`: `limit` にリセットされる日付を表示するようにした (thx. `hirose31`_ )
- - :doc:`config`: 自動展開するURLにhtn.to, goo.glを追加
-
-.. _hirose31: http://twitter.com/hirose31
-
-v0.3.1(2010-07-26)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.1
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - :doc:`commands`: `refresh` を追加しました
- - :doc:`commands`: `spam` を追加しました
- - :doc:`agent` : 他人のリストをフォローできるようになりました
-
-機能修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - キャッシュを/tmp/atigに置くように変更しました。
- - 定期的にキャッシュ中の古い内容を削除するように変更しました。
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - アンフォローしたユーザがキャッシュ中に残るバグを修正
-
-
-v0.3.0(2010-06-12)
-------------------------------
-http://github.com/mzp/atig/tree/v0.3.0
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - :doc:`commands`: `search` を追加しました。(thx. `xeres`_ )
-
-.. _xeres: http://blog.xeres.jp/2010/06/04/atig_rb-tweet-search/
-
-機能修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - キャッシュとして用いているSQLiteのDBにインデックスを貼るようにしました。(thx. `L_star`_ )
- - 定期的にGCを起動し、メモリ消費量を抑えるようにしました。
- - 誤ったBit.lyのAPIキーを指定した際のエラーメッセージを分かりやすくしました。( `Issues 1`_ )
-
-.. _L_Star: http://d.hatena.ne.jp/mzp/20100407#c
-.. _Issues 1: http://github.com/mzp/atig/issues/closed#issue/1
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-v0.2.1(2010-04-17)
-------------------------------
-http://github.com/mzp/atig/tree/v0.2.1
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - :doc:`commands`: `autofix`, `location` を追加しました。
- - :doc:`irc`: `/topic` が `/me autofix` のエイリアスになりました。
- - 最新の発言を削除した場合、トピック(topic)をひとつ前に戻すようにした
-
-v0.2.0(2010-04-11)
-------------------------------
-http://github.com/mzp/atig/tree/v0.2.0
-
-機能追加
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - :doc:`options`: `sid` を追加した。
- - :doc:`config`: `Atig::IFilter::Sid` を追加した。
- - :doc:`options`: `old_style_reply` を追加した。
- - :doc:`commands`: `reply`, `retweet`, `destory`, `fav`, `unfav`, `thread` でスクリーンネームやsidを利用できるようにした。
-
-バグ修正
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- - followingの取得時にSSL Verified Errorが発生する不具合を修正
-
-v0.1.0(2010-04-11)
-------------------------------
-
-http://github.com/mzp/atig/tree/v0.1.0
-
-- 最初のリリース
diff --git a/docs/commandline_options.rst b/docs/commandline_options.rst
deleted file mode 100644
index 9a84a8c..0000000
--- a/docs/commandline_options.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-コマンドラインオプション
-==============================
-
-書式
-------------------------------
-::
-
- bin/atig [opts]
-
-オプション
-------------------------------
-`-p`, `--port` ``PORT``
- 起動するポート番号を指定します。デフォルトは16668です。
-`-h`, `--host` ``HOST``
- 起動するホスト名、またはIPアドレスを指定します。デフォルトはlocalhostです。
-`-l`, `--log` ``LOG``
- ログを記録するファイル名を指定します。
-`-d`, `--debug`
- デバッグモードを有効にします。
-`-c`, `--conf` ``filename``
- ロードする設定ファイルを指定します。詳しくは doc:`conf` を参照してください。
diff --git a/docs/commands.rst b/docs/commands.rst
deleted file mode 100644
index cf72a72..0000000
--- a/docs/commands.rst
+++ /dev/null
@@ -1,84 +0,0 @@
-CTCP ACTION
-==================================
-
-概要
-------------------------------
-
-CTCP ACTIONによって、特定の発言への返信などが行なえます。
-
-CTCP ACTIONの送り方はクライアントによって異なりますが、LimeChatやirssi
-では ``/me`` です。 例えば、replyコマンド送信する場合は ``/me reply a`` のようになります。
-
-発言関係
-------------------------------
-発言の指定方法について
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-以下で ``tweet`` と書かれている部分では、次の書式が利用できます。
-
-- `a`: 一致するtidを持つ発言を指します。
-- `nick:a`: 一致するsidを持つ発言を指します。
-- `nick`: @nickの最新の発言を指します。
-- `@nick`: @nickの最新の発言を指します。
-
-コマンド
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-reply ``tweet`` ``comment`` (別名: mention, re, rp)
- ``tweet`` に対して返信します。
-retweet ``tweet`` [``comment``] (別名: rt, ort)
- ``tweet`` をリツイートします。
- コメントが省略された場合は、公式リツイートになります。
-destroy ``tweet`` (別名: remove, rm)
- ``tweet`` を削除する。 ``tweet`` の発言が自分のものでない場合はエラーになります。
-fav ``tweet``
- ``tweet`` をお気に入りに追加します。
-unfav ``tweet``
- ``tweet`` をお気に入りから削除します。
-thread ``tweet`` [``count``]
- ``tweet`` のin_reply_toを辿って、最大 ``count`` 件の会話を表示します。
- ``count`` が省略された場合は10件になります。 ``count`` は20件以上を指定しても無視されます。
-autofix ``comment`` (別名: topic)
- 最新の発言が ``comment`` と類似している場合はその発言を削除し、 ``comment`` を発言として投稿します。
-autofix! ``tweet`` (別名: topic!)
- 最新の発言を削除し、 ``comment`` を発言として投稿します。
-search [ ``option`` ] ``text`` (別名: s)
- ``text`` を含む発言を検索します。
- オプションは ``:lang=<国コード>`` のみサポートしています。``/me s :lang=ja hoge`` だと日本人のツイートのみを検索します。
-
-
-ユーザ関係
-------------------------------
-userinfo ``screen_name`` (別名: bio)
- ``screen_name`` のユーザのプロフィールを表示します。
-version ``screen_name``
- ``screen_name`` のクライアントの情報を表示します。最新の発言に用いたクライアント名を表示します。
-time ``screen_name``
- ``screen_name`` のタイムゾーン情報を表示します。
-user ``screen_name`` [``count``] (別名: u)
- ``screen_name`` のユーザの最新の発言 ``count`` 件を表示します。
- ``count`` が省略された場合は20件になります。 ``count`` は
- 200件以上を指定しても無視されます。
-spam ``screen_name``
- ``screen_name`` のユーザをスパムアカウントとして通報します。
-
-プロフィール関連
-------------------------------
-location ``place`` (別名: in, location)
- 自分の現在地を ``place`` に更新します。
-name ``name``
- 自分の名前を ``name`` に更新します。
-
-システム関係
-------------------------------
-uptime
- atig.rbの連続起動時間を表示します。
-limit (別名: limits, rls)
- 残りのAPIへのアクセス可能回数を表示します。
-opt (別名: opts, option, options)
- 設定された :doc:`options` 一覧を表示します。
-opt ``name`` (別名: opts, option, options)
- 名前 ``name`` の :doc:`options` が持つ値を表示します。
-opt ``name`` ``value`` (別名: opts, option, options)
- 名前 ``name`` の :doc:`options` が持つ値を ``value`` に更新します。
-refresh
- フォローしているユーザ一覧を再読み込みさせます。
diff --git a/docs/conf.py b/docs/conf.py
deleted file mode 100644
index 9f06013..0000000
--- a/docs/conf.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# atig documentation build configuration file, created by
-# sphinx-quickstart on Mon Mar 15 15:36:01 2010.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys, os
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
-
-# -- General configuration -----------------------------------------------------
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.ifconfig']
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'atig.rb'
-copyright = u'2010-2013, mzp'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '0.4'
-# The full version, including alpha/beta/rc tags.
-release = '0.4.3'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = ['_build']
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. Major themes that come with
-# Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'sphinxdoc'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_use_modindex = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'atigdoc'
-
-
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ('index', 'atig.tex', u'atig.rb Documentation',
- u'mzp', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_use_modindex = True
diff --git a/docs/config.rst b/docs/config.rst
deleted file mode 100644
index dec92e5..0000000
--- a/docs/config.rst
+++ /dev/null
@@ -1,159 +0,0 @@
-設定
-==============================
-
-概要
-------------------------------
- - atig.rbは起動時に `~/.atig/config` を読み込みます。
- - `~/.atig/config` はRubyのコードが記述可能です。
- - `Atig::Gateway::Session.<some_field>` を変更すると、atig.rbの動作をカスタマイズできます。
-
-利用可能なコマンドの変更
-------------------------------
-`Atig::Gateway::Session.commands` を変更すれば、利用可能な :doc:`commands` を変更できます::
-
- Atig::Gateway::Session.commands = [
- Atig::Command::Retweet,
- Atig::Command::Reply,
- ..
- ]
-
-標準で次のコマンドが用意されています。
-
-Atig::Command::Retweet
- ``/me retweet ...`` を提供するクラス
-Atig::Command::Reply
- ``/me reply ...`` を提供するクラス
-Atig::Command::User
- ``/me user ...`` を提供するクラス
-Atig::Command::Favorite
- ``/me fav, unfav ...`` を提供するクラス
-Atig::Command::Uptime
- ``/me uptime ...`` を提供するクラス
-Atig::Command::Destroy
- ``/me destory ...`` を提供するクラス
-Atig::Command::Status
- 通常の発言時に使われる内部コマンド
-Atig::Command::Thread
- ``/me thread ...`` を提供するクラス
-Atig::Command::Time
- ``/me time ...`` を提供するクラス
-Atig::Command::Version
- ``/me verison ...`` を提供するクラス
-Atig::Command::UserInfo
- ``/me userinfo ...`` を提供するクラス
-Atig::Command::Whois
- ``/whois ...`` を提供するクラス
-Atig::Command::Option
- ``/me opt ...`` を提供するクラス
-Atig::Command::Limit
- ``/me limit`` を提供するクラス
-Atig::Command::Search
- ``/me search`` を提供するクラス
-Atig::Command::Refresh
- ``/me refresh`` を提供するクラス
- Atig::Command::Spam,
-
-取得するAPIの変更
-------------------------------
-`Atig::Gateway::Session.agents` を変更すると、発言やFollowingを取得するのに利用するAPIを変更できます。::
-
- Atig::Gateway::Session.agents = [
- Atig::Agent::List,
- Atig::Agent::Following,
- ...
- ]
-
-標準で次のAgentが用意されています。
-
-Atig::Agent::OwnList
- 自分のリストのfollowingを取得します。FullListと同時に指定できません。
-Atig::Agent::FullList
- 自分のリストと自分がフォローしているリストのfollowingを取得します。OwnListと同時に指定できません。
-Atig::Agent::Following
- 自分のfollowingを取得します。
-Atig::Agent::ListStatus
- リスト内の発言を取得します。フォローせずに、Listでだけfollowしている人の発言を取得するために必要です。
-Atig::Agent::Mention
- 自分への言及(mention)を取得します。
-Atig::Agent::Dm
- 自分へのダイレクトメッセージを取得します。
-Atig::Agent::Timeline
- 自分のタイムラインを取得します。
-Atig::Agent::Cleanup
- 定期的にキャッシュのうち、古い内容を削除します。
-
-取得した発言の加工方法の変更
-------------------------------
-`Atig::Gateway::Session.ifilters` を変更すると、取得した発言の加工方法を変更できます。::
-
- Atig::Gateway::Session.ifilters = [
- Atig::IFilter::Utf7,
- Atig::IFilter::Sanitize,
- ...
- ]
-
-標準で次のIFilterが用意されています。
-
-Atig::IFilter::Utf7
- utf7をデコードします。
-Atig::IFilter::Sanitize
- > などを置き換えます。
-Atig::IFilter::ExpandUrl
- 短縮URLを展開します。
-Atig::IFilter::Strip.new([``footer1``, ``footer2``, ...])
- 指定したフッタを除去します。
-Atig::IFilter::Retweet
- 公式RTの先頭に♺ をつけます。
-Atig::IFilter::RetweetTime
- 公式RTの末尾に元発言の日時を表示します。
-Atig::IFilter::Tid
- 発言の末尾に、tidをつけます。 :doc:`options` も参照してください。
-Atig::IFilter::Sid
- 発言の末尾に、sidをつけます。 :doc:`options` も参照してください。
-
-自分の発言の加工
-------------------------------
-`Atig::Gateway::Session.ofilters` を変更すると、自分の発言の加工方法を変更できます。::
-
-Atig::Gateway::Session.ofilters = [
- Atig::OFilter::EscapeUrl,
- Atig::OFilter::ShortUrl,
- Atig::OFilter::Geo,
- Atig::OFilter::Footer,
- ]
-
-標準で次のOFilterが用意されています。
-
-Atig::OFilter::EscapeUrl
- URLエスケープを行ないます。
-Atig::OFilter::ShortUrl
- URLを短縮します。 :doc:`options` も参照してください。
-Atig::OFilter::Geo
- 位置情報を付加します。 :doc:`options` も参照してください。
-Atig::OFilter::Footer
- フッターを付加します。 :doc:`options` も参照してください。
-
-チャンネルの変更
-------------------------------
-`Atig::Gateway::Session.channels` を変更すると、作成するチャンネルを変更できます。::
-
- Atig::Gateway::Session.channels = [
- Atig::Channel::Timeline,
- Atig::Channel::Mention,
- Atig::Channel::Dm,
- Atig::Channel::List,
- Atig::Channel::Retweet
- ]
-
-標準で次のChannelが用意されています。
-
-Atig::Channel::Timeline
- フォローしている人全員の発言を表示する `#twitter` を作成します。
-Atig::Channel::Mention
- 自分への言及を表示する `#mention` を作成します。
-Atig::Channel::Retweet
- 自分のフォローしている人の公式RTを表示する `#retweet` を作成します。
-Atig::Channel::Dm
- DMの受信時にチャンネルを作成します。
-Atig::Channel::List
- リストごとにチャンネルを作成します。
diff --git a/docs/feature.rst b/docs/feature.rst
deleted file mode 100644
index 8abf957..0000000
--- a/docs/feature.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-atig.rbの特徴
-==============================
-
-主な機能
-------------------------------
- * フレンドタイムライン/DM/Mentionの取得
- * OAuthによる認証
- * ListsによるFollowingの分類
- * 公式RT/コメント付き非公式RT
- * IRCクライアントならなんでも使える柔軟性
-
-動作環境
-------------------------------
-開発時には以下の環境でテストしています。
-
- * MacOS 10.5(Leopard) + Ruby 1.9
- * MacOS 10.6(Snow Leopard) + Ruby 1.9
- * CentOS 5.3 + Ruby 1.8
-
-スクリーンショット
-------------------------------
-
-`Lime Chat`_
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. _Lime Chat: http://limechat.net/
-
-.. image:: _static/limechat.png
-
-`Irssi`_
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. _Irssi: http://www.irssi.org/
-
-.. image:: _static/irssi.png
-
-`Riece`_ on Emacs.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. _Riece: http://www.nongnu.org/riece/index.html.ja
-
-.. image:: _static/emacs.png
-
diff --git a/docs/hacking_guide.rst b/docs/hacking_guide.rst
deleted file mode 100644
index d482571..0000000
--- a/docs/hacking_guide.rst
+++ /dev/null
@@ -1,43 +0,0 @@
-内部構造
-==============================
-
-
-全体図
-------------------------------
-
-.. image:: _static/structure.png
-
-Twitter
-------------------------------
-
- - TwitterのAPIを叩くためのクラス
-
-Scheduler
-------------------------------
-
- - API呼び出し回数を最適化するためのクラス(予定)
-
-
-Agent
-------------------------------
-
- - Twitterから情報を取得し、DBに登録するクラス
- - 例: メインタイムラインを取得し、DBに登録する
-
-Db
-------------------------------
-
-Gateway
-------------------------------
-
-Channel
-------------------------------
-
-IFilter
-------------------------------
-
-OFilter
-------------------------------
-
-Command
-------------------------------
diff --git a/docs/index.rst b/docs/index.rst
deleted file mode 100644
index b29629a..0000000
--- a/docs/index.rst
+++ /dev/null
@@ -1,102 +0,0 @@
-.. atig documentation master file, created by
- sphinx-quickstart on Mon Mar 15 15:36:01 2010.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-atig.rb : Another Twitter Irc Gateway
-==================================
-atig.rbはTwitterとIRCを結ぶゲートウェイです。
-
-スクリーンショット
-------------------------------
-
-.. image:: _static/limechat_s.png
-
-ダウンロード
-------------------------------
-
- - 安定板: `atigrb-0.4.3.tgz`_. ( `過去のバージョン`_ )
- - 開発版: `Github Repository`_.
-
-.. _atigrb-0.4.3.tgz: http://github.com/mzp/atig/tarball/v0.4.3
-.. _過去のバージョン: http://github.com/mzp/atig/tags
-.. _GitHub Repository: http://github.com/mzp/atig
-
-特徴
-------------------------------
-
-必要なのはIRCクライアントだけ
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- - IRCクライアントさえあれば、どこからでもTwitterできます。
- - CUI中毒やEmacs中毒の方でも安心してお使いいただけます。
-
-Listsにも対応してます
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- - Listsはチャンネルになります。
-
-大抵のOSで動きます
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- - Rubyで書いてあるので大抵のOSで動作します。
-
-IRC用のソフトが流用できます。
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- - 既存のIRC用のソフトを流用することができます。
- - 例えば、IRCプロキシであるTiarraと連携させることで、24時間Twitterのログがとることが可能です。
-
-
-
-.. 構造化された設計
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- ~ tig.rbよりいいよ
-
-その他のドキュメント
-------------------------------
-.. toctree::
- :maxdepth: 2
-
- quickstart
- feature
- irc
- commandline_options
- options
- commands
- config
- tig
- changelog
-
-バグ、疑問点、不満点を見つけたときは
-------------------------------------
-
-こんな場合は、mzpまで気軽にご連絡ください。
-できる範囲でサポートします。
-
- - atig の挙動がおかしい
- - 設定の仕方がよく分からない
- - 欲しい機能がなかった
- - atig に足りないクールな機能を実装したぜ
-
-連絡方法は以下のものがあります。それ以外の方法でもmzpまでに届けばかまいません。
-
- - Githubの `Issues`_ に登録する。
- - `@mzp`_ 宛につぶやく。
- - `Blog`_ の適当なページにコメントをつける
- - Githubでforkして、pull requestを送る
-
-.. _Issues: http://github.com/mzp/atig/issues
-.. _ at mzp: http://twitter.com/mzp/
-.. _Blog: http://d.hatena.ne.jp/mzp/
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`search`
-
-
-.. |heart| replace:: ♥
diff --git a/docs/irc.rst b/docs/irc.rst
deleted file mode 100644
index 84f1663..0000000
--- a/docs/irc.rst
+++ /dev/null
@@ -1,31 +0,0 @@
-IRCコマンド
-==============================
-
-nickなどの扱い
-------------------------------
-
- - nick: OAuthのプロファイル名、ベーシック認証時のユーザ名
- - real: クライアントオプション。詳細は :doc:`options` を参照してください。
- - pass: ベーシック認証時のパスワード
-
-IRCコマンドとの対応
-------------------------------
-
-\/invite ``screen_name`` ``channel``
- ``channel`` がメインチャンネル(通常は#twitter)の場合、ユーザ ``screen_name`` をフォローします。 同時にユーザ一覧の更新も行なうので、「follow ``screen_name`` 」と発言するよりも便利です。
-
- ``channel`` がリストチャンネルの場合、ユーザ ``screen_name`` をリストに追加します。
-
-\/kick ``screen_name`` ``channel``
- ``channel`` がメインチャンネル(通常は#twitter)の場合、ユーザ ``screen_name`` をリムーブします。
-
- ``channel`` がリストチャンネルの場合、ユーザ ``screen_name`` をリストから削除します。
-
-\/whois ``screen_name``
- ``screen_name`` の情報を表示します。ID番号、名前、自己紹介、現在地などを表示します。
-
-\/topic ``topic``
- :doc:`commands` の `autofix` へのエイリアスです。
- ``topic`` が前回の発言と類似している場合、古い発言を上書きします。
-\/who ``channel``
- ``channel`` の参加者の情報を表示します。ID番号、名前などを表示します。
diff --git a/docs/options.rst b/docs/options.rst
deleted file mode 100644
index b56220e..0000000
--- a/docs/options.rst
+++ /dev/null
@@ -1,76 +0,0 @@
-クライアントオプション
-==================================
-
-概要
-------------------------------
-realnameのユーザ名の後ろにいろいろと書くことで、各オプションを有効にできます。
-
-例えば次のようにすると、tidオプションとonlyオプションが有効になります。 ::
-
- twitter {
- host: localhost
- port: 19876
- name: mzp tid only
- }
-
-:doc:`commands` のoptコマンドを用いると、実行中に変更できます。
-
-発言関係
-------------------------------
-tid
- 各発言にtidを表示します。tidは特定の発言へreplyする場合などに利用します。
-
- :doc:`commands` も参照してください。
-sid
- 各発言にsidを表示します。sidはtidと同様に利用できます。
-
- sidは ``ユーザ名``:\ ``id`` という書式にです。そのため、
- ユーザ名の補完機能のあるクライアントではtidより入力が容易です。
-
-フォロワー関係
-------------------------------
-only
- 指定すると片思い表示機能を有効にします。有効にしていると、自分が一方的
- にフォローしている人に ``+o`` がつきます。たいていのクライアントだと
- ``@`` がつきます。
-
-発言関連
-------------------------------
-stream
- `UserStream`_ を有効にします。
- 実行中の変更には対応していません。
-footer=\ ``footer``
- 発言の末尾に、 ``footer`` を追加します。
- ただし ``footer`` がfalseの場合は、追加しません。
-old_style_reply
- @nickで始まる発言が、@nick の最新の発言へのreplyとなるモードに切り替えます。
-
-.. _UserStream: https://dev.twitter.com/docs/streaming-apis/streams/user
-
-URL短縮関係
-------------------------------
-
-発言中の長いURLを自動で短縮します。どの短縮URLサービスを用いて短縮する
-か、どの程度の長さのURLを短縮するか、などが設定できます。
-
-bitlify
- |len|\ 字以上のURLを http://bit.ly\ によって短縮します。
-bitlify=\ ``size``
- ``size``\ 字以上のURLを http://bit.ly\ によって短縮します。
-bitlify=\ ``username``:\ ``api_key``
- |len|\ 字以上のURLを http://bit.ly のAPIによって短縮します。
-bitlify=\ ``username``:\ ``api_key``:\ ``size``
- ``size``\ 字以上のURLを http://bit.ly のAPIによって短縮します。
- APIを利用して短縮すると、ユーザページに短縮したURLが記録されたりします。
- 詳しくは、 http://bit.ly のSign up for bit.lyを読んでください。
-
-.. |len| replace:: 20
-
-システム関係
-------------------------------
-api_base=\ ``api_base``
- Twitterのエントリポイントを指定します。実行中の変更には対応していません。指定しない場合は、https://api.twitter.com/1/が用いられます。
-.. stream_api_base=\ ``api_base``
- Stream APIのエントリポイントを指定します。実行中の変更には対応していません。指定しない場合は、http://stream.twitter.com/1/'が用いられます。
- stream_timeout=\ ``timeout``
- Stream APIの接続は一定時間ごとに再接続を行ないます。その時間間隔を指定します。0を指定した場合は、再接続を行ないません。
diff --git a/docs/quickstart.rst b/docs/quickstart.rst
deleted file mode 100644
index caa2179..0000000
--- a/docs/quickstart.rst
+++ /dev/null
@@ -1,96 +0,0 @@
-クイックスタート
-================
-
-必要なソフトウェア
-------------------------------
-以下のものが必要です。
-
- - Ruby 1.8/1.9
- - Sqlite3
- - 適当なIRCクライアント(例: `LimeChat`_ )
-
-.. _LimeChat: http://limechat.net/
-
-またRubyには次のライブラリがインストールされている必要があります。
-
- - oauth
- - sqlite3-ruby
- - json(Ruby 1.8の場合, Ruby 1.9の場合は不要)
- - rspec(単体テストを実行する場合, 開発者以外は不要)
- - rake(単体テストを実行する場合, 開発者以外は不要)
-
-インストール
-------------
-
-リリース版
-~~~~~~~~~~
-Rubygemsを使用してインストールしてください。::
-
- $ gem install atig
-
-または `GitHub`_ からダウンロードしてください。
-
-.. _GitHub: http://github.com/mzp/atig/downloads
-
-trunk版
-~~~~~~~~~~
-githubからpullしてください。::
-
- $ git clone https://github.com/mzp/atig.git
-
-使ってみる
-----------
-
-起動
-~~~~~~~~~
-コマンドラインから起動します。::
-
- $ atig -d
-
-githubからダウンロードした場合::
-
- $ cd atig
- $ bin/atig -d
- I, [2010-04-05T07:22:07.861527 #62002] INFO -- : Host: localhost Port:16668
-
-接続
-~~~~~~~~~
-IRCクライアントで、localhost:16668に接続します。
-
- - nickname: Twitterのユーザ名
- - login name: 使ってないので適当に
- - real name: :doc:`options` 。tidがおすすめです。
- - password: 空欄
- - 詳しくは :doc:`irc` を参照してください。
-
-.. image:: _static/irc_setting.png
-
-
-
-OAuth認証
-~~~~~~~~~
-初回接続時のみ、OAuthで認証させる必要があります。
-接続時に#oauthにjoinされ、認証用のURLが表示されます。
-
-.. image:: _static/oauth_channel.png
-
-表示されたURLにアクセスし、atig.rbに認証を与えます。
-
-.. image:: _static/allow.png
-
-7桁の数字が表示されるので、それを#oauthに入力します。
-
-.. image:: _static/verify.png
-
-発言してみる
-~~~~~~~~~~~~
- - #twitterで発言すると、Twitterに投稿されます。
- - :doc:`commands` を用いると、RTやreplyが行なえます。
-
-さらに詳しい使い方
---------------------
-
- - Tiarraと連携させると、発言のログを取ることができす。
- - `God`_ などと連携させると、atig.rbを常駐(デーモン化)させることができます。
-
-.. _God: http://god.rubyforge.org/
diff --git a/docs/resize.sh b/docs/resize.sh
deleted file mode 100755
index dffe50e..0000000
--- a/docs/resize.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-for i in $@; do
- echo $i
- mv $i $i.$$
- convert -resize 300x300 $i.$$ $i
- rm -f $i.$$
-done
diff --git a/docs/tiarra.rst b/docs/tiarra.rst
deleted file mode 100644
index ba8a836..0000000
--- a/docs/tiarra.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Tiarraとの連携
-==============
diff --git a/docs/tig.rst b/docs/tig.rst
deleted file mode 100644
index 7d70df4..0000000
--- a/docs/tig.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-tig.rbとの違い
-==================================
-atig.rbは `tig.rb`_ から派生したプロジェクトです。
-
-.. _tig.rb: http://github.com/cho45/net-irc
-
-そのため基本的な機能は同様ですが、いくつかの細かい点が異なります。
-
-機能の違い
-------------------------------
-
- - 認証にxAuthではなくOAuthを使う。
- - ツイートを指定するのにtidだけでなくsidが使える。 sidは :doc:`options` の `sid` を参照してください。
- - 一部の :doc:`commands` の名前が異なる。例: tig.rbだと `list` 、atig.rbでは `user`\ 。
- - 自分への言及を表示する `#mention` チャンネルや、リツイートを表示する `#retweet` チャンネルがある。 :doc:`config` の「チャンネルの変更」で変更できます。
- - 自分への言及が `#twitter` チャンネルに表示されません。
-
-その他の違い
-------------------------------
- - クラス単位でファイルを分割しているます。たぶん、コードをいじりやすいはず。
- - :doc:`commands` は本体のコードを触らずに拡張可能(たぶん)
diff --git a/bin/atig b/exe/atig
similarity index 100%
rename from bin/atig
rename to exe/atig
diff --git a/lib/atig/agent/agent.rb b/lib/atig/agent/agent.rb
index e4901c8..0f2f305 100644
--- a/lib/atig/agent/agent.rb
+++ b/lib/atig/agent/agent.rb
@@ -15,18 +15,18 @@ module Atig
log :info, "initialize"
@api.repeat( interval ) do|t|
- q = { :count => 200 }
+ q = { count: 200 }
if @prev
- q.update :since_id => @prev
+ q.update since_id: @prev
else
- q.update :count => 20
+ q.update count: 20
end
sources = t.get( path, q)
sources.reverse_each do|s|
db.statuses.transaction do|d|
- d.add :source => source, :status => s, :user => s.user
+ d.add source: source, status: s, user: s.user
end
end
diff --git a/lib/atig/agent/dm.rb b/lib/atig/agent/dm.rb
index 8dbb21b..bc80dca 100644
--- a/lib/atig/agent/dm.rb
+++ b/lib/atig/agent/dm.rb
@@ -15,18 +15,18 @@ module Atig
log :info, "initialize"
@api.repeat(600) do|t|
- q = { :count => 200 }
+ q = { count: 200 }
if @prev
- q.update :since_id => @prev
+ q.update since_id: @prev
else
- q.update :count => 1
+ q.update count: 1
end
dms = t.get("direct_messages", q)
log :debug, "You have #{dms.size} dm."
dms.reverse_each do|dm|
db.dms.transaction do|d|
- d.add :status => dm, :user => dm.sender
+ d.add status: dm, user: dm.sender
end
end
end
diff --git a/lib/atig/agent/following.rb b/lib/atig/agent/following.rb
index 7a55ac2..78fa557 100644
--- a/lib/atig/agent/following.rb
+++ b/lib/atig/agent/following.rb
@@ -22,15 +22,15 @@ module Atig
def update(api)
if @db.followings.empty?
- friends = api.page("friends/list", :users, {:user_id => @db.me.id, :count => 100})
+ friends = api.page("friends/list", :users, {user_id: @db.me.id, count: 100})
else
@db.me = api.post("account/update_profile")
return if @db.me.friends_count == @db.followings.size
- friends = api.page("friends/list", :users, {:user_id => @db.me.id, :count => 100})
+ friends = api.page("friends/list", :users, {user_id: @db.me.id, count: 100})
end
if @opts.only
- followers = api.page("friends/ids", :ids, {:user_id => @db.me.id, :count => 2500})
+ followers = api.page("friends/ids", :ids, {user_id: @db.me.id, count: 2500})
friends.each do|friend|
friend[:only] = !followers.include?(friend.id)
end
diff --git a/lib/atig/agent/list.rb b/lib/atig/agent/list.rb
index ccae90e..a3afdef 100644
--- a/lib/atig/agent/list.rb
+++ b/lib/atig/agent/list.rb
@@ -18,7 +18,7 @@ module Atig
if name == :all then
full_update t
else
- @db.lists[name].update t.page("lists/members", :users, {:owner_screen_name => @db.me.screen_name, :slug => name})
+ @db.lists[name].update t.page("lists/members", :users, {owner_screen_name: @db.me.screen_name, slug: name})
end
end
end
@@ -41,7 +41,7 @@ module Atig
end
begin
users[name] =
- t.page("lists/members", :users, {:owner_screen_name => list.user.screen_name, :slug => list.slug})
+ t.page("lists/members", :users, {owner_screen_name: list.user.screen_name, slug: list.slug})
rescue => e
log :error, e.inspect
users[name] =
diff --git a/lib/atig/agent/list_status.rb b/lib/atig/agent/list_status.rb
index b1549d6..e4260b8 100644
--- a/lib/atig/agent/list_status.rb
+++ b/lib/atig/agent/list_status.rb
@@ -18,17 +18,17 @@ class Atig::Agent::ListStatus
db.lists.each do |name, _|
log :debug, "retrieve #{name} statuses"
q = {}
- q.update(:since_id => @prev[name]) if @prev.key?(name)
+ q.update(since_id: @prev[name]) if @prev.key?(name)
screen_name, slug = parse name
- q.update(:owner_screen_name => screen_name, :slug => slug)
+ q.update(owner_screen_name: screen_name, slug: slug)
statuses = t.get("lists/statuses", q)
statuses.reverse_each do|status|
db.statuses.transaction do|d|
- d.add(:status => status,
- :user => status.user,
- :source => :list,
- :list => name)
+ d.add(status: status,
+ user: status.user,
+ source: :list,
+ list: name)
end
end
@prev[name] = statuses[0].id if statuses && statuses.size > 0
diff --git a/lib/atig/agent/stream_follow.rb b/lib/atig/agent/stream_follow.rb
index 2709e05..892a52f 100644
--- a/lib/atig/agent/stream_follow.rb
+++ b/lib/atig/agent/stream_follow.rb
@@ -24,10 +24,10 @@ module Atig
@api.stream do|t|
Thread.pass until @follows
- t.watch('statuses/filter', :follow => @follows) do |status|
+ t.watch('statuses/filter', follow: @follows) do |status|
if status and status.user
db.transaction do|d|
- d.statuses.add :status => status, :user => status.user, :source => :stream_follow
+ d.statuses.add status: status, user: status.user, source: :stream_follow
end
end
end
diff --git a/lib/atig/agent/user_stream.rb b/lib/atig/agent/user_stream.rb
index ae7832d..26eb614 100644
--- a/lib/atig/agent/user_stream.rb
+++ b/lib/atig/agent/user_stream.rb
@@ -16,7 +16,7 @@ module Atig
log :info, "initialize"
@api.stream do|t|
- options = context.opts.allreplies ? {:replies => :all} : {}
+ options = context.opts.allreplies ? {replies: :all} : {}
t.watch('user', options) do |status|
# @log.debug status.inspect
@@ -24,11 +24,11 @@ module Atig
if status.direct_message
dm = status.direct_message
db.dms.transaction do|d|
- d.add :status => dm, :user => dm.sender
+ d.add status: dm, user: dm.sender
end
elsif status and status.user
db.statuses.transaction do|d|
- d.add :status => status, :user => status.user, :source => :user_stream
+ d.add status: status, user: status.user, source: :user_stream
end
elsif status and status.event
case status.event
diff --git a/lib/atig/basic_twitter.rb b/lib/atig/basic_twitter.rb
index 9ee7474..fda1b38 100755
--- a/lib/atig/basic_twitter.rb
+++ b/lib/atig/basic_twitter.rb
@@ -29,8 +29,6 @@ module Atig
uri.path += ".json" if path != "users/username_available"
uri.query = query.to_query_str unless query.empty?
- header = {}
-
begin
ret = request(uri, opts)
rescue OpenSSL::SSL::SSLError => e
@@ -99,7 +97,7 @@ module Atig
methods.each do |m|
self.module_eval <<END
def #{m}(path, query = {}, opts = {})
- opts.update( :method => :#{m})
+ opts.update( method: :#{m})
api path, query, opts
end
END
diff --git a/lib/atig/bitly.rb b/lib/atig/bitly.rb
index 0046f25..a7152be 100644
--- a/lib/atig/bitly.rb
+++ b/lib/atig/bitly.rb
@@ -27,7 +27,7 @@ module Atig
if @login and @key
bitly.path = "/shorten"
bitly.query = {
- :format => "json", :longUrl => url, :login => @login, :apiKey => @key,
+ format: "json", longUrl: url, login: @login, apiKey: @key,
}.to_query_str(";")
req = @http.req(:get, bitly, {})
res = @http.http(bitly, 5, 10).request(req)
diff --git a/lib/atig/channel/channel.rb b/lib/atig/channel/channel.rb
index c7cce70..8f8f43c 100644
--- a/lib/atig/channel/channel.rb
+++ b/lib/atig/channel/channel.rb
@@ -5,7 +5,7 @@ module Atig
class Channel
def initialize(context, gateway, db)
@db = db
- @channel = gateway.channel channel_name, :handler=>self
+ @channel = gateway.channel channel_name, handler:self
@channel.join_me
db.statuses.listen do|entry|
diff --git a/lib/atig/channel/list.rb b/lib/atig/channel/list.rb
index 274274a..aaeb746 100644
--- a/lib/atig/channel/list.rb
+++ b/lib/atig/channel/list.rb
@@ -12,14 +12,14 @@ module Atig
def on_invite(api, nick)
return if @name.include? '^'
- api.post("lists/members/create", :screen_name => nick, :owner_screen_name => @db.me.screen_name, :slug => @name )
+ api.post("lists/members/create", screen_name: nick, owner_screen_name: @db.me.screen_name, slug: @name )
@db.lists.invalidate @name
end
def on_kick(api, nick)
return if @name.include? '^'
- api.post("lists/members/destroy", :screen_name => nick, :owner_screen_name => @db.me.screen_name, :slug => @name )
+ api.post("lists/members/destroy", screen_name: nick, owner_screen_name: @db.me.screen_name, slug: @name )
@db.lists.invalidate @name
end
@@ -31,7 +31,7 @@ module Atig
def initialize(context, gateway, db)
@channels = Hash.new do|hash,name|
- channel = gateway.channel "##{name}", :handler => Handler.new(db, name)
+ channel = gateway.channel "##{name}", handler: Handler.new(db, name)
channel.join_me
hash[name] = channel
end
diff --git a/lib/atig/channel/retweet.rb b/lib/atig/channel/retweet.rb
index 343f3a7..b47e379 100644
--- a/lib/atig/channel/retweet.rb
+++ b/lib/atig/channel/retweet.rb
@@ -7,7 +7,7 @@ module Atig
def initialize(context, gateway, db)
super
- db.statuses.find_all(:limit=>50).reverse_each {|entry|
+ db.statuses.find_all(limit:50).reverse_each {|entry|
message entry
}
diff --git a/lib/atig/channel/timeline.rb b/lib/atig/channel/timeline.rb
index 9eaea00..0ef28bc 100644
--- a/lib/atig/channel/timeline.rb
+++ b/lib/atig/channel/timeline.rb
@@ -16,7 +16,7 @@ module Atig
@channel.notify "Client options: #{context.opts.marshal_dump.inspect}"
# つないだときに発言がないとさみしいので
- db.statuses.find_all(:limit=>50).reverse_each do|entry|
+ db.statuses.find_all(limit:50).reverse_each do|entry|
case entry.source
when :timeline, :me
@channel.message entry
diff --git a/lib/atig/command/autofix.rb b/lib/atig/command/autofix.rb
index 26e5ce1..e85c4e0 100644
--- a/lib/atig/command/autofix.rb
+++ b/lib/atig/command/autofix.rb
@@ -31,17 +31,17 @@ module Atig
return
end
text = mesg.split(" ", 2)[1]
- q = gateway.output_message(:status => text)
+ q = gateway.output_message(status: text)
- prev,*_ = db.statuses.find_by_user( db.me, :limit => 1)
+ prev,*_ = db.statuses.find_by_user( db.me, limit: 1)
unless fix?(command, q[:status], prev) then
- api.delay(0, :retry=>3) do|t|
+ api.delay(0, retry:3) do|t|
ret = t.post("statuses/update", q)
gateway.update_status ret, target
end
else
- api.delay(0, :retry=>3) do|t|
+ api.delay(0, retry:3) do|t|
yield "Similar update in previous. Conclude that it has error."
yield "And overwrite previous as new status: #{q[:status]}"
diff --git a/lib/atig/command/destroy.rb b/lib/atig/command/destroy.rb
index 365ff77..9f798a4 100644
--- a/lib/atig/command/destroy.rb
+++ b/lib/atig/command/destroy.rb
@@ -18,7 +18,7 @@ module Atig
if entry = Info.find_status(db, tid)
if entry.user.id == db.me.id
api.delay(0) do|t|
- res = t.post("statuses/destroy/#{entry.status.id}")
+ t.post("statuses/destroy/#{entry.status.id}")
yield "Destroyed: #{entry.status.text}"
db.statuses.transaction do|d|
diff --git a/lib/atig/command/dm.rb b/lib/atig/command/dm.rb
index 64b0a02..7f77603 100644
--- a/lib/atig/command/dm.rb
+++ b/lib/atig/command/dm.rb
@@ -20,8 +20,8 @@ module Atig
text = mesg.split(" ", 3)[2]
api.delay(0) do|t|
t.post("direct_messages/new",{
- :screen_name => user,
- :text => text
+ screen_name: user,
+ text: text
})
yield "Sent message to #{user}: #{text}"
end
diff --git a/lib/atig/command/favorite.rb b/lib/atig/command/favorite.rb
index 73e8808..9604d4a 100644
--- a/lib/atig/command/favorite.rb
+++ b/lib/atig/command/favorite.rb
@@ -14,7 +14,7 @@ module Atig
args.each do|tid|
if entry = Info.find_status(db, tid)
api.delay(0){|t|
- res = t.post("favorites/#{method}", {:id => entry.status.id})
+ t.post("favorites/#{method}", {id: entry.status.id})
yield "#{command.upcase}: #{entry.user.screen_name}: #{entry.status.text}"
}
else
diff --git a/lib/atig/command/info.rb b/lib/atig/command/info.rb
index 6b9d7e2..f5896dd 100644
--- a/lib/atig/command/info.rb
+++ b/lib/atig/command/info.rb
@@ -21,7 +21,7 @@ module Atig
api.delay(0) do|t|
status = t.get "statuses/show/#{id}"
db.statuses.transaction do|d|
- d.add :status => status, :user => status.user, :source => :thread
+ d.add status: status, user: status.user, source: :thread
f.call d.find_by_status_id(id)
end
end
@@ -30,7 +30,7 @@ module Atig
def find_status(db, tid_or_screen_name)
find = lambda do|x|
- xs = db.statuses.find_by_screen_name(x, :limit=>1)
+ xs = db.statuses.find_by_screen_name(x, limit:1)
unless xs.empty? then
xs.first
else
diff --git a/lib/atig/command/reply.rb b/lib/atig/command/reply.rb
index 8bc1121..2f619a5 100644
--- a/lib/atig/command/reply.rb
+++ b/lib/atig/command/reply.rb
@@ -21,8 +21,8 @@ module Atig
text = "@#{name} #{text}" if text.nil? or not text.include?("@#{name}")
- q = gateway.output_message(:status => text,
- :in_reply_to_status_id => entry.status.id)
+ q = gateway.output_message(status: text,
+ in_reply_to_status_id: entry.status.id)
api.delay(0) do|t|
ret = t.post("statuses/update", q)
diff --git a/lib/atig/command/retweet.rb b/lib/atig/command/retweet.rb
index a0b1139..cb51e7a 100644
--- a/lib/atig/command/retweet.rb
+++ b/lib/atig/command/retweet.rb
@@ -23,10 +23,10 @@ module Atig
chars = text.each_char.to_a
if chars.size > 140 then
- url = @bitly.shorten "http://twitter.com/#{entry.user.screen_name}/status/#{entry.status.id}"
+ url = @bitly.shorten "https://twitter.com/#{entry.user.screen_name}/status/#{entry.status.id}"
text = chars[0,140-url.size-1].join('') + ' ' + url
end
- q = gateway.output_message(:status => text)
+ q = gateway.output_message(status: text)
api.delay(0) do|t|
ret = t.post("statuses/update", q)
gateway.update_status ret,target, "RT to #{entry.user.screen_name}: #{entry.status.text}"
diff --git a/lib/atig/command/search.rb b/lib/atig/command/search.rb
index dd7cc61..d06a03f 100644
--- a/lib/atig/command/search.rb
+++ b/lib/atig/command/search.rb
@@ -17,7 +17,7 @@ module Atig
end
q = mesg.sub(/^#{command}\s+/, '')
- opts = { :q => q }
+ opts = { q: q }
while /^:(?:(lang)=(\w+))/ =~ args.first
opts[$1] = $2
q.sub!(/^#{args.first}\W+/, "")
@@ -35,7 +35,7 @@ module Atig
db.statuses.transaction do|d|
user = TwitterStruct.make('id' => status.from_user_id,
'screen_name' => status.from_user)
- d.add :status => status, :user => user, :source => :user
+ d.add status: status, user: user, source: :user
end
end
diff --git a/lib/atig/command/status.rb b/lib/atig/command/status.rb
index 3cbbd4e..76fc605 100644
--- a/lib/atig/command/status.rb
+++ b/lib/atig/command/status.rb
@@ -15,14 +15,14 @@ module Atig
return
end
text = mesg.split(" ", 2)[1]
- previous,*_ = db.statuses.find_by_user( db.me, :limit => 1)
+ previous,*_ = db.statuses.find_by_user( db.me, limit: 1)
if previous and
((::Time.now - ::Time.parse(previous.status.created_at)).to_i < 60*60*24 rescue true) and
text.strip == previous.status.text.strip
yield "You can't submit the same status twice in a row."
return
end
- q = gateway.output_message(:status => text)
+ q = gateway.output_message(status: text)
case tweet_invalid? q[:status]
when :too_long
@@ -33,7 +33,7 @@ module Atig
return
end
- api.delay(0, :retry=>3) do|t|
+ api.delay(0, retry:3) do|t|
ret = t.post("statuses/update", q)
gateway.update_status ret,target
end
diff --git a/lib/atig/command/user.rb b/lib/atig/command/user.rb
index c74edef..b972e20 100644
--- a/lib/atig/command/user.rb
+++ b/lib/atig/command/user.rb
@@ -20,15 +20,15 @@ module Atig
api.delay(0) do|t|
begin
statuses = t.get("statuses/user_timeline",
- { :count => count, :screen_name => nick})
+ { count: count, screen_name: nick})
statuses.reverse_each do|status|
db.statuses.transaction do|d|
- d.add :status => status, :user => status.user, :source => :user
+ d.add status: status, user: status.user, source: :user
end
end
db.statuses.
- find_by_screen_name(nick, :limit=>count).
+ find_by_screen_name(nick, limit:count).
reverse_each do|entry|
gateway[target].message entry, Net::IRC::Constants::NOTICE
end
diff --git a/lib/atig/command/version.rb b/lib/atig/command/version.rb
index aafb2a3..a4c7a2b 100644
--- a/lib/atig/command/version.rb
+++ b/lib/atig/command/version.rb
@@ -15,7 +15,7 @@ module Atig
end
nick,*_ = args
- entries = db.statuses.find_by_screen_name(nick, :limit => 1)
+ entries = db.statuses.find_by_screen_name(nick, limit: 1)
if entries && !entries.empty? then
entry = TwitterStruct.make('user' => entries.first.user,
'status' => { 'text' =>
@@ -24,9 +24,9 @@ module Atig
else
api.delay(0) do|t|
begin
- user = t.get("users/show", { :screen_name => nick})
+ user = t.get("users/show", { screen_name: nick})
db.statuses.transaction do|d|
- d.add :user => user, :status => user.status, :source => :version
+ d.add user: user, status: user.status, source: :version
entry = TwitterStruct.make('user' => user,
'status' => { 'text' =>
format(user.status.source) })
diff --git a/lib/atig/db/followings.rb b/lib/atig/db/followings.rb
index b348529..dcff314 100644
--- a/lib/atig/db/followings.rb
+++ b/lib/atig/db/followings.rb
@@ -83,7 +83,6 @@ module Atig
}
names = users.map{|u| u.screen_name.inspect }.join(",")
- parts =
may_notify :part, db.execute(%{SELECT screen_name,data FROM users
WHERE screen_name NOT IN (#{names})}).map{|_,data|
@db.load(data)
@@ -109,11 +108,11 @@ module Atig
else
db.execute("INSERT INTO users
VALUES(NULL, :screen_name, :user_id, :protected, :only, :data)",
- :screen_name => user.screen_name,
- :user_id => user.id,
- :protected => bool(user.protected),
- :only => bool(user.only),
- :data => @db.dump(user))
+ screen_name: user.screen_name,
+ user_id: user.id,
+ protected: bool(user.protected),
+ only: bool(user.only),
+ data: @db.dump(user))
end
end
end
diff --git a/lib/atig/db/statuses.rb b/lib/atig/db/statuses.rb
index e753651..492a9e5 100644
--- a/lib/atig/db/statuses.rb
+++ b/lib/atig/db/statuses.rb
@@ -63,17 +63,17 @@ module Atig
screen_name = opt[:user].screen_name
sum = db.get_first_value("SELECT sum(count) FROM id").to_i
count = db.get_first_value("SELECT count FROM id WHERE screen_name = ?", screen_name).to_i
- entry = OpenStruct.new opt.merge(:tid => @roman.make(sum),
- :sid => "#{screen_name}:#{@roman.make(count)}")
+ entry = OpenStruct.new opt.merge(tid: @roman.make(sum),
+ sid: "#{screen_name}:#{@roman.make(count)}")
db.execute(%{INSERT INTO status
VALUES(NULL, :id, :tid, :sid, :screen_name, :user_id, :created_at, :data)},
- :id => id,
- :tid => entry.tid,
- :sid => entry.sid,
- :screen_name => screen_name,
- :user_id => opt[:user].id,
- :created_at => Time.parse(opt[:status].created_at).to_i,
- :data => @db.dump(entry))
+ id: id,
+ tid: entry.tid,
+ sid: entry.sid,
+ screen_name: screen_name,
+ user_id: opt[:user].id,
+ created_at: Time.parse(opt[:status].created_at).to_i,
+ data: @db.dump(entry))
if count == 0 then
db.execute("INSERT INTO id VALUES(NULL,?,?)", screen_name, 1)
else
@@ -129,8 +129,10 @@ module Atig
private
def find(lhs,rhs, opt={},&f)
+ rhs.encoding!("UTF-8") if rhs.respond_to? :encoding!
+
query = "SELECT id,data FROM status WHERE #{lhs} = :rhs ORDER BY created_at DESC LIMIT :limit"
- params = { :rhs => rhs, :limit => opt.fetch(:limit,20) }
+ params = { rhs: rhs, limit: opt.fetch(:limit,20) }
res = []
@db.execute do|db|
diff --git a/lib/atig/db/transaction.rb b/lib/atig/db/transaction.rb
index adfc455..6ea1988 100644
--- a/lib/atig/db/transaction.rb
+++ b/lib/atig/db/transaction.rb
@@ -18,7 +18,7 @@ module Atig
if respond_to?(:timeout_interval) && timeout_interval > 0 then
begin
- timeout(timeout_interval){ f.call self }
+ Timeout.timeout(timeout_interval){ f.call self }
rescue TimeoutError
debug "transaction is timeout at #{src}"
end
diff --git a/lib/atig/gateway/channel.rb b/lib/atig/gateway/channel.rb
index 5a89ca1..6ed7199 100644
--- a/lib/atig/gateway/channel.rb
+++ b/lib/atig/gateway/channel.rb
@@ -44,7 +44,6 @@ END
def message(entry, command = PRIVMSG)
GC.start
user = entry.user
- screen_name = user.screen_name
prefix = prefix user
str = run_filters entry
@@ -88,7 +87,7 @@ END
private
def run_filters(entry)
- status = entry.status.merge(:tid=>entry.tid, :sid=>entry.sid)
+ status = entry.status.merge(tid:entry.tid, sid:entry.sid)
@filters.inject(status) {|x, f| f.call x }.text
end
diff --git a/lib/atig/gateway/session.rb b/lib/atig/gateway/session.rb
index e7b8b91..9eb5756 100644
--- a/lib/atig/gateway/session.rb
+++ b/lib/atig/gateway/session.rb
@@ -16,7 +16,7 @@ require 'atig/option'
begin
require 'continuation'
-rescue LoadError => e
+rescue LoadError
end
module Atig
@@ -50,7 +50,7 @@ END
def update_status(ret, target, msg='')
@db.transaction do|db|
- db.statuses.add(:source => :me, :status => ret, :user => ret.user )
+ db.statuses.add(source: :me, status: ret, user: ret.user )
end
msg = "(#{msg})" unless msg.empty?
@@ -58,12 +58,12 @@ END
end
def channel(name,opts={})
- opts.update(:session => self,
- :name => name,
- :filters => @ifilters,
- :prefix => @prefix,
- :nick => @nick,
- :opts => @opts)
+ opts.update(session: self,
+ name: name,
+ filters: @ifilters,
+ prefix: @prefix,
+ nick: @nick,
+ opts: @opts)
channel = Channel.new opts
@channels[name] = channel
channel
@@ -111,7 +111,7 @@ END
load_config
@opts = Atig::Option.parse @real
- context = OpenStruct.new(:log=>@log, :opts=>@opts)
+ context = OpenStruct.new(log:@log, opts:@opts)
oauth = OAuth.new(context, @nick)
unless oauth.verified? then
@@ -166,12 +166,12 @@ END
post server_name, MODE, @nick, "+o"
- @db = Atig::Db::Db.new context, :me=>me, :size=> 100, :tmpdir => @tmpdir
+ @db = Atig::Db::Db.new context, me:me, size: 100, tmpdir: @tmpdir
run_new @@commands, context, self, @api, @db
run_new @@agents , context, @api, @db
run_new @@channels, context, self, @db
- @db.statuses.add :user => me, :source => :me, :status => me.status
+ @db.statuses.add user: me, source: :me, status: me.status
end
end
@@ -210,7 +210,7 @@ END
def on_ctcp_action(target, mesg)
command, *args = mesg.split(" ")
last_match = nil
- commond = command.to_s.downcase
+ command = command.to_s.downcase
_, action = @ctcp_actions.find{|define, f|
r = (define === command)
last_match = Regexp.last_match
@@ -244,7 +244,7 @@ END
end
def on_kick(m)
- channel, nick, msg = *m.params
+ channel, nick, _ = *m.params
if not nick.screen_name? or @db.me.screen_name.casecmp(nick).zero?
post server_name, ERR_NOSUCHNICK, nick, "No such nick: #{nick}" # or yourself
diff --git a/lib/atig/http.rb b/lib/atig/http.rb
index 98f17e5..547fb61 100644
--- a/lib/atig/http.rb
+++ b/lib/atig/http.rb
@@ -9,10 +9,10 @@ module Atig
def self.proxy=(proxy)
if proxy =~ /\A(?:([^:@]+)(?::([^@]+))?@)?([^:]+)(?::(\d+))?\z/ then
@@proxy = OpenStruct.new({
- :user => $1,
- :password => $2,
- :address => $3,
- :port => $4.to_i,
+ user: $1,
+ password: $2,
+ address: $3,
+ port: $4.to_i,
})
end
end
diff --git a/lib/atig/ifilter/expand_url.rb b/lib/atig/ifilter/expand_url.rb
index aeb4496..224200d 100644
--- a/lib/atig/ifilter/expand_url.rb
+++ b/lib/atig/ifilter/expand_url.rb
@@ -18,7 +18,7 @@ module Atig
def call(status)
target = short_url_regexp
entities = (entities = status.entities).nil? ? [] : entities.urls
- status.merge :text => status.text.gsub(target) {|url|
+ status.merge text: status.text.gsub(target) {|url|
unless entities.nil? or entities.empty?
@cache[url] ||= search_url_from_entities(url, entities)
url = @cache[url] if @cache[url] =~ target
diff --git a/lib/atig/ifilter/retweet.rb b/lib/atig/ifilter/retweet.rb
index 55f6102..d6ad46a 100644
--- a/lib/atig/ifilter/retweet.rb
+++ b/lib/atig/ifilter/retweet.rb
@@ -7,7 +7,7 @@ module Atig
def self.call(status)
return status unless status.retweeted_status
rt = status.retweeted_status
- status.merge :text => "#{Prefix}RT @#{rt.user.screen_name}: #{rt.text}"
+ status.merge text: "#{Prefix}RT @#{rt.user.screen_name}: #{rt.text}"
end
end
end
diff --git a/lib/atig/ifilter/retweet_time.rb b/lib/atig/ifilter/retweet_time.rb
index 1e6e6f6..7ad6668 100644
--- a/lib/atig/ifilter/retweet_time.rb
+++ b/lib/atig/ifilter/retweet_time.rb
@@ -8,7 +8,7 @@ module Atig
status
else
t = Time.gm(*Time.parse(status.retweeted_status.created_at).to_a)
- status.merge :text => "#{status.text} \x0310[#{t.strftime "%Y-%m-%d %H:%M"}]\x0F"
+ status.merge text: "#{status.text} \x0310[#{t.strftime "%Y-%m-%d %H:%M"}]\x0F"
end
end
end
diff --git a/lib/atig/ifilter/sanitize.rb b/lib/atig/ifilter/sanitize.rb
index 9062708..1ca5d05 100644
--- a/lib/atig/ifilter/sanitize.rb
+++ b/lib/atig/ifilter/sanitize.rb
@@ -12,7 +12,7 @@ module Atig
gsub("<", "<").
gsub("&", "&").
gsub(WSP_REGEX, " ")
- status.merge :text => text
+ status.merge text: text
}
end
end
diff --git a/lib/atig/ifilter/strip.rb b/lib/atig/ifilter/strip.rb
index 2838834..bb9bf88 100644
--- a/lib/atig/ifilter/strip.rb
+++ b/lib/atig/ifilter/strip.rb
@@ -8,7 +8,7 @@ module Atig
end
def call(status)
- status.merge :text => status.text.sub(@rsuffix, "").strip
+ status.merge text: status.text.sub(@rsuffix, "").strip
end
end
end
diff --git a/lib/atig/ifilter/xid.rb b/lib/atig/ifilter/xid.rb
index 35013fb..fc98a8c 100644
--- a/lib/atig/ifilter/xid.rb
+++ b/lib/atig/ifilter/xid.rb
@@ -20,7 +20,7 @@ module Atig
unless xid and @opts.send(name)
status
else
- status.merge :text => "#{status.text} #{@format % xid}"
+ status.merge text: "#{status.text} #{@format % xid}"
end
end
end
diff --git a/lib/atig/oauth.rb b/lib/atig/oauth.rb
index 048e1ef..3761d25 100644
--- a/lib/atig/oauth.rb
+++ b/lib/atig/oauth.rb
@@ -27,8 +27,8 @@ module Atig
@nick = nick
@oauth = ::OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, {
- :site => site,
- :proxy => ENV["HTTP_PROXY"] || ENV["http_proxy"]
+ site: site,
+ proxy: ENV["HTTP_PROXY"] || ENV["http_proxy"]
})
if @@profiles.key? @nick
@@ -47,7 +47,7 @@ module Atig
end
def verify(code)
- @access = @request.get_access_token(:oauth_verifier => code)
+ @access = @request.get_access_token(oauth_verifier: code)
if @access then
@@profiles[@nick] = [ @access.token , @access.secret ]
end
diff --git a/lib/atig/ofilter/escape_url.rb b/lib/atig/ofilter/escape_url.rb
index 57d0e7e..5cc8ee5 100644
--- a/lib/atig/ofilter/escape_url.rb
+++ b/lib/atig/ofilter/escape_url.rb
@@ -19,7 +19,7 @@ module Atig
end
def call(status)
- status.merge(:status => escape_http_urls(status[:status]))
+ status.merge(status: escape_http_urls(status[:status]))
end
def exist_uri?(uri, limit = 1)
diff --git a/lib/atig/ofilter/footer.rb b/lib/atig/ofilter/footer.rb
index 863ac71..a83b925 100644
--- a/lib/atig/ofilter/footer.rb
+++ b/lib/atig/ofilter/footer.rb
@@ -9,7 +9,7 @@ module Atig
def call(q)
if @opts.footer && !@opts.footer.empty? then
- q.merge :status => "#{q[:status]} #{@opts.footer}"
+ q.merge status: "#{q[:status]} #{@opts.footer}"
else
q
end
diff --git a/lib/atig/ofilter/geo.rb b/lib/atig/ofilter/geo.rb
index a3c78b5..b7016d8 100644
--- a/lib/atig/ofilter/geo.rb
+++ b/lib/atig/ofilter/geo.rb
@@ -10,7 +10,7 @@ module Atig
def call(q)
return q unless @opts.ll
lat, long = @opts.ll.split(",", 2)
- q.merge :lat => lat.to_f, :long => long.to_f
+ q.merge lat: lat.to_f, long: long.to_f
end
end
end
diff --git a/lib/atig/ofilter/short_url.rb b/lib/atig/ofilter/short_url.rb
index 69089da..e52917f 100644
--- a/lib/atig/ofilter/short_url.rb
+++ b/lib/atig/ofilter/short_url.rb
@@ -15,7 +15,7 @@ module Atig
def call(status)
mesg = status[:status]
- status.merge(:status => short_urls(mesg))
+ status.merge(status: short_urls(mesg))
end
def short_urls(mesg)
diff --git a/lib/atig/option.rb b/lib/atig/option.rb
index ebe3843..3f25b2f 100644
--- a/lib/atig/option.rb
+++ b/lib/atig/option.rb
@@ -30,7 +30,7 @@ module Atig
end
default_value :api_base, 'https://api.twitter.com/1.1/'
- default_value :stream_api_base, 'https://userstream.twitter.com/2/'
+ default_value :stream_api_base, 'https://userstream.twitter.com/1.1/'
default_value :search_api_base, 'https://search.twitter.com/'
def initialize(table)
diff --git a/lib/atig/optparse.rb b/lib/atig/optparse.rb
index fa72f01..676c838 100644
--- a/lib/atig/optparse.rb
+++ b/lib/atig/optparse.rb
@@ -6,16 +6,17 @@ module Atig
class << self
def parse!(argv)
opts = {
- :port => 16668,
- :host => "localhost",
- :log => nil,
- :debug => false,
- :foreground => false,
- :tmpdir => ::Dir.tmpdir,
- :conf => '~/.atig/config',
+ port: 16668,
+ host: "localhost",
+ log: nil,
+ debug: false,
+ foreground: false,
+ tmpdir: ::Dir.tmpdir,
+ conf: '~/.atig/config',
}
OptionParser.new do |parser|
+ parser.version = Atig::VERSION
parser.instance_eval do
self.banner = <<EOB.gsub(/^\t+/, "")
usage: #{$0} [opts]
@@ -23,6 +24,16 @@ EOB
separator ""
separator "Options:"
+ on("--help", "show this help") do
+ puts help
+ exit
+ end
+
+ on("-v", "--version", "show version") do
+ puts version
+ exit
+ end
+
on("-p", "--port [PORT=#{opts[:port]}]", "port number to listen") do |port|
opts[:port] = port
end
@@ -35,20 +46,20 @@ EOB
opts[:log] = log
end
- on("--debug", "Enable debug mode") do |debug|
+ on("-d", "--debug", "Enable debug mode") do |debug|
opts[:log] ||= $stderr
opts[:debug] = true
end
- on("--tmpdir path", "temporary directory path") do |tmp|
+ on("-t", "--tmpdir path", "temporary directory path") do |tmp|
opts[:tmpdir] = tmp
end
- on("--memprof", "Enable memory profiler") do|_|
+ on("-m", "--memprof", "Enable memory profiler") do|_|
require 'memory_profiler'
require 'fileutils'
FileUtils.mkdir_p "log"
- MemoryProfiler.start(:string_debug => true)
+ MemoryProfiler.start(string_debug: true)
end
on("-c","--conf [file=#{opts[:conf]}]", "atig configuration file; default is '~/.atig/config'") do|name|
diff --git a/lib/atig/search.rb b/lib/atig/search.rb
index 60a327f..9cf60d3 100644
--- a/lib/atig/search.rb
+++ b/lib/atig/search.rb
@@ -5,14 +5,16 @@ require 'atig/url_escape'
module Atig
class Search
def search(query, options = {})
+ options[:q] = query
+
search = URI("https://search.twitter.com")
search.path = "/search.json"
- params = options; options[:q] = query
search.query = options.to_query_str
+
http = Http.new nil
req = http.req(:get, search)
res = http.http(search, 5, 10).request(req)
- res = JSON.parse(res.body)
+ JSON.parse(res.body)
rescue Errno::ETIMEDOUT, JSON::ParserError, IOError, Timeout::Error, Errno::ECONNRESET => e
@log.error e
text
diff --git a/lib/atig/stream.rb b/lib/atig/stream.rb
index 069c0df..6cbe174 100644
--- a/lib/atig/stream.rb
+++ b/lib/atig/stream.rb
@@ -33,7 +33,7 @@ module Atig
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
- request = Net::HTTP::Get.new(uri.request_uri)
+ request = Net::HTTP::Get.new(uri.request_uri, {"Accept-Encoding" => "identity"})
request.oauth!(http, @access.consumer, @access)
http.request(request) do |response|
unless response.code == '200' then
diff --git a/lib/atig/twitter.rb b/lib/atig/twitter.rb
index a8d1139..229a294 100755
--- a/lib/atig/twitter.rb
+++ b/lib/atig/twitter.rb
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+require 'timeout'
require 'atig/basic_twitter'
require 'atig/http'
@@ -17,8 +18,8 @@ module Atig
r = []
cursor = -1
1.upto(limit) do |num|
- options = {:cursor => cursor}.merge(opts)
- ret = api(path, options, { :authenticate => true })
+ options = {cursor: cursor}.merge(opts)
+ ret = api(path, options, { authenticate: true })
r.concat ret[name]
cursor = ret[:next_cursor]
break if cursor.zero?
@@ -30,7 +31,7 @@ module Atig
methods.each do |m|
self.module_eval <<END
def #{m}(path, query = {}, opts = {})
- opts.update( :method => :#{m})
+ opts.update( method: :#{m})
api path, query, opts
end
END
@@ -56,7 +57,7 @@ END
end
def oauth(time, req)
- timeout(time) do
+ Timeout.timeout(time) do
headers = {}
req.each{|k,v| headers[k] = v }
diff --git a/lib/atig/update_checker.rb b/lib/atig/update_checker.rb
index 5949894..1125c3b 100644
--- a/lib/atig/update_checker.rb
+++ b/lib/atig/update_checker.rb
@@ -3,7 +3,7 @@
module Atig
module UpdateChecker
def commits
- uri = URI("https://api.github.com/repos/mzp/atig/commits")
+ uri = URI("https://api.github.com/repos/atig/atig/commits")
http = Atig::Http.new
res = http.http(uri).request http.req(:get, uri)
JSON.parse(res.body)
@@ -47,7 +47,7 @@ module Atig
end.map {|i| i['commit']['message'] }
end
end
- rescue Errno::ECONNREFUSED, Timeout::Error => e
+ rescue TypeError, Errno::ECONNREFUSED, Timeout::Error
[]
end
diff --git a/lib/atig/url_escape.rb b/lib/atig/url_escape.rb
index 65479c6..def82c1 100644
--- a/lib/atig/url_escape.rb
+++ b/lib/atig/url_escape.rb
@@ -1,7 +1,7 @@
# -*- mode:ruby; coding:utf-8 -*-
class Hash
- # { :f => "v" } #=> "f=v"
+ # { f: "v" } #=> "f=v"
# { "f" => [1, 2] } #=> "f=1&f=2"
# { "f" => "" } #=> "f="
# { "f" => nil } #=> "f"
diff --git a/lib/atig/version.rb b/lib/atig/version.rb
index cda6d99..f627cfc 100644
--- a/lib/atig/version.rb
+++ b/lib/atig/version.rb
@@ -1,3 +1,3 @@
module Atig
- VERSION = "0.4.5"
+ VERSION = "0.5.0"
end
diff --git a/lib/memory_profiler.rb b/lib/memory_profiler.rb
index 7bfad76..51a0fec 100644
--- a/lib/memory_profiler.rb
+++ b/lib/memory_profiler.rb
@@ -16,7 +16,7 @@
# each cycle. You can then use 'diff' to spot which strings were added
# between runs.
class MemoryProfiler
- DEFAULTS = {:delay => 10, :string_debug => false}
+ DEFAULTS = {delay: 10, string_debug: false}
def self.start(opt={})
opt = DEFAULTS.dup.merge(opt)
diff --git a/metadata.yml b/metadata.yml
deleted file mode 100644
index b6ec52e..0000000
--- a/metadata.yml
+++ /dev/null
@@ -1,357 +0,0 @@
---- !ruby/object:Gem::Specification
-name: atig
-version: !ruby/object:Gem::Version
- version: 0.4.5
-platform: ruby
-authors:
-- MIZUNO Hiroki
-- SHIBATA Hiroshi
-autorequire:
-bindir: bin
-cert_chain: []
-date: 2014-01-15 00:00:00.000000000 Z
-dependencies:
-- !ruby/object:Gem::Dependency
- name: sqlite3
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.3.2
- type: :runtime
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.3.2
-- !ruby/object:Gem::Dependency
- name: net-irc
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
- type: :runtime
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-- !ruby/object:Gem::Dependency
- name: oauth
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
- type: :runtime
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-- !ruby/object:Gem::Dependency
- name: twitter-text
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: 1.7.0
- type: :runtime
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: 1.7.0
-- !ruby/object:Gem::Dependency
- name: bundler
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
- type: :development
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-- !ruby/object:Gem::Dependency
- name: rspec
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
- type: :development
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-- !ruby/object:Gem::Dependency
- name: coveralls
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
- type: :development
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-description: Atig.rb is Twitter Irc Gateway.
-email:
-- mzp at ocaml.jp
-- shibata.hiroshi at gmail.com
-executables:
-- atig
-extensions: []
-extra_rdoc_files: []
-files:
-- ".gitignore"
-- ".rspec"
-- ".travis.yml"
-- Gemfile
-- Gemfile.lock
-- README.mkdn
-- Rakefile
-- atig.gemspec
-- bin/atig
-- docs/_static/allow.png
-- docs/_static/emacs.png
-- docs/_static/irc_setting.png
-- docs/_static/irssi.png
-- docs/_static/limechat.png
-- docs/_static/limechat_s.png
-- docs/_static/oauth_channel.png
-- docs/_static/screenshot.png
-- docs/_static/structure.png
-- docs/_static/verify.png
-- docs/changelog.rst
-- docs/commandline_options.rst
-- docs/commands.rst
-- docs/conf.py
-- docs/config.rst
-- docs/feature.rst
-- docs/hacking_guide.rst
-- docs/index.rst
-- docs/irc.rst
-- docs/options.rst
-- docs/quickstart.rst
-- docs/resize.sh
-- docs/tiarra.rst
-- docs/tig.rst
-- lib/atig.rb
-- lib/atig/agent.rb
-- lib/atig/agent/agent.rb
-- lib/atig/agent/clenup.rb
-- lib/atig/agent/dm.rb
-- lib/atig/agent/following.rb
-- lib/atig/agent/full_list.rb
-- lib/atig/agent/list.rb
-- lib/atig/agent/list_status.rb
-- lib/atig/agent/mention.rb
-- lib/atig/agent/noretweets.rb
-- lib/atig/agent/stream_follow.rb
-- lib/atig/agent/timeline.rb
-- lib/atig/agent/user_stream.rb
-- lib/atig/basic_twitter.rb
-- lib/atig/bitly.rb
-- lib/atig/channel.rb
-- lib/atig/channel/channel.rb
-- lib/atig/channel/dm.rb
-- lib/atig/channel/list.rb
-- lib/atig/channel/mention.rb
-- lib/atig/channel/retweet.rb
-- lib/atig/channel/timeline.rb
-- lib/atig/client.rb
-- lib/atig/command.rb
-- lib/atig/command/autofix.rb
-- lib/atig/command/command.rb
-- lib/atig/command/destroy.rb
-- lib/atig/command/dm.rb
-- lib/atig/command/favorite.rb
-- lib/atig/command/info.rb
-- lib/atig/command/limit.rb
-- lib/atig/command/location.rb
-- lib/atig/command/name.rb
-- lib/atig/command/option.rb
-- lib/atig/command/refresh.rb
-- lib/atig/command/reply.rb
-- lib/atig/command/retweet.rb
-- lib/atig/command/search.rb
-- lib/atig/command/spam.rb
-- lib/atig/command/status.rb
-- lib/atig/command/thread.rb
-- lib/atig/command/time.rb
-- lib/atig/command/uptime.rb
-- lib/atig/command/user.rb
-- lib/atig/command/user_info.rb
-- lib/atig/command/version.rb
-- lib/atig/command/whois.rb
-- lib/atig/db/db.rb
-- lib/atig/db/followings.rb
-- lib/atig/db/listenable.rb
-- lib/atig/db/lists.rb
-- lib/atig/db/roman.rb
-- lib/atig/db/sized_uniq_array.rb
-- lib/atig/db/sql.rb
-- lib/atig/db/statuses.rb
-- lib/atig/db/transaction.rb
-- lib/atig/exception_util.rb
-- lib/atig/gateway.rb
-- lib/atig/gateway/channel.rb
-- lib/atig/gateway/session.rb
-- lib/atig/http.rb
-- lib/atig/ifilter.rb
-- lib/atig/ifilter/expand_url.rb
-- lib/atig/ifilter/retweet.rb
-- lib/atig/ifilter/retweet_time.rb
-- lib/atig/ifilter/sanitize.rb
-- lib/atig/ifilter/strip.rb
-- lib/atig/ifilter/xid.rb
-- lib/atig/levenshtein.rb
-- lib/atig/monkey.rb
-- lib/atig/oauth-patch.rb
-- lib/atig/oauth.rb
-- lib/atig/ofilter.rb
-- lib/atig/ofilter/escape_url.rb
-- lib/atig/ofilter/footer.rb
-- lib/atig/ofilter/geo.rb
-- lib/atig/ofilter/short_url.rb
-- lib/atig/option.rb
-- lib/atig/optparse.rb
-- lib/atig/scheduler.rb
-- lib/atig/search.rb
-- lib/atig/search_twitter.rb
-- lib/atig/sized_hash.rb
-- lib/atig/stream.rb
-- lib/atig/twitter.rb
-- lib/atig/twitter_struct.rb
-- lib/atig/update_checker.rb
-- lib/atig/url_escape.rb
-- lib/atig/util.rb
-- lib/atig/version.rb
-- lib/memory_profiler.rb
-- requirements.txt
-- spec/command/autofix_spec.rb
-- spec/command/destroy_spec.rb
-- spec/command/dm_spec.rb
-- spec/command/favorite_spec.rb
-- spec/command/limit_spec.rb
-- spec/command/location_spec.rb
-- spec/command/name_spec.rb
-- spec/command/option_spec.rb
-- spec/command/refresh_spec.rb
-- spec/command/reply_spec.rb
-- spec/command/retweet_spec.rb
-- spec/command/spam_spec.rb
-- spec/command/status_spec.rb
-- spec/command/thread_spec.rb
-- spec/command/time_spec.rb
-- spec/command/uptime_spec.rb
-- spec/command/user_info_spec.rb
-- spec/command/user_spec.rb
-- spec/command/version_spec.rb
-- spec/command/whois_spec.rb
-- spec/command_helper.rb
-- spec/db/followings_spec.rb
-- spec/db/listenable_spec.rb
-- spec/db/lists_spec.rb
-- spec/db/roman_spec.rb
-- spec/db/sized_uniq_array_spec.rb
-- spec/db/statuses_spec.rb
-- spec/ifilter/expand_url_spec.rb
-- spec/ifilter/retweet_spec.rb
-- spec/ifilter/retweet_time_spec.rb
-- spec/ifilter/sanitize_spec.rb
-- spec/ifilter/sid_spec.rb
-- spec/ifilter/strip_spec.rb
-- spec/ifilter/tid_spec.rb
-- spec/levenshtein_spec.rb
-- spec/ofilter/escape_url_spec.rb
-- spec/ofilter/footer_spec.rb
-- spec/ofilter/geo_spec.rb
-- spec/ofilter/short_url_spec.rb
-- spec/option_spec.rb
-- spec/sized_hash_spec.rb
-- spec/spec_helper.rb
-- spec/update_checker_spec.rb
-homepage: https://github.com/mzp/atig
-licenses: []
-metadata: {}
-post_install_message:
-rdoc_options: []
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.9.3
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: '0'
-requirements: []
-rubyforge_project:
-rubygems_version: 2.2.1
-signing_key:
-specification_version: 4
-summary: Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.
-test_files:
-- spec/command/autofix_spec.rb
-- spec/command/destroy_spec.rb
-- spec/command/dm_spec.rb
-- spec/command/favorite_spec.rb
-- spec/command/limit_spec.rb
-- spec/command/location_spec.rb
-- spec/command/name_spec.rb
-- spec/command/option_spec.rb
-- spec/command/refresh_spec.rb
-- spec/command/reply_spec.rb
-- spec/command/retweet_spec.rb
-- spec/command/spam_spec.rb
-- spec/command/status_spec.rb
-- spec/command/thread_spec.rb
-- spec/command/time_spec.rb
-- spec/command/uptime_spec.rb
-- spec/command/user_info_spec.rb
-- spec/command/user_spec.rb
-- spec/command/version_spec.rb
-- spec/command/whois_spec.rb
-- spec/command_helper.rb
-- spec/db/followings_spec.rb
-- spec/db/listenable_spec.rb
-- spec/db/lists_spec.rb
-- spec/db/roman_spec.rb
-- spec/db/sized_uniq_array_spec.rb
-- spec/db/statuses_spec.rb
-- spec/ifilter/expand_url_spec.rb
-- spec/ifilter/retweet_spec.rb
-- spec/ifilter/retweet_time_spec.rb
-- spec/ifilter/sanitize_spec.rb
-- spec/ifilter/sid_spec.rb
-- spec/ifilter/strip_spec.rb
-- spec/ifilter/tid_spec.rb
-- spec/levenshtein_spec.rb
-- spec/ofilter/escape_url_spec.rb
-- spec/ofilter/footer_spec.rb
-- spec/ofilter/geo_spec.rb
-- spec/ofilter/short_url_spec.rb
-- spec/option_spec.rb
-- spec/sized_hash_spec.rb
-- spec/spec_helper.rb
-- spec/update_checker_spec.rb
-has_rdoc:
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 92fc677..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Jinja2==2.7.1
-MarkupSafe==0.18
-Pygments==1.6
-Sphinx==1.2b3
-docutils==0.11
diff --git a/spec/command/autofix_spec.rb b/spec/command/autofix_spec.rb
index 2c512dc..484fc82 100644
--- a/spec/command/autofix_spec.rb
+++ b/spec/command/autofix_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/autofix'
describe Atig::Command::Autofix do
@@ -10,24 +9,24 @@ describe Atig::Command::Autofix do
@opts.autofix = true
target = status 'hello', 'id'=>'42'
entry = entry user(1,'mzp'), target, "entry", 1
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return([ entry ])
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return([ entry ])
end
it "should post normal tweet" do
res = status('blah blah')
- @api.should_receive(:post).with('statuses/update', {:status=>'blah blah'}).and_return(res)
+ expect(@api).to receive(:post).with('statuses/update', {status:'blah blah'}).and_return(res)
call '#twitter', "autofix", %w(blah blah)
end
it "should delete old similar tweet" do
res = status('hillo')
- @api.should_receive(:post).with('statuses/update', {:status=>'hillo'}).and_return(res)
- @api.should_receive(:post).with("statuses/destroy/42")
- @statuses.should_receive(:remove_by_id).with(1)
+ expect(@api).to receive(:post).with('statuses/update', {status:'hillo'}).and_return(res)
+ expect(@api).to receive(:post).with("statuses/destroy/42")
+ expect(@statuses).to receive(:remove_by_id).with(1)
- @channel.should_receive(:notify).with("Similar update in previous. Conclude that it has error.")
- @channel.should_receive(:notify).with("And overwrite previous as new status: hillo")
+ expect(@channel).to receive(:notify).with("Similar update in previous. Conclude that it has error.")
+ expect(@channel).to receive(:notify).with("And overwrite previous as new status: hillo")
call '#twitter', "autofix", %w(hillo)
end
diff --git a/spec/command/destroy_spec.rb b/spec/command/destroy_spec.rb
index 169819a..c690bcb 100644
--- a/spec/command/destroy_spec.rb
+++ b/spec/command/destroy_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/destroy'
describe Atig::Command::Destroy,"when status is not removed" do
@@ -12,9 +11,9 @@ describe Atig::Command::Destroy,"when status is not removed" do
it "should specified other's status" do
entry = entry user(2,'other'), status('blah blah', 'id'=>'1')
- @statuses.stub(:find_by_tid).with('b').and_return(entry)
+ allow(@statuses).to receive(:find_by_tid).with('b').and_return(entry)
- @channel.should_receive(:notify).with("The status you specified by the ID tid is not yours.")
+ expect(@channel).to receive(:notify).with("The status you specified by the ID tid is not yours.")
call "#twitter","destory",%w(b)
end
end
@@ -31,20 +30,20 @@ describe Atig::Command::Destroy,"when remove recently tweet" do
stub_status(:find_by_tid,'a' => entry)
stub_status(:find_by_sid,'mzp:a' => entry)
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default:[])
# api
- @api.should_receive(:post).with("statuses/destroy/1")
+ expect(@api).to receive(:post).with("statuses/destroy/1")
# notice
- @channel.should_receive(:notify).with("Destroyed: blah blah")
+ expect(@channel).to receive(:notify).with("Destroyed: blah blah")
# update topics
new_entry = entry @me, status('foo', 'id'=>'2')
- @gateway.should_receive(:topic).with(new_entry)
+ expect(@gateway).to receive(:topic).with(new_entry)
- @statuses.should_receive(:remove_by_id).with(1).and_return{
- @statuses.should_receive(:find_by_screen_name).with(@me.screen_name,:limit=>1).and_return{
+ expect(@statuses).to receive(:remove_by_id).with(1){
+ expect(@statuses).to receive(:find_by_screen_name).with(@me.screen_name,:limit=>1){
[ new_entry ]
}
}
@@ -75,16 +74,16 @@ describe Atig::Command::Destroy,"when remove old tweet" do
stub_status(:find_by_tid,'a' => entry)
stub_status(:find_by_sid,'mzp:a' => entry)
- stub_status(:find_by_screen_name, @db.me.screen_name => [ entry ], :default=>[])
+ stub_status(:find_by_screen_name, @db.me.screen_name => [ entry ], default:[])
# api
- @api.should_receive(:post).with("statuses/destroy/1")
+ expect(@api).to receive(:post).with("statuses/destroy/1")
# notice
- @channel.should_receive(:notify).with("Destroyed: blah blah")
+ expect(@channel).to receive(:notify).with("Destroyed: blah blah")
# update topics
- @statuses.should_receive(:remove_by_id).with(1)
+ expect(@statuses).to receive(:remove_by_id).with(1)
end
it "should specified by tid" do
diff --git a/spec/command/dm_spec.rb b/spec/command/dm_spec.rb
index f06448e..73283ff 100644
--- a/spec/command/dm_spec.rb
+++ b/spec/command/dm_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/dm'
describe Atig::Command::Dm do
@@ -10,18 +9,18 @@ describe Atig::Command::Dm do
end
it "should have '/me dm' name" do
- @gateway.names.should == ['d', 'dm','dms']
+ expect(@gateway.names).to eq(['d', 'dm','dms'])
end
it "should post the status by API" do
- @api.should_receive(:post).with('direct_messages/new',
- {:screen_name => 'mzp', :text => 'blah blah'})
- @channel.should_receive(:notify).with("Sent message to mzp: blah blah")
+ expect(@api).to receive(:post).with('direct_messages/new',
+ {screen_name: 'mzp', text: 'blah blah'})
+ expect(@channel).to receive(:notify).with("Sent message to mzp: blah blah")
call '#twitter', "dm", %w(mzp blah blah)
end
it "should post the status by API" do
- @channel.should_receive(:notify).with("/me dm <SCREEN_NAME> blah blah")
+ expect(@channel).to receive(:notify).with("/me dm <SCREEN_NAME> blah blah")
call '#twitter', "dm", %w()
end
end
diff --git a/spec/command/favorite_spec.rb b/spec/command/favorite_spec.rb
index a01ceed..f9f1bd8 100644
--- a/spec/command/favorite_spec.rb
+++ b/spec/command/favorite_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/favorite'
describe Atig::Command::Favorite do
@@ -14,40 +13,40 @@ describe Atig::Command::Favorite do
stub_status(:find_by_tid,'a' => entry)
stub_status(:find_by_sid,'mzp:a' => entry)
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default:[])
end
it "should post fav by tid" do
- @api.should_receive(:post).with("favorites/create", {:id => "1"})
- @channel.should_receive(:notify).with("FAV: mzp: blah blah")
+ expect(@api).to receive(:post).with("favorites/create", {id: "1"})
+ expect(@channel).to receive(:notify).with("FAV: mzp: blah blah")
call "#twitter","fav",%w(a)
end
it "should post fav by sid" do
- @api.should_receive(:post).with("favorites/create", {:id => "1"})
- @channel.should_receive(:notify).with("FAV: mzp: blah blah")
+ expect(@api).to receive(:post).with("favorites/create", {id: "1"})
+ expect(@channel).to receive(:notify).with("FAV: mzp: blah blah")
call "#twitter","fav",%w(mzp:a)
end
it "should post fav by screen name" do
- @api.should_receive(:post).with("favorites/create", {:id => "1"})
- @channel.should_receive(:notify).with("FAV: mzp: blah blah")
+ expect(@api).to receive(:post).with("favorites/create", {id: "1"})
+ expect(@channel).to receive(:notify).with("FAV: mzp: blah blah")
call "#twitter","fav",%w(mzp)
end
it "should post fav by screen name with at" do
- @api.should_receive(:post).with("favorites/create", {:id => "1"})
- @channel.should_receive(:notify).with("FAV: mzp: blah blah")
+ expect(@api).to receive(:post).with("favorites/create", {id: "1"})
+ expect(@channel).to receive(:notify).with("FAV: mzp: blah blah")
call "#twitter","fav",%w(@mzp)
end
it "should post unfav" do
- @api.should_receive(:post).with("favorites/destroy", {:id => "1"})
- @channel.should_receive(:notify).with("UNFAV: mzp: blah blah")
+ expect(@api).to receive(:post).with("favorites/destroy", {id: "1"})
+ expect(@channel).to receive(:notify).with("UNFAV: mzp: blah blah")
call "#twitter","unfav",%w(a)
end
diff --git a/spec/command/limit_spec.rb b/spec/command/limit_spec.rb
index 5de9de8..9b3f027 100644
--- a/spec/command/limit_spec.rb
+++ b/spec/command/limit_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/limit'
describe Atig::Command::Limit do
@@ -9,18 +8,18 @@ describe Atig::Command::Limit do
before do
@reset = ::Time.utc(2010,9,25,8,24,12)
@command = init Atig::Command::Limit
- @api.stub(:limit).and_return(150)
- @api.stub(:remain).and_return(148)
- @api.stub(:reset).and_return(@reset)
+ allow(@api).to receive(:limit).and_return(150)
+ allow(@api).to receive(:remain).and_return(148)
+ allow(@api).to receive(:reset).and_return(@reset)
end
it "should provide limit command" do
- @gateway.names.should == ['rls','limit','limits']
+ expect(@gateway.names).to eq(['rls','limit','limits'])
end
it "should show limit" do
- @channel.should_receive(:notify).with("148 / 150 (reset at 2010-09-25 08:24:12)")
+ expect(@channel).to receive(:notify).with("148 / 150 (reset at 2010-09-25 08:24:12)")
call '#twitter', 'limit', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
end
diff --git a/spec/command/location_spec.rb b/spec/command/location_spec.rb
index 595dd1f..c63c61a 100644
--- a/spec/command/location_spec.rb
+++ b/spec/command/location_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/location'
describe Atig::Command::Location do
@@ -11,14 +10,14 @@ describe Atig::Command::Location do
end
it "should update location" do
- @api.should_receive(:post).with('account/update_profile',:location=>'some place')
- @channel.should_receive(:notify).with("You are in some place now.")
+ expect(@api).to receive(:post).with('account/update_profile',:location=>'some place')
+ expect(@channel).to receive(:notify).with("You are in some place now.")
call '#twitter','location',%w(some place)
end
it "should reset location" do
- @api.should_receive(:post).with('account/update_profile',:location=>'')
- @channel.should_receive(:notify).with("You are nowhere now.")
+ expect(@api).to receive(:post).with('account/update_profile',:location=>'')
+ expect(@channel).to receive(:notify).with("You are nowhere now.")
call '#twitter','location',%w()
end
end
diff --git a/spec/command/name_spec.rb b/spec/command/name_spec.rb
index cd0acb3..f99bef9 100644
--- a/spec/command/name_spec.rb
+++ b/spec/command/name_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/name'
describe Atig::Command::Name do
@@ -11,8 +10,8 @@ describe Atig::Command::Name do
end
it "should update name" do
- @api.should_receive(:post).with('account/update_profile',:name=>'mzp')
- @channel.should_receive(:notify).with("You are named mzp.")
+ expect(@api).to receive(:post).with('account/update_profile',:name=>'mzp')
+ expect(@channel).to receive(:notify).with("You are named mzp.")
call '#twitter', 'name', %w(mzp)
end
end
diff --git a/spec/command/option_spec.rb b/spec/command/option_spec.rb
index 8a9c9d7..92f1d8e 100644
--- a/spec/command/option_spec.rb
+++ b/spec/command/option_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../spec_helper', File.dirname(__FILE__))
require 'atig/command/option'
describe Atig::Command::Option do
@@ -11,7 +10,7 @@ describe Atig::Command::Option do
end
it "should provide option command" do
- @command.command_name.should == %w(opt opts option options)
+ expect(@command.command_name).to eq(%w(opt opts option options))
end
end
@@ -24,20 +23,20 @@ describe Atig::Command::Option, 'when have many property' do
@opts.foo2 = 42
@opts.foo3 = 42.1
- @opts.stub(:foo1=)
- @opts.stub(:foo2=)
- @opts.stub(:foo3=)
+ allow(@opts).to receive(:foo1=)
+ allow(@opts).to receive(:foo2=)
+ allow(@opts).to receive(:foo3=)
end
it "should list up values" do
xs = []
- @channel.stub(:notify){|x| xs << x}
+ allow(@channel).to receive(:notify){|x| xs << x}
call '#twitter', 'opt', %w()
- xs.should == [
+ expect(xs).to eq([
"foo1 => true",
"foo2 => 42",
"foo3 => 42.1",
- ]
+ ])
end
end
@@ -47,19 +46,19 @@ describe Atig::Command::Option, 'when have bool property' do
before do
@command = init Atig::Command::Option
- @opts.stub(:foo).and_return true
- @opts.stub(:foo=){|v| @value = v }
- @channel.stub(:notify)
+ allow(@opts).to receive(:foo).and_return true
+ allow(@opts).to receive(:foo=){|v| @value = v }
+ allow(@channel).to receive(:notify)
end
it "should show the value" do
- @channel.should_receive(:notify).with("foo => true")
+ expect(@channel).to receive(:notify).with("foo => true")
call '#twitter', 'opt', %w(foo)
end
it "should update the value" do
call '#twitter', 'opt', %w(foo false)
- @value.should be_false
+ expect(@value).to be_falsey
end
end
@@ -68,19 +67,19 @@ describe Atig::Command::Option, 'when have int property' do
before do
@command = init Atig::Command::Option
- @opts.stub(:foo).and_return 42
- @opts.stub(:foo=){|v| @value = v }
- @channel.stub(:notify)
+ allow(@opts).to receive(:foo).and_return 42
+ allow(@opts).to receive(:foo=){|v| @value = v }
+ allow(@channel).to receive(:notify)
end
it "should show the value" do
- @channel.should_receive(:notify).with("foo => 42")
+ expect(@channel).to receive(:notify).with("foo => 42")
call '#twitter', 'opt', %w(foo)
end
it "should update the value" do
call '#twitter', 'opt', %w(foo 42)
- @value.should == 42
+ expect(@value).to eq(42)
end
end
@@ -89,19 +88,19 @@ describe Atig::Command::Option, 'when have float property' do
before do
@command = init Atig::Command::Option
- @opts.stub(:foo).and_return 1.23
- @opts.stub(:foo=){|v| @value = v }
- @channel.stub(:notify)
+ allow(@opts).to receive(:foo).and_return 1.23
+ allow(@opts).to receive(:foo=){|v| @value = v }
+ allow(@channel).to receive(:notify)
end
it "should show the value" do
- @channel.should_receive(:notify).with("foo => 1.23")
+ expect(@channel).to receive(:notify).with("foo => 1.23")
call '#twitter', 'opt', %w(foo)
end
it "should update the value" do
call '#twitter', 'opt', %w(foo 1.24)
- @value.should == 1.24
+ expect(@value).to eq(1.24)
end
end
@@ -110,23 +109,23 @@ describe Atig::Command::Option, 'when have string property' do
before do
@command = init Atig::Command::Option
- @opts.stub(:foo).and_return "bar"
- @opts.stub(:foo=){|v| @value = v }
- @channel.stub(:notify)
+ allow(@opts).to receive(:foo).and_return "bar"
+ allow(@opts).to receive(:foo=){|v| @value = v }
+ allow(@channel).to receive(:notify)
end
it "should show the value" do
- @channel.should_receive(:notify).with("foo => bar")
+ expect(@channel).to receive(:notify).with("foo => bar")
call '#twitter', 'opt', %w(foo)
end
it "should update the value" do
call '#twitter', 'opt', %w(foo baz)
- @value.should == 'baz'
+ expect(@value).to eq('baz')
end
it "should update the value" do
call '#twitter', 'opt', %w(foo blah Blah)
- @value.should == 'blah Blah'
+ expect(@value).to eq('blah Blah')
end
end
diff --git a/spec/command/refresh_spec.rb b/spec/command/refresh_spec.rb
index 2ccdd1d..e67e4bd 100644
--- a/spec/command/refresh_spec.rb
+++ b/spec/command/refresh_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/refresh'
require 'atig/command/info'
@@ -12,9 +11,9 @@ describe Atig::Command::Refresh do
end
it "should refresh all" do
- @followings.should_receive(:invalidate)
- @lists.should_receive(:invalidate).with(:all)
- @channel.should_receive(:notify).with("refresh followings/lists...")
+ expect(@followings).to receive(:invalidate)
+ expect(@lists).to receive(:invalidate).with(:all)
+ expect(@channel).to receive(:notify).with("refresh followings/lists...")
call '#twitter','refresh', []
end
diff --git a/spec/command/reply_spec.rb b/spec/command/reply_spec.rb
index f893403..3f34843 100644
--- a/spec/command/reply_spec.rb
+++ b/spec/command/reply_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/reply'
describe Atig::Command::Reply do
@@ -14,65 +13,65 @@ describe Atig::Command::Reply do
stub_status(:find_by_tid,'a' => entry)
stub_status(:find_by_sid,'mzp:a' => entry)
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default => [])
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default: [])
end
it "should have '/me status' name" do
- @gateway.names.should == %w(mention re reply rp)
+ expect(@gateway.names).to eq(%w(mention re reply rp))
end
it "should post the status" do
- @api.should_receive(:post).
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
+ expect(@api).to receive(:post).
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
and_return(@res)
call '#twitter', "reply", %w(a abc @mzp)
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
end
it "should post the status by sid" do
- @api.should_receive(:post).
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
+ expect(@api).to receive(:post).
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
and_return(@res)
call '#twitter', "reply", %w(mzp:a abc @mzp)
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
end
it "should post the status by API" do
- @api.should_receive(:post).
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
+ expect(@api).to receive(:post).
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
and_return(@res)
call '#twitter', "reply", %w(a abc @mzp)
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
end
it "should post the status with screen_name" do
- @api.should_receive(:post).
- with('statuses/update', {:status=>'abc @mzp', :in_reply_to_status_id=>'1'}).
+ expect(@api).to receive(:post).
+ with('statuses/update', {status:'abc @mzp', in_reply_to_status_id:'1'}).
and_return(@res)
call '#twitter', "reply", %w(mzp abc @mzp)
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
- @gateway.filtered.should == { :status => 'abc @mzp', :in_reply_to_status_id=>'1'}
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
+ expect(@gateway.filtered).to eq({ status: 'abc @mzp', in_reply_to_status_id:'1'})
end
it "should add screen name as prefix" do
- @api.should_receive(:post).
- with('statuses/update', {:status=>'@mzp mzp', :in_reply_to_status_id=>'1'}).
+ expect(@api).to receive(:post).
+ with('statuses/update', {status:'@mzp mzp', in_reply_to_status_id:'1'}).
and_return(@res)
call '#twitter', "reply", %w(a mzp)
- @gateway.updated.should == [ @res, '#twitter', 'In reply to mzp: blah blah' ]
- @gateway.filtered.should == { :status => '@mzp mzp', :in_reply_to_status_id=>'1'}
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'In reply to mzp: blah blah' ])
+ expect(@gateway.filtered).to eq({ status: '@mzp mzp', in_reply_to_status_id:'1'})
end
end
diff --git a/spec/command/retweet_spec.rb b/spec/command/retweet_spec.rb
index d3f31bf..314d663 100644
--- a/spec/command/retweet_spec.rb
+++ b/spec/command/retweet_spec.rb
@@ -1,16 +1,15 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/retweet'
describe Atig::Command::Retweet do
include CommandHelper
before do
bitly = double("Bitly")
- bitly.stub(:shorten).and_return{|s|
+ allow(bitly).to receive(:shorten){|s|
"[#{s}]"
}
- Atig::Bitly.stub(:no_login).and_return(bitly)
+ allow(Atig::Bitly).to receive(:no_login).and_return(bitly)
@command = init Atig::Command::Retweet
@@ -20,46 +19,46 @@ describe Atig::Command::Retweet do
stub_status(:find_by_tid,'a' => entry)
stub_status(:find_by_sid,'mzp:a' => entry)
- stub_status(:find_by_screen_name,'mzp' => [ entry ], :default=>[])
+ stub_status(:find_by_screen_name,'mzp' => [ entry ], default:[])
end
it "should have command name" do
- @gateway.names.should == %w(ort rt retweet qt)
+ expect(@gateway.names).to eq(%w(ort rt retweet qt))
end
it "should post official retweet without comment" do
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
call "#twitter", 'rt', %w(a)
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
it "should post official retweet without comment by screen name" do
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
call "#twitter", 'rt', %w(mzp)
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
it "should post official retweet without comment by sid" do
- @api.should_receive(:post).with('statuses/retweet/1').and_return(@res)
+ expect(@api).to receive(:post).with('statuses/retweet/1').and_return(@res)
call "#twitter", 'rt', %w(mzp:a)
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
it "should post un-official retweet with comment" do
- @api.should_receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
+ expect(@api).to receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
call "#twitter", 'rt', %w(a aaa)
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
it "should post un-official retweet with comment by screen name" do
- @api.should_receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
+ expect(@api).to receive(:post).with('statuses/update',:status=> "aaa RT @mzp: blah blah blah blah blah blah blah blah").and_return(@res)
call "#twitter", 'rt', %w(mzp aaa)
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
it "should post un-official retweet with long comment" do
- @api.should_receive(:post).with('statuses/update',:status=> "#{'a' * 95} RT @mzp: b [http://twitter.com/mzp/status/1]").and_return(@res)
- call "#twitter", 'rt', ['a', 'a' * 95 ]
- @gateway.updated.should == [ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ]
+ expect(@api).to receive(:post).with('statuses/update',:status=> "#{'a' * 94} RT @mzp: b [https://twitter.com/mzp/status/1]").and_return(@res)
+ call "#twitter", 'rt', ['a', 'a' * 94 ]
+ expect(@gateway.updated).to eq([ @res, '#twitter', 'RT to mzp: blah blah blah blah blah blah blah blah' ])
end
end
diff --git a/spec/command/spam_spec.rb b/spec/command/spam_spec.rb
index f1ed422..bcf0f7b 100644
--- a/spec/command/spam_spec.rb
+++ b/spec/command/spam_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/spam'
describe Atig::Command::Spam do
@@ -10,17 +9,17 @@ describe Atig::Command::Spam do
end
it "はspamコマンドを提供する" do
- @gateway.names.should == %w(spam SPAM)
+ expect(@gateway.names).to eq(%w(spam SPAM))
end
it "は指定されたscreen_nameを通報する" do
user = user(1,'examplespammer')
- @api.
- should_receive(:post).
+ expect(@api).
+ to receive(:post).
with('report_spam',:screen_name=> 'examplespammer').
and_return(user)
- @channel.should_receive(:notify).with("Report examplespammer as SPAMMER")
+ expect(@channel).to receive(:notify).with("Report examplespammer as SPAMMER")
call "#twitter", 'spam', %w(examplespammer)
end
end
diff --git a/spec/command/status_spec.rb b/spec/command/status_spec.rb
index 7e25155..d50cfd8 100644
--- a/spec/command/status_spec.rb
+++ b/spec/command/status_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/status'
describe Atig::Command::Status do
@@ -10,56 +9,56 @@ describe Atig::Command::Status do
end
it "should have '/me status' name" do
- @gateway.names.should == ['status']
+ expect(@gateway.names).to eq(['status'])
end
it "should post the status by API" do
res = status('blah blah')
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
- @api.should_receive(:post).with('statuses/update', {:status=>'blah blah'}).and_return(res)
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
+ expect(@api).to receive(:post).with('statuses/update', {status:'blah blah'}).and_return(res)
call '#twitter', "status", %w(blah blah)
- @gateway.updated.should == [ res, '#twitter' ]
- @gateway.filtered.should == { :status => 'blah blah' }
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
+ expect(@gateway.filtered).to eq({ status: 'blah blah' })
end
it "should post with japanese language" do
res = status("あ"*140)
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
- @api.should_receive(:post).with('statuses/update', {:status=>"あ"*140}).and_return(res)
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
+ expect(@api).to receive(:post).with('statuses/update', {status:"あ"*140}).and_return(res)
call '#twitter', "status", ["あ" * 140]
- @gateway.updated.should == [ res, '#twitter' ]
- @gateway.filtered.should == { :status => "あ" * 140 }
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
+ expect(@gateway.filtered).to eq({ status: "あ" * 140 })
end
it "should post the status even if has long URL" do
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")
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
- @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)
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
+ 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)
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']
- @gateway.updated.should == [ res, '#twitter' ]
- @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'}
+ expect(@gateway.updated).to eq([ res, '#twitter' ])
+ 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'})
end
it "should not post same post" do
e = entry user(1,'mzp'), status('blah blah')
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return([ e ] )
- @channel.should_receive(:notify).with("You can't submit the same status twice in a row.")
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return([ e ] )
+ expect(@channel).to receive(:notify).with("You can't submit the same status twice in a row.")
call '#twitter', "status", %w(blah blah)
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should not post over 140" do
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
- @channel.should_receive(:notify).with("You can't submit the status over 140 chars")
+ expect(@statuses).to receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
+ expect(@channel).to receive(:notify).with("You can't submit the status over 140 chars")
call '#twitter', "status", [ 'a' * 141 ]
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
end
diff --git a/spec/command/thread_spec.rb b/spec/command/thread_spec.rb
index adde583..8ae9852 100644
--- a/spec/command/thread_spec.rb
+++ b/spec/command/thread_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/thread'
describe Atig::Command::Thread do
@@ -16,75 +15,75 @@ describe Atig::Command::Thread do
]
@command = init Atig::Command::Thread
@messages = []
- @channel.stub(:message).and_return{|entry,_|
+ allow(@channel).to receive(:message){|entry,_|
@messages.unshift entry
}
- @statuses.stub(:find_by_status_id).with(anything).and_return{|id|
+ allow(@statuses).to receive(:find_by_status_id).with(anything){|id|
@entries[id.to_i]
}
end
it "should provide thread command" do
- @gateway.names.should == %w( thread )
+ expect(@gateway.names).to eq(%w( thread ))
end
it "should show the tweet" do
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[0])
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[0])
call "#twitter","thread",%w(a)
- @messages.should == [ @entries[0] ]
+ expect(@messages).to eq([ @entries[0] ])
end
it "should chain the tweets" do
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[1])
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[1])
call "#twitter","thread",%w(a)
- @messages.should == @entries[1..3]
+ expect(@messages).to eq(@entries[1..3])
end
it "should chain the tweets by screen name" do
- @statuses.should_receive(:find_by_tid).with('mzp').and_return(nil)
- @statuses.should_receive(:find_by_sid).with('mzp').and_return(nil)
- @statuses.should_receive(:find_by_screen_name).with('mzp',:limit=>1).and_return([ @entries[1] ])
+ expect(@statuses).to receive(:find_by_tid).with('mzp').and_return(nil)
+ expect(@statuses).to receive(:find_by_sid).with('mzp').and_return(nil)
+ expect(@statuses).to receive(:find_by_screen_name).with('mzp',:limit=>1).and_return([ @entries[1] ])
call "#twitter","thread",%w(mzp)
- @messages.should == @entries[1..3]
+ expect(@messages).to eq(@entries[1..3])
end
it "should chain the tweets by sid" do
- @statuses.should_receive(:find_by_tid).with('mzp:a').and_return(nil)
- @statuses.should_receive(:find_by_sid).with('mzp:a').and_return(@entries[1])
+ expect(@statuses).to receive(:find_by_tid).with('mzp:a').and_return(nil)
+ expect(@statuses).to receive(:find_by_sid).with('mzp:a').and_return(@entries[1])
call "#twitter","thread",%w(mzp:a)
- @messages.should == @entries[1..3]
+ expect(@messages).to eq(@entries[1..3])
end
it "should chain the tweets with limit" do
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[1])
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[1])
call "#twitter","thread",%w(a 2)
- @messages.should == @entries[1..2]
+ expect(@messages).to eq(@entries[1..2])
end
it "should get new tweets" do
- @statuses.should_receive(:find_by_tid).with('a').and_return(@entries[4])
+ expect(@statuses).to receive(:find_by_tid).with('a').and_return(@entries[4])
user = user 1, 'mzp'
status = status '','user'=>user
entry = entry user,status,'new-entry'
- @statuses.should_receive(:add).with(:status => status, :user => user, :source=>:thread).and_return{
+ expect(@statuses).to receive(:add).with(status: status, user: user, source: :thread){
@entries << entry
}
- @api.should_receive(:get).with('statuses/show/5').and_return(status)
+ expect(@api).to receive(:get).with('statuses/show/5').and_return(status)
call "#twitter","thread",%w(a)
- @messages.should == [@entries[4], entry]
+ expect(@messages).to eq([@entries[4], entry])
end
end
diff --git a/spec/command/time_spec.rb b/spec/command/time_spec.rb
index 5c46b32..cad0594 100644
--- a/spec/command/time_spec.rb
+++ b/spec/command/time_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/time'
describe Atig::Command::Time do
@@ -8,8 +7,8 @@ describe Atig::Command::Time do
def user(offset, tz)
u = double "user-#{offset}"
- u.stub(:utc_offset).and_return(offset)
- u.stub(:time_zone).and_return(tz)
+ allow(u).to receive(:utc_offset).and_return(offset)
+ allow(u).to receive(:time_zone).and_return(tz)
u
end
@@ -19,33 +18,31 @@ describe Atig::Command::Time do
end
it "should provide time command" do
- @gateway.names.should == ['time']
+ expect(@gateway.names).to eq(['time'])
end
it "should show offset time on DB" do
- ::Time.should_receive(:now).and_return(Time.at(0))
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(@user)
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01"
+ expect(::Time).to receive(:now).and_return(Time.at(0))
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01")
}
call '#twitter', 'time', ['mzp']
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should show offset time via API" do
- ::Time.should_receive(:now).and_return(Time.at(0))
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(nil)
- @api.should_receive(:get).with('users/show', :screen_name=>'mzp').and_return(@user)
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01"
+ expect(::Time).to receive(:now).and_return(Time.at(0))
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(nil)
+ expect(@api).to receive(:get).with('users/show', screen_name:'mzp').and_return(@user)
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01TIME :1970-01-01T01:01:01+01:01 (Tokyo)\x01")
}
call '#twitter', 'time', ['mzp']
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
end
diff --git a/spec/command/uptime_spec.rb b/spec/command/uptime_spec.rb
index 0d0a457..c76967d 100644
--- a/spec/command/uptime_spec.rb
+++ b/spec/command/uptime_spec.rb
@@ -1,54 +1,53 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/uptime'
describe Atig::Command::Uptime do
include CommandHelper
before do
- ::Time.should_receive(:now).and_return(::Time.at(0))
+ expect(::Time).to receive(:now).and_return(::Time.at(0))
@command = init Atig::Command::Uptime
end
it "should register uptime command" do
- @gateway.names.should == ['uptime']
+ expect(@gateway.names).to eq(['uptime'])
end
it "should return mm:ss(min)" do
- ::Time.should_receive(:now).and_return(::Time.at(0))
- @channel.should_receive(:notify).with("00:00")
+ expect(::Time).to receive(:now).and_return(::Time.at(0))
+ expect(@channel).to receive(:notify).with("00:00")
call '#twitter', 'uptime', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should return mm:ss(max)" do
- ::Time.should_receive(:now).and_return(::Time.at(60*60-1))
- @channel.should_receive(:notify).with("59:59")
+ expect(::Time).to receive(:now).and_return(::Time.at(60*60-1))
+ expect(@channel).to receive(:notify).with("59:59")
call '#twitter', 'uptime', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should return hh:mm:ss(min)" do
- ::Time.should_receive(:now).and_return(::Time.at(60*60))
- @channel.should_receive(:notify).with("01:00:00")
+ expect(::Time).to receive(:now).and_return(::Time.at(60*60))
+ expect(@channel).to receive(:notify).with("01:00:00")
call '#twitter', 'uptime', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should return hh:mm:ss(max)" do
- ::Time.should_receive(:now).and_return(::Time.at(24*60*60-1))
- @channel.should_receive(:notify).with("23:59:59")
+ expect(::Time).to receive(:now).and_return(::Time.at(24*60*60-1))
+ expect(@channel).to receive(:notify).with("23:59:59")
call '#twitter', 'uptime', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
it "should return dd days hh:mm:ss" do
- ::Time.should_receive(:now).and_return(::Time.at(24*60*60))
- @channel.should_receive(:notify).with("1 days 00:00")
+ expect(::Time).to receive(:now).and_return(::Time.at(24*60*60))
+ expect(@channel).to receive(:notify).with("1 days 00:00")
call '#twitter', 'uptime', []
- @gateway.notified.should == '#twitter'
+ expect(@gateway.notified).to eq('#twitter')
end
end
diff --git a/spec/command/user_info_spec.rb b/spec/command/user_info_spec.rb
index 37acc76..2bd4532 100644
--- a/spec/command/user_info_spec.rb
+++ b/spec/command/user_info_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__)
require 'atig/command/user_info'
describe Atig::Command::UserInfo do
@@ -10,30 +9,28 @@ describe Atig::Command::UserInfo do
@command = init Atig::Command::UserInfo
@status = double "status"
@user = double "user"
- @user.stub(:description).and_return('hogehoge')
- @user.stub(:status).and_return(@status)
+ allow(@user).to receive(:description).and_return('hogehoge')
+ allow(@user).to receive(:status).and_return(@status)
end
it "should show the source via DB" do
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(@user)
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01hogehoge\x01"
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01hogehoge\x01")
}
call '#twitter','userinfo',%w(mzp)
end
it "should show the source via API" do
- @followings.should_receive(:find_by_screen_name).with('mzp').and_return(nil)
- @api.should_receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
+ expect(@followings).to receive(:find_by_screen_name).with('mzp').and_return(nil)
+ expect(@api).to receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01hogehoge\x01"
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01hogehoge\x01")
}
call '#twitter','userinfo',%w(mzp)
diff --git a/spec/command/user_spec.rb b/spec/command/user_spec.rb
index 0a5a2de..5c4c04b 100644
--- a/spec/command/user_spec.rb
+++ b/spec/command/user_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/user'
describe Atig::Command::User do
@@ -10,23 +9,23 @@ describe Atig::Command::User do
end
it "should have '/me status' name" do
- @gateway.names.should == ['user', 'u']
+ expect(@gateway.names).to eq(['user', 'u'])
end
it "should" do
foo = entry user(1,'mzp'),status('foo')
bar = entry user(1,'mzp'),status('bar')
baz = entry user(1,'mzp'),status('baz')
- @api.
- should_receive(:get).
+ expect(@api).
+ to receive(:get).
with('statuses/user_timeline',:count=>20,:screen_name=>'mzp').
and_return([foo, bar, baz])
- @statuses.should_receive(:add).with(any_args).at_least(3)
- @statuses.
- should_receive(:find_by_screen_name).
+ expect(@statuses).to receive(:add).with(any_args).at_least(3)
+ expect(@statuses).
+ to receive(:find_by_screen_name).
with('mzp',:limit=>20).
and_return([foo, bar, baz])
- @channel.should_receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
+ expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
call "#twitter","user",%w(mzp)
end
@@ -34,16 +33,16 @@ describe Atig::Command::User do
foo = entry user(1,'mzp'),status('foo')
bar = entry user(1,'mzp'),status('bar')
baz = entry user(1,'mzp'),status('baz')
- @api.
- should_receive(:get).
+ expect(@api).
+ to receive(:get).
with('statuses/user_timeline',:count=>200,:screen_name=>'mzp').
and_return([foo, bar, baz])
- @statuses.should_receive(:add).with(any_args).at_least(3)
- @statuses.
- should_receive(:find_by_screen_name).
+ expect(@statuses).to receive(:add).with(any_args).at_least(3)
+ expect(@statuses).
+ to receive(:find_by_screen_name).
with('mzp',:limit=>200).
and_return([foo, bar, baz])
- @channel.should_receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
+ expect(@channel).to receive(:message).with(anything, Net::IRC::Constants::NOTICE).at_least(3)
call "#twitter","user",%w(mzp 200)
end
end
diff --git a/spec/command/version_spec.rb b/spec/command/version_spec.rb
index 908a19f..cc0279c 100644
--- a/spec/command/version_spec.rb
+++ b/spec/command/version_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/version'
describe Atig::Command::Version do
@@ -9,56 +8,53 @@ describe Atig::Command::Version do
before do
@command = init Atig::Command::Version
@status = double "status"
- @status.stub(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
+ allow(@status).to receive(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
@user = double "user"
- @user.stub(:status).and_return(@status)
+ allow(@user).to receive(:status).and_return(@status)
end
it "should provide version command" do
- @gateway.names.should == ['version']
+ expect(@gateway.names).to eq(['version'])
end
it "should show the source via DB" do
- @statuses.
- should_receive(:find_by_screen_name).
+ expect(@statuses).
+ to receive(:find_by_screen_name).
with('mzp',:limit => 1).
and_return([ entry(@user, at status) ])
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01Echofon <http://echofon.com/>\x01"
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01Echofon <http://echofon.com/>\x01")
}
call '#twitter','version',%w(mzp)
end
it "should show the source of web" do
status = double "status"
- status.stub(:source).and_return('web')
- @statuses.
- should_receive(:find_by_screen_name).
+ allow(status).to receive(:source).and_return('web')
+ expect(@statuses).
+ to receive(:find_by_screen_name).
with('mzp',:limit => 1).
and_return([ entry(@user,status) ])
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01web\x01"
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01web\x01")
}
call '#twitter','version',%w(mzp)
end
it "should show the source via API" do
- @statuses.stub(:find_by_screen_name).and_return(@status)
- @statuses.should_receive(:find_by_screen_name).with('mzp',:limit => 1).and_return(nil)
- @statuses.should_receive(:add).with(:status => @status, :user => @user, :source=>:version)
- @api.should_receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
-
- @channel.
- should_receive(:message).
- with(anything, Net::IRC::Constants::NOTICE).
- and_return{|s,_|
- s.status.text.should == "\x01Echofon <http://echofon.com/>\x01"
+ allow(@statuses).to receive(:find_by_screen_name).and_return(@status)
+ expect(@statuses).to receive(:find_by_screen_name).with('mzp',:limit => 1).and_return(nil)
+ expect(@statuses).to receive(:add).with(status: @status, user: @user, source: :version)
+ expect(@api).to receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
+
+ expect(@channel).
+ to receive(:message).
+ with(anything, Net::IRC::Constants::NOTICE){|s,_|
+ expect(s.status.text).to eq("\x01Echofon <http://echofon.com/>\x01")
}
call '#twitter','version',%w(mzp)
diff --git a/spec/command/whois_spec.rb b/spec/command/whois_spec.rb
index 14e25bd..c5a71aa 100644
--- a/spec/command/whois_spec.rb
+++ b/spec/command/whois_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/command/whois'
require 'atig/command/info'
@@ -17,61 +16,61 @@ describe Atig::Command::Whois do
before do
@command = init Atig::Command::Whois
@status = double 'status'
- @status.stub(:created_at).and_return(time(::Time.at(42)))
+ allow(@status).to receive(:created_at).and_return(time(::Time.at(42)))
@user = double "user"
- @user.stub(:name) .and_return('name')
- @user.stub(:id) .and_return('10')
- @user.stub(:screen_name).and_return('screen_name')
- @user.stub(:description).and_return('blah blah')
- @user.stub(:protected) .and_return(false)
- @user.stub(:location) .and_return('Tokyo, Japan')
- @user.stub(:created_at) .and_return(time(::Time.at(0)))
- @user.stub(:status) .and_return(@status)
+ allow(@user).to receive(:name) .and_return('name')
+ allow(@user).to receive(:id) .and_return('10')
+ allow(@user).to receive(:screen_name).and_return('screen_name')
+ allow(@user).to receive(:description).and_return('blah blah')
+ allow(@user).to receive(:protected) .and_return(false)
+ allow(@user).to receive(:location) .and_return('Tokyo, Japan')
+ allow(@user).to receive(:created_at) .and_return(time(::Time.at(0)))
+ allow(@user).to receive(:status) .and_return(@status)
- ::Time.stub(:now).and_return(::Time.at(50))
- @followings.stub(:find_by_screen_name).with('mzp').and_return(@user)
+ allow(::Time).to receive(:now).and_return(::Time.at(50))
+ allow(@followings).to receive(:find_by_screen_name).with('mzp').and_return(@user)
end
it "should proide whois command" do
- @command.command_name.should == %w(whois)
+ expect(@command.command_name).to eq(%w(whois))
end
it "should show profile" do
commands = []
- @gateway.should_receive(:post){|_,command,_,_,*params|
+ expect(@gateway).to receive(:post){|_,command,_,_,*params|
commands << command
case command
when RPL_WHOISUSER
- params.should == ['id=10', 'twitter.com', "*", 'name / blah blah']
+ expect(params).to eq(['id=10', 'twitter.com', "*", 'name / blah blah'])
when RPL_WHOISSERVER
- params.should == ['twitter.com', 'Tokyo, Japan']
+ expect(params).to eq(['twitter.com', 'Tokyo, Japan'])
when RPL_WHOISIDLE
- params.should == ["8", "0", "seconds idle, signon time"]
+ expect(params).to eq(["8", "0", "seconds idle, signon time"])
when RPL_ENDOFWHOIS
- params.should == ["End of WHOIS list"]
+ expect(params).to eq(["End of WHOIS list"])
end
}.at_least(4)
call '#twitter','whois',%w(mzp)
- commands.should == [ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS]
+ expect(commands).to eq([ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS])
end
it "should append /protect if the user is protected" do
- @user.stub(:protected).and_return(true)
+ allow(@user).to receive(:protected).and_return(true)
commands = []
- @gateway.should_receive(:post){|_,command,_,_,*params|
+ expect(@gateway).to receive(:post){|_,command,_,_,*params|
commands << command
case command
when RPL_WHOISUSER
- params.should == ['id=10', 'twitter.com/protected', "*", 'name / blah blah']
+ expect(params).to eq(['id=10', 'twitter.com/protected', "*", 'name / blah blah'])
when RPL_WHOISSERVER
- params.should == ['twitter.com/protected', 'Tokyo, Japan']
+ expect(params).to eq(['twitter.com/protected', 'Tokyo, Japan'])
when RPL_WHOISIDLE
- params.should == ["8", "0", "seconds idle, signon time"]
+ expect(params).to eq(["8", "0", "seconds idle, signon time"])
when RPL_ENDOFWHOIS
- params.should == ["End of WHOIS list"]
+ expect(params).to eq(["End of WHOIS list"])
end
}.at_least(4)
call '#twitter','whois',%w(mzp)
- commands.should == [ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS]
+ expect(commands).to eq([ RPL_WHOISUSER, RPL_WHOISSERVER, RPL_WHOISIDLE, RPL_ENDOFWHOIS])
end
end
diff --git a/spec/command_helper.rb b/spec/command_helper.rb
index a73c831..fe1a865 100644
--- a/spec/command_helper.rb
+++ b/spec/command_helper.rb
@@ -66,7 +66,7 @@ module CommandHelper
def init(klass)
@log = double 'log'
@opts = Atig::Option.new({})
- context = OpenStruct.new :log=>@log, :opts=>@opts
+ context = OpenStruct.new log:@log, opts:@opts
@channel = double 'channel'
@gateway = FakeGateway.new @channel
@@ -88,7 +88,7 @@ module CommandHelper
end
def stub_status(key, hash)
- @statuses.stub(key).and_return{|arg,*_|
+ allow(@statuses).to receive(key){|arg,*_|
hash.fetch(arg, hash[:default])
}
end
diff --git a/spec/db/followings_spec.rb b/spec/db/followings_spec.rb
index b36afc6..d81b2fa 100644
--- a/spec/db/followings_spec.rb
+++ b/spec/db/followings_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/db/followings'
describe Atig::Db::Followings,"when it is empty" do
@@ -14,13 +13,13 @@ describe Atig::Db::Followings,"when it is empty" do
end
it "should be emtpy" do
- @db.empty?.should be_true
+ expect(@db.empty?).to be_truthy
end
end
describe Atig::Db::Followings,"when updated users" do
def user(id, name, protect, only)
- OpenStruct.new(:id => id, :screen_name=>name, :protected=>protect, :only=>only)
+ OpenStruct.new(id: id, screen_name:name, protected:protect, only:only)
end
before do
@@ -43,7 +42,7 @@ describe Atig::Db::Followings,"when updated users" do
end
it "should return size" do
- @db.size.should == 2
+ expect(@db.size).to eq(2)
end
it "should be invalidated" do
@@ -53,56 +52,56 @@ describe Atig::Db::Followings,"when updated users" do
end
@db.invalidate
- called.should be_true
+ expect(called).to be_truthy
end
it "should not empty" do
- @db.empty?.should be_false
+ expect(@db.empty?).to be_falsey
end
it "should call listener with :join" do
@db.update [ @alice, @bob, @charriey ]
- @listen[:join].should == [ @charriey ]
- @listen[:part].should == nil
- @listen[:mode].should == nil
+ expect(@listen[:join]).to eq([ @charriey ])
+ expect(@listen[:part]).to eq(nil)
+ expect(@listen[:mode]).to eq(nil)
end
it "should call listener with :part" do
@db.update [ @alice ]
- @listen[:join].should == nil
- @listen[:part].should == [ @bob ]
- @listen[:mode].should == nil
+ expect(@listen[:join]).to eq(nil)
+ expect(@listen[:part]).to eq([ @bob ])
+ expect(@listen[:mode]).to eq(nil)
end
it "should not found removed user[BUG]" do
- @db.include?(@bob).should == true
+ expect(@db.include?(@bob)).to eq(true)
@db.update [ @alice ]
# now, @bob is not member
- @db.include?(@bob).should == false
+ expect(@db.include?(@bob)).to eq(false)
end
it "should call listener with :mode" do
bob = user 5,'bob', false, false
@db.update [ @alice, bob ]
- @listen[:join].should == nil
- @listen[:part].should == nil
- @listen[:mode].should == [ bob ]
+ expect(@listen[:join]).to eq(nil)
+ expect(@listen[:part]).to eq(nil)
+ expect(@listen[:mode]).to eq([ bob ])
end
it "should have users" do
- @db.users.should == [ @alice, @bob ]
+ expect(@db.users).to eq([ @alice, @bob ])
end
it "should be found by screen_name" do
- @db.find_by_screen_name('alice').should == @alice
- @db.find_by_screen_name('???').should == nil
+ expect(@db.find_by_screen_name('alice')).to eq(@alice)
+ expect(@db.find_by_screen_name('???')).to eq(nil)
end
it "should check include" do
alice = user @alice.id,'alice', true, true
- @db.include?(@charriey).should be_false
- @db.include?(@alice).should be_true
- @db.include?(alice).should be_true
+ expect(@db.include?(@charriey)).to be_falsey
+ expect(@db.include?(@alice)).to be_truthy
+ expect(@db.include?(alice)).to be_truthy
end
end
diff --git a/spec/db/listenable_spec.rb b/spec/db/listenable_spec.rb
index c61cf87..c16c1a8 100644
--- a/spec/db/listenable_spec.rb
+++ b/spec/db/listenable_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/db/listenable'
class SampleListener
@@ -24,9 +23,9 @@ describe Atig::Db::Listenable, "when it is called" do
it "should call all listener" do
@listeners.hi 1,2,3
- @args.length.should == 3
+ expect(@args.length).to eq(3)
1.upto(2) {|i|
- @args[i].should == [1,2,3]
+ expect(@args[i]).to eq([1,2,3])
}
end
end
diff --git a/spec/db/lists_spec.rb b/spec/db/lists_spec.rb
index 05ec2fa..d13f8a8 100644
--- a/spec/db/lists_spec.rb
+++ b/spec/db/lists_spec.rb
@@ -1,11 +1,10 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/db/lists'
describe Atig::Db::Lists do
def user(id, name, protect, only)
- OpenStruct.new(:id => id, :screen_name=>name, :protected=>protect, :only=>only)
+ OpenStruct.new(id: id, screen_name:name, protected:protect, only:only)
end
before do
@@ -29,15 +28,15 @@ describe Atig::Db::Lists do
@lists.update("a" => [ @alice, @bob ],
"b" => [ @alice, @bob , @charriey ])
- @lists.find_by_screen_name('alice').sort.should == ["a", "b"]
- @lists.find_by_screen_name('charriey').should == ["b"]
+ expect(@lists.find_by_screen_name('alice').sort).to eq(["a", "b"])
+ expect(@lists.find_by_screen_name('charriey')).to eq(["b"])
end
it "should have lists" do
@lists.update("a" => [ @alice, @bob ],
"b" => [ @alice, @bob , @charriey ])
- @lists.find_by_list_name('a').should == [ @alice, @bob ]
+ expect(@lists.find_by_list_name('a')).to eq([ @alice, @bob ])
end
it "should have each" do
@@ -51,52 +50,52 @@ describe Atig::Db::Lists do
@lists.each do|name,users|
hash[name] = users
end
- hash.should == data
+ expect(hash).to eq(data)
end
it "should call listener when new list" do
@lists.update("a" => [ @alice, @bob ])
- @args.keys.should include(:new, :join)
- @args[:new].should == [ "a" ]
- @args[:join].should == [ "a", [ @alice, @bob ] ]
+ expect(@args.keys).to include(:new, :join)
+ expect(@args[:new]).to eq([ "a" ])
+ expect(@args[:join]).to eq([ "a", [ @alice, @bob ] ])
end
it "should call listener when partcial update" do
@lists.update("a" => [ @alice ])
@lists["a"].update([ @alice, @bob, @charriey ])
- @args[:join].should == ["a", [ @bob, @charriey ]]
+ expect(@args[:join]).to eq(["a", [ @bob, @charriey ]])
end
it "should call on_invalidated" do
called = false
@lists.on_invalidated do|name|
- name.should == "a"
+ expect(name).to eq("a")
called = true
end
@lists.invalidate("a")
- called.should be_true
+ expect(called).to be_truthy
end
it "should call listener when delete list" do
@lists.update("a" => [ @alice, @bob ])
@lists.update({})
- @args.keys.should include(:new, :join, :del)
- @args[:del].should == ["a"]
+ expect(@args.keys).to include(:new, :join, :del)
+ expect(@args[:del]).to eq(["a"])
end
it "should call listener when join user" do
@lists.update("a" => [ @alice ])
@lists.update("a" => [ @alice, @bob, @charriey ])
- @args[:join].should == ["a", [ @bob, @charriey ]]
+ expect(@args[:join]).to eq(["a", [ @bob, @charriey ]])
end
it "should call listener when exit user" do
@lists.update("a" => [ @alice, @bob, @charriey ])
@lists.update("a" => [ @alice ])
- @args[:part].should == ["a", [ @bob, @charriey ]]
+ expect(@args[:part]).to eq(["a", [ @bob, @charriey ]])
end
it "should call listener when change user mode" do
@@ -104,6 +103,6 @@ describe Atig::Db::Lists do
bob = user @bob.id, 'bob', false, false
@lists.update("a" => [ @alice, bob ])
- @args[:mode].should == [ "a", [ bob ]]
+ expect(@args[:mode]).to eq([ "a", [ bob ]])
end
end
diff --git a/spec/db/roman_spec.rb b/spec/db/roman_spec.rb
index 9da6d79..9e0884f 100644
--- a/spec/db/roman_spec.rb
+++ b/spec/db/roman_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/db/roman'
describe Atig::Db::Roman do
@@ -9,9 +8,8 @@ describe Atig::Db::Roman do
end
it "should make readble tid" do
- @roman.make(0).should == 'a'
- @roman.make(1).should == 'i'
- @roman.make(2).should == 'u'
+ expect(@roman.make(0)).to eq('a')
+ expect(@roman.make(1)).to eq('i')
+ expect(@roman.make(2)).to eq('u')
end
end
-
diff --git a/spec/db/sized_uniq_array_spec.rb b/spec/db/sized_uniq_array_spec.rb
index 8dc1b84..8d75eca 100644
--- a/spec/db/sized_uniq_array_spec.rb
+++ b/spec/db/sized_uniq_array_spec.rb
@@ -1,13 +1,12 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/db/sized_uniq_array'
require 'ostruct'
describe Atig::Db::SizedUniqArray do
def item(id)
item = double "Item-#{id}"
- item.stub(:id).and_return id
+ allow(item).to receive(:id).and_return id
item
end
@@ -24,40 +23,40 @@ describe Atig::Db::SizedUniqArray do
end
it "should include items" do
- @array.to_a.should == [ @item1, @item2, @item3 ]
+ expect(@array.to_a).to eq([ @item1, @item2, @item3 ])
end
it "should rorate array" do
@array << @item4
- @array.to_a.should == [ @item2, @item3, @item4 ]
+ expect(@array.to_a).to eq([ @item2, @item3, @item4 ])
end
it "should have reverse_each" do
xs = []
@array.reverse_each {|x| xs << x }
- xs.should == [ @item3, @item2, @item1 ]
+ expect(xs).to eq([ @item3, @item2, @item1 ])
end
it "should not have duplicate element" do
@array << item(1)
- @array.to_a.should == [ @item1, @item2, @item3 ]
+ expect(@array.to_a).to eq([ @item1, @item2, @item3 ])
end
it "should be accesible by index" do
- @array[0].should == @item1
- @array[1].should == @item2
- @array[2].should == @item3
+ expect(@array[0]).to eq(@item1)
+ expect(@array[1]).to eq(@item2)
+ expect(@array[2]).to eq(@item3)
end
it "should not change index" do
@array << @item4
- @array[0].should == @item4
- @array[1].should == @item2
- @array[2].should == @item3
+ expect(@array[0]).to eq(@item4)
+ expect(@array[1]).to eq(@item2)
+ expect(@array[2]).to eq(@item3)
end
it "should return index when add element" do
- (@array << @item4).should == 0
- (@array << @item3).should == nil
+ expect(@array << @item4).to eq(0)
+ expect(@array << @item3).to eq(nil)
end
end
diff --git a/spec/db/statuses_spec.rb b/spec/db/statuses_spec.rb
index 58a4715..6f62d5a 100644
--- a/spec/db/statuses_spec.rb
+++ b/spec/db/statuses_spec.rb
@@ -1,16 +1,15 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'fileutils'
require 'atig/db/statuses'
describe Atig::Db::Statuses do
def status(id, text, time)
- OpenStruct.new(:id => id, :text => text, :created_at => time.strftime("%a %b %d %H:%M:%S +0000 %Y"))
+ OpenStruct.new(id: id, text: text, created_at: time.strftime("%a %b %d %H:%M:%S +0000 %Y"))
end
def user(name)
- OpenStruct.new(:screen_name => name, :id => name)
+ OpenStruct.new(screen_name: name, id: name)
end
before do
@@ -26,9 +25,9 @@ describe Atig::Db::Statuses do
@alice = user 'alice'
@bob = user 'bob'
- @db.add :status => @a , :user => @alice, :source => :srcA
- @db.add :status => @b , :user => @bob , :source => :srcB
- @db.add :status => @c , :user => @alice, :source => :srcC
+ @db.add status: @a , user: @alice, source: :srcA
+ @db.add status: @b , user: @bob , source: :srcB
+ @db.add status: @c , user: @alice, source: :srcC
end
after(:all) do
@@ -43,142 +42,142 @@ describe Atig::Db::Statuses do
entry = nil
@db.listen{|x| entry = x }
- @db.add :status => @d, :user => @alice, :source => :timeline, :fuga => :hoge
+ @db.add status: @d, user: @alice, source: :timeline, fuga: :hoge
- entry.source.should == :timeline
- entry.status.should == @d
- entry.tid.should match(/\w+/)
- entry.sid.should match(/\w+/)
- entry.user.should == @alice
- entry.source.should == :timeline
- entry.fuga.should == :hoge
+ expect(entry.source).to eq(:timeline)
+ expect(entry.status).to eq(@d)
+ expect(entry.tid).to match(/\w+/)
+ expect(entry.sid).to match(/\w+/)
+ expect(entry.user).to eq(@alice)
+ expect(entry.source).to eq(:timeline)
+ expect(entry.fuga).to eq(:hoge)
end
it "should not contain duplicate" do
called = false
@db.listen{|*_| called = true }
- @db.add :status => @c, :user => @bob, :source => :timeline
- called.should be_false
+ @db.add status: @c, user: @bob, source: :timeline
+ expect(called).to be_falsey
end
it "should be found by id" do
entry = @db.find_by_id 1
- entry.id.should == 1
- entry.status.should == @a
- entry.user .should == @alice
- entry.tid .should match(/\w+/)
- entry.sid.should match(/\w+/)
+ expect(entry.id).to eq(1)
+ expect(entry.status).to eq(@a)
+ expect(entry.user) .to eq(@alice)
+ expect(entry.tid) .to match(/\w+/)
+ expect(entry.sid).to match(/\w+/)
end
it "should have unique tid" do
db = Atig::Db::Statuses.new 'test.db'
- db.add :status => @d , :user => @alice, :source => :srcA
+ db.add status: @d , user: @alice, source: :srcA
a = @db.find_by_id(1)
d = @db.find_by_id(4)
- a.tid.should_not == d.tid
- a.sid.should_not == d.cid
+ expect(a.tid).not_to eq(d.tid)
+ expect(a.sid).not_to eq(d.cid)
end
it "should be found all" do
db = @db.find_all
- db.size.should == 3
+ expect(db.size).to eq(3)
a,b,c = db
- a.status.should == @c
- a.user .should == @alice
- a.tid .should match(/\w+/)
- a.sid .should match(/\w+/)
+ expect(a.status).to eq(@c)
+ expect(a.user) .to eq(@alice)
+ expect(a.tid) .to match(/\w+/)
+ expect(a.sid) .to match(/\w+/)
- b.status.should == @b
- b.user .should == @bob
- b.tid .should match(/\w+/)
- b.sid .should match(/\w+/)
+ expect(b.status).to eq(@b)
+ expect(b.user) .to eq(@bob)
+ expect(b.tid) .to match(/\w+/)
+ expect(b.sid) .to match(/\w+/)
- c.status.should == @a
- c.user.should == @alice
- c.tid.should match(/\w+/)
- c.sid.should match(/\w+/)
+ expect(c.status).to eq(@a)
+ expect(c.user).to eq(@alice)
+ expect(c.tid).to match(/\w+/)
+ expect(c.sid).to match(/\w+/)
end
it "should be found by tid" do
entry = @db.find_by_id(1)
- @db.find_by_tid(entry.tid).should == entry
+ expect(@db.find_by_tid(entry.tid)).to eq(entry)
end
it "should be found by sid" do
entry = @db.find_by_id(1)
- @db.find_by_sid(entry.sid).should == entry
+ expect(@db.find_by_sid(entry.sid)).to eq(entry)
end
it "should be found by tid" do
- @db.find_by_tid('__').should be_nil
+ expect(@db.find_by_tid('__')).to be_nil
end
it "should be found by user" do
a,b = *@db.find_by_user(@alice)
- a.status.should == @c
- a.user .should == @alice
- a.tid .should match(/\w+/)
- a.sid .should match(/\w+/)
+ expect(a.status).to eq(@c)
+ expect(a.user) .to eq(@alice)
+ expect(a.tid) .to match(/\w+/)
+ expect(a.sid) .to match(/\w+/)
- b.status.should == @a
- b.user.should == @alice
- b.tid.should match(/\w+/)
- b.sid.should match(/\w+/)
+ expect(b.status).to eq(@a)
+ expect(b.user).to eq(@alice)
+ expect(b.tid).to match(/\w+/)
+ expect(b.sid).to match(/\w+/)
end
it "should be found by screen_name" do
db = @db.find_by_screen_name('alice')
- db.size.should == 2
+ expect(db.size).to eq(2)
a,b = db
- a.status.should == @c
- a.user .should == @alice
- a.tid .should match(/\w+/)
- a.sid .should match(/\w+/)
+ expect(a.status).to eq(@c)
+ expect(a.user) .to eq(@alice)
+ expect(a.tid) .to match(/\w+/)
+ expect(a.sid) .to match(/\w+/)
- b.status.should == @a
- b.user.should == @alice
- b.tid.should match(/\w+/)
- b.sid.should match(/\w+/)
+ expect(b.status).to eq(@a)
+ expect(b.user).to eq(@alice)
+ expect(b.tid).to match(/\w+/)
+ expect(b.sid).to match(/\w+/)
end
it "should be found by screen_name with limit" do
- xs = @db.find_by_screen_name('alice', :limit => 1)
- xs.size.should == 1
+ xs = @db.find_by_screen_name('alice', limit: 1)
+ expect(xs.size).to eq(1)
a,_ = xs
- a.status.should == @c
- a.user .should == @alice
- a.tid .should match(/\w+/)
- a.sid .should match(/\w+/)
+ expect(a.status).to eq(@c)
+ expect(a.user) .to eq(@alice)
+ expect(a.tid) .to match(/\w+/)
+ expect(a.sid) .to match(/\w+/)
end
it "should remove by id" do
@db.remove_by_id 1
- @db.find_by_id(1).should be_nil
+ expect(@db.find_by_id(1)).to be_nil
end
it "should have uniq tid/sid when removed" do
old = @db.find_by_id 3
@db.remove_by_id 3
- @db.add :status => @c , :user => @alice, :source => :src
+ @db.add status: @c , user: @alice, source: :src
new = @db.find_by_id 3
- old.tid.should_not == new.tid
- old.sid.should_not == new.sid
+ expect(old.tid).not_to eq(new.tid)
+ expect(old.sid).not_to eq(new.sid)
end
it "should cleanup" do
- Atig::Db::Statuses::Size = 10 unless defined? Atig::Db::Statuses::Size # hack
+ Atig::Db::Statuses::Size = 10 unless defined? Atig::Db::Statuses::Size # hack
Atig::Db::Statuses::Size.times do|i|
s = status i+100, 'a', Time.utc(2010,1,5)+i+1
- @db.add :status => s , :user => @alice , :source => :srcB
+ @db.add status: s , user: @alice , source: :srcB
end
@db.cleanup
- @db.find_by_status_id(@a.id).should == nil
+ expect(@db.find_by_status_id(@a.id)).to eq(nil)
end
end
diff --git a/spec/ifilter/expand_url_spec.rb b/spec/ifilter/expand_url_spec.rb
index 62f3d88..b60dfab 100644
--- a/spec/ifilter/expand_url_spec.rb
+++ b/spec/ifilter/expand_url_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/expand_url'
require 'atig/twitter_struct'
@@ -10,57 +9,57 @@ end
describe Atig::IFilter::ExpandUrl, "when disable whole url" do
def filtered(text)
- ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(:log=>double('log'),:opts=>OpenStruct.new)
+ ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(log:double('log'),:opts=>OpenStruct.new)
ifilter.call status(text)
end
it "should expand bit.ly" do
- filtered("This is http://bit.ly/hoge").should be_text("This is [http://bit.ly/hoge]")
- filtered("This is http://bitly.com/hoge").should be_text("This is [http://bitly.com/hoge]")
+ expect(filtered("This is http://bit.ly/hoge")).to be_text("This is [http://bit.ly/hoge]")
+ expect(filtered("This is http://bitly.com/hoge")).to be_text("This is [http://bitly.com/hoge]")
end
it "should expand htn.to" do
- filtered("This is http://htn.to/TZdkXg").should be_text("This is [http://htn.to/TZdkXg]")
- filtered("This is http://htnnto/TZdkXg").should be_text("This is http://htnnto/TZdkXg")
+ expect(filtered("This is http://htn.to/TZdkXg")).to be_text("This is [http://htn.to/TZdkXg]")
+ expect(filtered("This is http://htnnto/TZdkXg")).to be_text("This is http://htnnto/TZdkXg")
end
it "should expand tmblr.co" do
- filtered("This is http://tmblr.co/Z0rNbyxhxUK5").should be_text("This is [http://tmblr.co/Z0rNbyxhxUK5]")
+ expect(filtered("This is http://tmblr.co/Z0rNbyxhxUK5")).to be_text("This is [http://tmblr.co/Z0rNbyxhxUK5]")
end
it "should expand nico.ms" do
- filtered("This is http://nico.ms/sm11870888").should be_text("This is [http://nico.ms/sm11870888]")
+ expect(filtered("This is http://nico.ms/sm11870888")).to be_text("This is [http://nico.ms/sm11870888]")
end
it "should through other url" do
- filtered("http://example.com").should be_text("http://example.com")
+ expect(filtered("http://example.com")).to be_text("http://example.com")
end
end
describe Atig::IFilter::ExpandUrl, "when enable whole url" do
def filtered(text)
context = OpenStruct.new(
- :log => double('log'),
- :opts => OpenStruct.new(:untiny_whole_urls=>true))
+ log: double('log'),
+ opts: OpenStruct.new(untiny_whole_urls:true))
ifilter = Atig::IFilter::ExpandUrl.new(context)
ifilter.call status(text)
end
it "should expand bit.ly" do
- filtered("This is http://bit.ly/hoge").should be_text("This is [http://bit.ly/hoge]")
+ expect(filtered("This is http://bit.ly/hoge")).to be_text("This is [http://bit.ly/hoge]")
end
it "should expand other url" do
- filtered("http://example.com").should be_text("[http://example.com]")
- filtered("https://example.com").should be_text("[https://example.com]")
+ expect(filtered("http://example.com")).to be_text("[http://example.com]")
+ expect(filtered("https://example.com")).to be_text("[https://example.com]")
end
end
describe Atig::IFilter::ExpandUrl, "when has urls entities" do
def filtered(text, opts)
context = OpenStruct.new(
- :log => double('log'),
- :opts => OpenStruct.new)
+ log: double('log'),
+ opts: OpenStruct.new)
ifilter = Atig::IFilter::ExpandUrl.new(context)
ifilter.call status(text, opts)
end
@@ -77,9 +76,8 @@ describe Atig::IFilter::ExpandUrl, "when has urls entities" do
}]
}
}
- filtered("http://t.co/1Vyoux4kB8", opts).should be_text("http://example.com/")
- filtered("http://t.co/1Vyoux4kB8 http://t.co/V1441ye6g2", opts).should
- be_text("http://example.com/ http://expmaple.org/")
+ expect(filtered("http://t.co/1Vyoux4kB8", opts)).to be_text("http://example.com/")
+ expect(filtered("http://t.co/1Vyoux4kB8 http://t.co/V1441ye6g2", opts)).to be_text("http://example.com/ http://example.org/")
end
it "should expand recursive shorten URL" do
@@ -91,6 +89,6 @@ describe Atig::IFilter::ExpandUrl, "when has urls entities" do
}]
}
}
- filtered("http://t.co/h8sqL5ZMuz", opts).should be_text("[http://bit.ly/1LM4fW]")
+ expect(filtered("http://t.co/h8sqL5ZMuz", opts)).to be_text("[http://bit.ly/1LM4fW]")
end
end
diff --git a/spec/ifilter/retweet_spec.rb b/spec/ifilter/retweet_spec.rb
index 37d3560..e074fe2 100644
--- a/spec/ifilter/retweet_spec.rb
+++ b/spec/ifilter/retweet_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/retweet'
require 'atig/twitter_struct'
@@ -14,15 +13,15 @@ describe Atig::IFilter::Retweet do
end
it "should throw normal status" do
- filtered("hello").should be_text("hello")
+ expect(filtered("hello")).to be_text("hello")
end
it "should prefix RT for Retweet" do
- filtered("RT: hello...",
+ expect(filtered("RT: hello...",
'retweeted_status'=>{ 'text' => 'hello',
'user' => {
'screen_name' => 'mzp'
- } }).
- should be_text("#{@rt}RT @mzp: hello")
+ } })).
+ to be_text("#{@rt}RT @mzp: hello")
end
end
diff --git a/spec/ifilter/retweet_time_spec.rb b/spec/ifilter/retweet_time_spec.rb
index c86d679..109b3d5 100644
--- a/spec/ifilter/retweet_time_spec.rb
+++ b/spec/ifilter/retweet_time_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/retweet_time'
require 'atig/twitter_struct'
@@ -10,16 +9,16 @@ describe Atig::IFilter::RetweetTime do
end
it "should throw normal status" do
- filtered("hello").should be_text("hello")
+ expect(filtered("hello")).to be_text("hello")
end
it "should prefix RT for Retweet" do
- filtered("RT @mzp: hello",
+ expect(filtered("RT @mzp: hello",
'retweeted_status'=>{ 'text' => 'hello',
'created_at' => 'Sat Sep 25 14:33:19 +0000 2010',
'user' => {
'screen_name' => 'mzp'
- } }).
- should be_text("#{@rt}RT @mzp: hello \x0310[2010-09-25 23:33]\x0F")
+ } })).
+ to be_text("#{@rt}RT @mzp: hello \x0310[2010-09-25 14:33]\x0F")
end
end
diff --git a/spec/ifilter/sanitize_spec.rb b/spec/ifilter/sanitize_spec.rb
index 8214925..83a323c 100644
--- a/spec/ifilter/sanitize_spec.rb
+++ b/spec/ifilter/sanitize_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/sanitize'
require 'atig/twitter_struct'
@@ -10,16 +9,16 @@ describe Atig::IFilter::Sanitize do
end
it "should convert escape html" do
- filtered("< > "").should be_text("< > \"")
+ expect(filtered("< > "")).to be_text("< > \"")
end
it "should convert whitespace" do
- filtered("\r\n").should be_text(" ")
- filtered("\r").should be_text(" ")
- filtered("\n").should be_text(" ")
+ expect(filtered("\r\n")).to be_text(" ")
+ expect(filtered("\r")).to be_text(" ")
+ expect(filtered("\n")).to be_text(" ")
end
it "should delete \\000\\001 sequence" do
- filtered("\000\001").should be_text("")
+ expect(filtered("\000\001")).to be_text("")
end
end
diff --git a/spec/ifilter/sid_spec.rb b/spec/ifilter/sid_spec.rb
index 18c1e41..f59bb52 100644
--- a/spec/ifilter/sid_spec.rb
+++ b/spec/ifilter/sid_spec.rb
@@ -1,29 +1,28 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/xid'
require 'atig/twitter_struct'
describe Atig::IFilter::Sid, "when disable tid" do
def filtered(text)
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
- :opts=>OpenStruct.new))
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(log:double('log'),
+ opts:OpenStruct.new))
ifilter.call status(text,'sid'=>1)
end
it "should through text" do
- filtered("hello").should be_text("hello")
+ expect(filtered("hello")).to be_text("hello")
end
end
describe Atig::IFilter::Sid, "when enable tid" do
def filtered(text)
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
- :opts=>OpenStruct.new(:sid=>true)))
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(log:double('log'),
+ opts:OpenStruct.new(sid:true)))
ifilter.call status(text,'sid'=>1)
end
it "should append sid" do
- filtered("hello").should be_text("hello \x0310[1]\x0F")
+ expect(filtered("hello")).to be_text("hello \x0310[1]\x0F")
end
end
diff --git a/spec/ifilter/strip_spec.rb b/spec/ifilter/strip_spec.rb
index 2330f72..68fe7fe 100644
--- a/spec/ifilter/strip_spec.rb
+++ b/spec/ifilter/strip_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/strip'
require 'atig/twitter_struct'
@@ -10,14 +9,14 @@ describe Atig::IFilter::Strip do
end
it "should strip *tw*" do
- @ifilter.call(status("hoge *tw*")).should be_text("hoge")
+ expect(@ifilter.call(status("hoge *tw*"))).to be_text("hoge")
end
it "should strip _" do
- @ifilter.call(status("hoge _")).should be_text("hoge")
+ expect(@ifilter.call(status("hoge _"))).to be_text("hoge")
end
it "should strip white-space" do
- @ifilter.call(status(" hoge ")).should be_text("hoge")
+ expect(@ifilter.call(status(" hoge "))).to be_text("hoge")
end
end
diff --git a/spec/ifilter/tid_spec.rb b/spec/ifilter/tid_spec.rb
index 8bb8ca6..36766be 100644
--- a/spec/ifilter/tid_spec.rb
+++ b/spec/ifilter/tid_spec.rb
@@ -1,29 +1,28 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ifilter/xid'
require 'atig/twitter_struct'
describe Atig::IFilter::Tid, "when disable tid" do
def filtered(text)
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
- :opts=>OpenStruct.new))
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(log:double('log'),
+ opts:OpenStruct.new))
ifilter.call status(text,'tid'=>1)
end
it "should through text" do
- filtered("hello").should be_text("hello")
+ expect(filtered("hello")).to be_text("hello")
end
end
describe Atig::IFilter::Tid, "when enable tid" do
def filtered(text)
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
- :opts=>OpenStruct.new(:tid=>true)))
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(log:double('log'),
+ opts:OpenStruct.new(tid:true)))
ifilter.call status(text,'tid'=>1)
end
it "should append tid" do
- filtered("hello").should be_text("hello \x0310[1]\x0F")
+ expect(filtered("hello")).to be_text("hello \x0310[1]\x0F")
end
end
diff --git a/spec/levenshtein_spec.rb b/spec/levenshtein_spec.rb
index dc1a112..68ef236 100644
--- a/spec/levenshtein_spec.rb
+++ b/spec/levenshtein_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../spec_helper', __FILE__ )
require 'atig/levenshtein'
target = [Atig::Levenshtein, Atig::Levenshtein::PureRuby]
@@ -16,8 +15,8 @@ target.each do |m|
["", "foo", 3],
["あああ", "ああい", 1],
].each do |a, b, expected|
- m.levenshtein(a.split(//), b.split(//)).should == expected
- m.levenshtein(b.split(//), a.split(//)).should == expected
+ expect(m.levenshtein(a.split(//), b.split(//))).to eq(expected)
+ expect(m.levenshtein(b.split(//), a.split(//))).to eq(expected)
end
end
end
diff --git a/spec/ofilter/escape_url_spec.rb b/spec/ofilter/escape_url_spec.rb
index 3410898..11a12b9 100644
--- a/spec/ofilter/escape_url_spec.rb
+++ b/spec/ofilter/escape_url_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ofilter/escape_url'
class Atig::OFilter::EscapeUrl
@@ -10,22 +9,22 @@ end
describe Atig::OFilter::EscapeUrl do
before do
@logger = double('Logger')
- @logger.should_receive(:info).at_most(:once)
- @logger.should_receive(:error).at_most(:once)
- @logger.should_receive(:debug).at_most(:once)
+ expect(@logger).to receive(:info).at_most(:once)
+ expect(@logger).to receive(:error).at_most(:once)
+ expect(@logger).to receive(:debug).at_most(:once)
end
def filtered(text,opt={})
- esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(:log=>@logger,:opts=>nil))
- esc.call :status => text
+ esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(log:@logger,:opts=>nil))
+ esc.call status: text
end
it "through normal url" do
- filtered("http://example.com").should == { :status => "http://example.com"}
+ expect(filtered("http://example.com")).to eq({ status: "http://example.com"})
end
it "escape only url" do
- filtered("あああ http://example.com/あああ").should == { :status => "あああ http://example.com/%E3%81%82%E3%81%82%E3%81%82" }
+ expect(filtered("あああ http://example.com/あああ")).to eq({ status: "あああ http://example.com/%E3%81%82%E3%81%82%E3%81%82" })
end
end
@@ -33,18 +32,18 @@ if defined? ::Punycode then
describe Atig::OFilter::EscapeUrl,"when punycode is enabled" do
before do
@logger = double('Logger')
- @logger.should_receive(:info).at_most(:once)
- @logger.should_receive(:error).at_most(:once)
- @logger.should_receive(:debug).at_most(:once)
+ expect(@logger).to receive(:info).at_most(:once)
+ expect(@logger).to receive(:error).at_most(:once)
+ expect(@logger).to receive(:debug).at_most(:once)
end
def filtered(text,opt={})
- esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(:log=>@logger,:opts=>nil))
- esc.call :status => text
+ esc = Atig::OFilter::EscapeUrl.new(OpenStruct.new(log:@logger,:opts=>nil))
+ esc.call status: text
end
it "escape international URL" do
- filtered("http://あああ.com").should == {:status => "http://xn--l8jaa.com" }
+ expect(filtered("http://あああ.com")).to eq({status: "http://xn--l8jaa.com" })
end
end
end
diff --git a/spec/ofilter/footer_spec.rb b/spec/ofilter/footer_spec.rb
index 9e1e4b8..f0851af 100644
--- a/spec/ofilter/footer_spec.rb
+++ b/spec/ofilter/footer_spec.rb
@@ -1,32 +1,31 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ofilter/footer'
require 'ostruct'
describe Atig::OFilter::Footer do
before do
@opts = OpenStruct.new
- @filter = Atig::OFilter::Footer.new(OpenStruct.new(:opts=>@opts))
+ @filter = Atig::OFilter::Footer.new(OpenStruct.new(opts:@opts))
end
it "should pass through" do
- @filter.call(:status => 'hi').should == {
- :status => "hi"
- }
+ expect(@filter.call(status: 'hi')).to eq({
+ status: "hi"
+ })
end
it "should append footer" do
@opts.footer = '*tw*'
- @filter.call(:status => 'hi').should == {
- :status => "hi *tw*"
- }
+ expect(@filter.call(status: 'hi')).to eq({
+ status: "hi *tw*"
+ })
end
it "should not append footer" do
@opts.footer = false
- @filter.call(:status => 'hi').should == {
- :status => "hi"
- }
+ expect(@filter.call(status: 'hi')).to eq({
+ status: "hi"
+ })
end
end
diff --git a/spec/ofilter/geo_spec.rb b/spec/ofilter/geo_spec.rb
index 6463fc6..12e2c74 100644
--- a/spec/ofilter/geo_spec.rb
+++ b/spec/ofilter/geo_spec.rb
@@ -1,33 +1,32 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ofilter/geo'
require 'ostruct'
describe Atig::OFilter::Geo,"when disabled" do
def filtered(text,opt={})
- geo = Atig::OFilter::Geo.new(OpenStruct.new(:opts=>OpenStruct.new(opt)))
- geo.call :status => text
+ geo = Atig::OFilter::Geo.new(OpenStruct.new(opts:OpenStruct.new(opt)))
+ geo.call status: text
end
it "should through" do
- filtered("hi").should == {
- :status => "hi"
- }
+ expect(filtered("hi")).to eq({
+ status: "hi"
+ })
end
end
describe Atig::OFilter::Geo,"when enabled" do
def filtered(text,opt={})
- geo = Atig::OFilter::Geo.new(OpenStruct.new(:opts=>OpenStruct.new(opt)))
- geo.call :status => text
+ geo = Atig::OFilter::Geo.new(OpenStruct.new(opts:OpenStruct.new(opt)))
+ geo.call status: text
end
it "add lat & long" do
- filtered("hi",:ll=>"42.1,43.1").should == {
- :status => "hi",
- :lat => 42.1,
- :long => 43.1
- }
+ expect(filtered("hi",:ll=>"42.1,43.1")).to eq({
+ status: "hi",
+ lat: 42.1,
+ long: 43.1
+ })
end
end
diff --git a/spec/ofilter/short_url_spec.rb b/spec/ofilter/short_url_spec.rb
index bfafdee..a9aa9bd 100644
--- a/spec/ofilter/short_url_spec.rb
+++ b/spec/ofilter/short_url_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../../spec_helper', __FILE__ )
require 'atig/ofilter/short_url'
require 'ostruct'
@@ -8,17 +7,17 @@ describe Atig::OFilter::ShortUrl,"when no-login bitly" do
before do
logger = double('Logger')
bitly = double("Bitly")
- bitly.stub(:shorten).and_return{|s|
+ allow(bitly).to receive(:shorten){|s|
"[#{s}]"
}
- Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>true)))
+ expect(Atig::Bitly).to receive(:no_login).with(logger).and_return(bitly)
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>true)))
end
it "should shorten url by bitly" do
- @ofilter.call({:status => "this is http://example.com/a http://example.com/b"}).should == {
- :status => "this is [http://example.com/a] [http://example.com/b]"
- }
+ expect(@ofilter.call({status: "this is http://example.com/a http://example.com/b"})).to eq({
+ status: "this is [http://example.com/a] [http://example.com/b]"
+ })
end
end
@@ -26,17 +25,17 @@ describe Atig::OFilter::ShortUrl,"when no-login bitly with size" do
before do
logger = double('Logger')
bitly = double("Bitly")
- bitly.stub(:shorten).and_return{|s|
+ allow(bitly).to receive(:shorten){|s|
"[#{s}]"
}
- Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>13)))
+ expect(Atig::Bitly).to receive(:no_login).with(logger).and_return(bitly)
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>13)))
end
it "should only shorten large url" do
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
- :status => "this is [http://example.com/a] http://a.com"
- }
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
+ status: "this is [http://example.com/a] http://a.com"
+ })
end
end
@@ -44,17 +43,17 @@ describe Atig::OFilter::ShortUrl,"when login bitly" do
before do
logger = double('Logger')
bitly = double("Bitly")
- bitly.stub(:shorten).and_return{|s|
+ allow(bitly).to receive(:shorten){|s|
"[#{s}]"
}
- Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>'username:api_key')))
+ expect(Atig::Bitly).to receive(:login).with(logger,"username","api_key").and_return(bitly)
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>'username:api_key')))
end
it "should only shorten large url" do
- @ofilter.call({:status => "this is http://example.com/a http://example.com/b"}).should == {
- :status => "this is [http://example.com/a] [http://example.com/b]"
- }
+ expect(@ofilter.call({status: "this is http://example.com/a http://example.com/b"})).to eq({
+ status: "this is [http://example.com/a] [http://example.com/b]"
+ })
end
end
@@ -62,17 +61,17 @@ describe Atig::OFilter::ShortUrl,"when login bitly with size" do
before do
logger = double('Logger')
bitly = double("Bitly")
- bitly.stub(:shorten).and_return{|s|
+ allow(bitly).to receive(:shorten){|s|
"[#{s}]"
}
- Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new('bitlify'=>'username:api_key:13')))
+ expect(Atig::Bitly).to receive(:login).with(logger,"username","api_key").and_return(bitly)
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new('bitlify'=>'username:api_key:13')))
end
it "should only shorten large url" do
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
- :status => "this is [http://example.com/a] http://a.com"
- }
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
+ status: "this is [http://example.com/a] http://a.com"
+ })
end
end
@@ -80,12 +79,12 @@ describe Atig::OFilter::ShortUrl,"when nop" do
before do
logger = double('Logger')
- @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new()))
+ @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(log:logger, opts:OpenStruct.new()))
end
it "should only not do anything" do
- @ofilter.call({:status => "this is http://example.com/a http://a.com"}).should == {
- :status => "this is http://example.com/a http://a.com"
- }
+ expect(@ofilter.call({status: "this is http://example.com/a http://a.com"})).to eq({
+ status: "this is http://example.com/a http://a.com"
+ })
end
end
diff --git a/spec/option_spec.rb b/spec/option_spec.rb
index 1604f24..8295b46 100644
--- a/spec/option_spec.rb
+++ b/spec/option_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../spec_helper', __FILE__ )
require 'atig/option'
describe Atig::Option do
@@ -9,74 +8,74 @@ describe Atig::Option do
end
it "should have bool property" do
- @opt.a.should be_true
+ expect(@opt.a).to be_truthy
end
it "should have int property" do
- @opt.b.should == 1
+ expect(@opt.b).to eq(1)
end
it "should have float property" do
- @opt.c.should == 1.2
+ expect(@opt.c).to eq(1.2)
end
it "should have string property" do
- @opt.d.should == 'foo'
+ expect(@opt.d).to eq('foo')
end
it "should not have other property" do
- @opt.e.should == nil
+ expect(@opt.e).to eq(nil)
end
it "should update the value" do
@opt.a = false
- @opt.a.should be_false
+ expect(@opt.a).to be_falsey
end
it "should be accessed by [name]" do
- @opt[:a].should be_true
- @opt['a'].should be_true
+ expect(@opt[:a]).to be_truthy
+ expect(@opt['a']).to be_truthy
end
it "should be updated by [name]=" do
@opt[:a] = false
- @opt.a.should be_false
- @opt[:a].should be_false
- @opt['a'].should be_false
+ expect(@opt.a).to be_falsey
+ expect(@opt[:a]).to be_falsey
+ expect(@opt['a']).to be_falsey
end
it "should be updated by [name]=" do
@opt['a'] = false
- @opt.a.should be_false
- @opt[:a].should be_false
- @opt['a'].should be_false
+ expect(@opt.a).to be_falsey
+ expect(@opt[:a]).to be_falsey
+ expect(@opt['a']).to be_falsey
end
it "should be created by [name]=" do
@opt['e'] = false
- @opt.e.should be_false
- @opt[:e].should be_false
- @opt['e'].should be_false
+ expect(@opt.e).to be_falsey
+ expect(@opt[:e]).to be_falsey
+ expect(@opt['e']).to be_falsey
end
it "should be access to id" do
- @opt.id.should be_nil
+ expect(@opt.id).to be_nil
@opt.id = 1
- @opt.id.should == 1
+ expect(@opt.id).to eq(1)
end
it "should have default value" do
- @opt.api_base.should == 'https://api.twitter.com/1.1/'
+ expect(@opt.api_base).to eq('https://api.twitter.com/1.1/')
end
it "should list up all fields" do
- @opt.fields.map{|x| x.to_s }.sort.should == %w(api_base stream_api_base search_api_base a b c d).sort
+ expect(@opt.fields.map{|x| x.to_s }.sort).to eq(%w(api_base stream_api_base search_api_base a b c d).sort)
@opt.e = 1
- @opt.fields.map{|x| x.to_s }.sort.should == %w(api_base search_api_base stream_api_base a b c d e).sort
+ expect(@opt.fields.map{|x| x.to_s }.sort).to eq(%w(api_base search_api_base stream_api_base a b c d e).sort)
end
end
@@ -86,6 +85,6 @@ describe Atig::Option,'with not default value' do
end
it "should be specified value" do
- @opt.api_base.should == 'twitter.com'
+ expect(@opt.api_base).to eq('twitter.com')
end
end
diff --git a/spec/sized_hash_spec.rb b/spec/sized_hash_spec.rb
index 17cc57e..3eed783 100644
--- a/spec/sized_hash_spec.rb
+++ b/spec/sized_hash_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../spec_helper', __FILE__ )
require 'atig/sized_hash'
describe Atig::SizedHash do
@@ -10,7 +9,7 @@ describe Atig::SizedHash do
it "はkeyとvalueでアクセスできる" do
@hash[:foo] = :bar
- @hash[:foo].should == :bar
+ expect(@hash[:foo]).to eq(:bar)
end
it "はサイズが取得できる" do
@@ -29,17 +28,17 @@ describe Atig::SizedHash do
it "は古いのが消える" do
('a'..'c').each{|c| @hash[c] = 42 }
- @hash.key?('a').should be_true
+ expect(@hash.key?('a')).to be_truthy
@hash['d'] = 42
- @hash.key?('a').should be_false
+ expect(@hash.key?('a')).to be_falsey
end
it "は使うたびに寿命が伸びる" do
('a'..'c').each{|c| @hash[c] = 42 }
@hash['a']
@hash['d'] = 42
- @hash.key?('a').should be_true
- @hash.key?('b').should be_false
+ expect(@hash.key?('a')).to be_truthy
+ expect(@hash.key?('b')).to be_falsey
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cb0adc7..39a4f10 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,9 +3,11 @@ require 'bundler/setup'
require 'atig/monkey'
require 'command_helper'
+ENV['TZ'] = 'UTC'
+
RSpec::Matchers.define :be_text do |text|
match do |status|
- status.text.should == text
+ expect(status.text).to eq(text)
end
end
@@ -15,16 +17,16 @@ end
def user(id, name)
user = double("User-#{name}")
- user.stub(:id).and_return(id)
- user.stub(:screen_name).and_return(name)
+ allow(user).to receive(:id).and_return(id)
+ allow(user).to receive(:screen_name).and_return(name)
user
end
def entry(user, status, name = 'entry', id = 0)
entry = double name
- entry.stub('id').and_return(id)
- entry.stub('user').and_return(user)
- entry.stub('status').and_return(status)
+ allow(entry).to receive('id').and_return(id)
+ allow(entry).to receive('user').and_return(user)
+ allow(entry).to receive('status').and_return(status)
entry
end
diff --git a/spec/update_checker_spec.rb b/spec/update_checker_spec.rb
index 1ad54c9..bfe2e0c 100644
--- a/spec/update_checker_spec.rb
+++ b/spec/update_checker_spec.rb
@@ -1,6 +1,5 @@
# -*- mode:ruby; coding:utf-8 -*-
-require File.expand_path( '../spec_helper', __FILE__ )
require 'atig/update_checker'
describe Atig::UpdateChecker,'when use git version' do
@@ -13,8 +12,8 @@ describe Atig::UpdateChecker,'when use git version' do
end
before do
- Atig::UpdateChecker.stub(:git?).and_return(true)
- Atig::UpdateChecker.stub(:commits).
+ allow(Atig::UpdateChecker).to receive(:git?).and_return(true)
+ allow(Atig::UpdateChecker).to receive(:commits).
and_return [
commit('a', 'foo'),
commit('b', 'bar'),
@@ -25,31 +24,31 @@ describe Atig::UpdateChecker,'when use git version' do
end
it "should not do anything when use HEAD version" do
- Atig::UpdateChecker.stub(:local_repos?).and_return true
- Atig::UpdateChecker.stub(:server_version).and_return rev('a')
+ allow(Atig::UpdateChecker).to receive(:local_repos?).and_return true
+ allow(Atig::UpdateChecker).to receive(:server_version).and_return rev('a')
- Atig::UpdateChecker.latest.should == []
+ expect(Atig::UpdateChecker.latest).to eq([])
end
it "should notify when not use HEAD version" do
- Atig::UpdateChecker.stub(:local_repos?).and_return false
- Atig::UpdateChecker.stub(:server_version).and_return rev('b')
+ allow(Atig::UpdateChecker).to receive(:local_repos?).and_return false
+ allow(Atig::UpdateChecker).to receive(:server_version).and_return rev('b')
- Atig::UpdateChecker.latest.should == [ 'foo' ]
+ expect(Atig::UpdateChecker.latest).to eq([ 'foo' ])
end
it "should notify many changes" do
- Atig::UpdateChecker.stub(:local_repos?).and_return false
- Atig::UpdateChecker.stub(:server_version).and_return rev('d')
+ allow(Atig::UpdateChecker).to receive(:local_repos?).and_return false
+ allow(Atig::UpdateChecker).to receive(:server_version).and_return rev('d')
- Atig::UpdateChecker.latest.should == [ 'foo', 'bar', 'baz' ]
+ expect(Atig::UpdateChecker.latest).to eq([ 'foo', 'bar', 'baz' ])
end
it "should notify all changes" do
- Atig::UpdateChecker.stub(:local_repos?).and_return false
- Atig::UpdateChecker.stub(:server_version).and_return rev('z')
+ allow(Atig::UpdateChecker).to receive(:local_repos?).and_return false
+ allow(Atig::UpdateChecker).to receive(:server_version).and_return rev('z')
- Atig::UpdateChecker.latest.should == [ 'foo', 'bar', 'baz', 'xyzzy', 'fuga' ]
+ expect(Atig::UpdateChecker.latest).to eq([ 'foo', 'bar', 'baz', 'xyzzy', 'fuga' ])
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/atig.git
More information about the Pkg-ruby-extras-commits
mailing list