tweetwine 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/util_test.rb ADDED
@@ -0,0 +1,55 @@
1
+ require "test_helper"
2
+ require "time"
3
+
4
+ module Tweetwine
5
+
6
+ class UtilTest < Test::Unit::TestCase
7
+ should "humanize time difference" do
8
+ assert_equal [1, "sec"], Util.humanize_time_diff(Time.parse("2009-01-01 00:00:59").to_s, Time.parse("2009-01-01 00:01:00"))
9
+ assert_equal [0, "sec"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00:00").to_s, Time.parse("2009-01-01 01:00:00"))
10
+ assert_equal [1, "sec"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00:00").to_s, Time.parse("2009-01-01 01:00:01"))
11
+ assert_equal [59, "sec"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00:00").to_s, Time.parse("2009-01-01 01:00:59"))
12
+ assert_equal [59, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00").to_s, Time.parse("2009-01-01 01:59"))
13
+ assert_equal [59, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00:30").to_s, Time.parse("2009-01-01 01:59:00"))
14
+ assert_equal [57, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:01:00").to_s, Time.parse("2009-01-01 01:58:00"))
15
+ assert_equal [56, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:01:31").to_s, Time.parse("2009-01-01 01:58:00"))
16
+ assert_equal [57, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:01:00").to_s, Time.parse("2009-01-01 01:58:29"))
17
+ assert_equal [58, "min"], Util.humanize_time_diff(Time.parse("2009-01-01 01:01:00").to_s, Time.parse("2009-01-01 01:58:30"))
18
+ assert_equal [1, "hour"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00").to_s, Time.parse("2009-01-01 02:00"))
19
+ assert_equal [1, "hour"], Util.humanize_time_diff(Time.parse("2009-01-01 02:00").to_s, Time.parse("2009-01-01 01:00"))
20
+ assert_equal [2, "hours"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00").to_s, Time.parse("2009-01-01 03:00"))
21
+ assert_equal [1, "day"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00").to_s, Time.parse("2009-01-02 03:00"))
22
+ assert_equal [2, "days"], Util.humanize_time_diff(Time.parse("2009-01-01 01:00").to_s, Time.parse("2009-01-03 03:00"))
23
+ end
24
+
25
+ should "symbolize hash keys" do
26
+ given = {
27
+ "alpha" => "A",
28
+ :beta => "B",
29
+ "charlie" => "C",
30
+ "delta" => {
31
+ "echelon" => "E",
32
+ "fox" => "F"
33
+ }
34
+ }
35
+ expected = {
36
+ :alpha => "A",
37
+ :beta => "B",
38
+ :charlie => "C",
39
+ :delta => {
40
+ :echelon => "E",
41
+ :fox => "F"
42
+ }
43
+ }
44
+ assert_equal expected, Util.symbolize_hash_keys(given)
45
+ end
46
+
47
+ should "parse integers from strings, with minimum and default values, and naming parameter" do
48
+ assert_equal 6, Util.parse_int_gt("6", 8, 4, "ethical working hours per day")
49
+ assert_equal 8, Util.parse_int_gt(nil, 8, 4, "ethical working hours per day")
50
+ assert_equal 8, Util.parse_int_gt(false, 8, 4, "ethical working hours per day")
51
+ assert_raise(ArgumentError) { Util.parse_int_gt(3, 8, 4, "ethical working hours per day") }
52
+ end
53
+ end
54
+
55
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tweetwine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
+ platform: ruby
6
+ authors:
7
+ - Tuomas Kareinen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-12 00:00:00 +03:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rest-client
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ version:
25
+ description: A simple but tasty Twitter agent for command line use, made for fun.
26
+ email: tkareine@gmail.com
27
+ executables:
28
+ - tweetwine
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - MIT-LICENSE.txt
33
+ - CHANGELOG.rdoc
34
+ - README.rdoc
35
+ files:
36
+ - Rakefile
37
+ - MIT-LICENSE.txt
38
+ - CHANGELOG.rdoc
39
+ - README.rdoc
40
+ - bin/tweetwine
41
+ - lib/tweetwine
42
+ - lib/tweetwine/client.rb
43
+ - lib/tweetwine/io.rb
44
+ - lib/tweetwine/meta.rb
45
+ - lib/tweetwine/options.rb
46
+ - lib/tweetwine/rest_client_wrapper.rb
47
+ - lib/tweetwine/startup_config.rb
48
+ - lib/tweetwine/url_shortener.rb
49
+ - lib/tweetwine/util.rb
50
+ - lib/tweetwine.rb
51
+ - test/client_test.rb
52
+ - test/io_test.rb
53
+ - test/options_test.rb
54
+ - test/rest_client_wrapper_test.rb
55
+ - test/startup_config_test.rb
56
+ - test/test_config.yaml
57
+ - test/test_helper.rb
58
+ - test/url_shortener_test.rb
59
+ - test/util_test.rb
60
+ has_rdoc: true
61
+ homepage: http://github.com/tuomas/tweetwine
62
+ post_install_message:
63
+ rdoc_options:
64
+ - --title
65
+ - tweetwine 0.2.4
66
+ - --main
67
+ - README.rdoc
68
+ - --exclude
69
+ - test
70
+ - --line-numbers
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.3.1
89
+ signing_key:
90
+ specification_version: 2
91
+ summary: A simple Twitter agent for command line use
92
+ test_files: []
93
+