tins 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a50aca615e8441d3218a594675339c5f9f959ac3
4
- data.tar.gz: 7cd19f7ba00d883fa186d9fe579d9bcce1143de2
3
+ metadata.gz: 66237f324e3dec090fb0fe7cf5352ea4c33f6068
4
+ data.tar.gz: c2178480d9cbc13af1f7f21be6bdba36ca100c0c
5
5
  SHA512:
6
- metadata.gz: c6b1b385904afff0782b6cd98f48d75f898a34cc0535291427f1c5e6eedca01f8caf2e474eee39505162a4fb8c10ce901d67aaafa92725e600e92bbed626dd2e
7
- data.tar.gz: 18420ef7cb78ed2aa3a2901a44702fd68472e3fa6c0db0cbb42c8a6a396c21b51f157dd7cd73aaeae158f6df0f7c7ce67617036f757fb6ea2fd9adbe0e7be4b6
6
+ metadata.gz: 5ad455233919fc4a79c67e0a56fa7f809d872e2953653e1a0475cf502746e3a7d94f5dbbda3f647e418da884d554194ea66c20747698ba46f535af1f14677063
7
+ data.tar.gz: f26f33ebe4d32dbe1437b91753fe9980d56e52bb1064a650ce61f33bddcee4971e214b2fbc4afa61baa58addaf2eef2513dc2100d5188690c36847b81da0aac2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -11,6 +11,8 @@ module Tins
11
11
  def dummy=(value)
12
12
  if value.respond_to?(:to_str)
13
13
  value = Date.parse(value.to_str)
14
+ elsif value.respond_to?(:to_date)
15
+ value = value.to_date
14
16
  end
15
17
  @dummy = value
16
18
  end
@@ -11,6 +11,8 @@ module Tins
11
11
  def dummy=(value)
12
12
  if value.respond_to?(:to_str)
13
13
  value = DateTime.parse(value.to_str)
14
+ elsif value.respond_to?(:to_datetime)
15
+ value = value.to_datetime
14
16
  end
15
17
  @dummy = value
16
18
  end
@@ -13,6 +13,8 @@ module Tins
13
13
  def dummy=(value)
14
14
  if value.respond_to?(:to_str)
15
15
  value = Time.parse(value.to_str)
16
+ elsif value.respond_to?(:to_time)
17
+ value = value.to_time
16
18
  end
17
19
  @dummy = value
18
20
  end
data/lib/tins/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Tins
2
2
  # Tins version
3
- VERSION = '1.3.2'
3
+ VERSION = '1.3.3'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -4,11 +4,41 @@ require 'tins'
4
4
  module Tins
5
5
  class TimeFreezerTest < Test::Unit::TestCase
6
6
  def test_freezing
7
- freezing_point = '2011-11-11T11:11:11'
7
+ freezing_point = '2011-11-11T11:11:11Z'
8
8
  Tins::TimeFreezer.freeze(freezing_point) do
9
- assert_equal freezing_point, Time.now.strftime('%FT%T')
10
- assert_equal freezing_point, DateTime.now.strftime('%FT%T')
11
- assert_equal freezing_point[0, 10], Date.today.strftime('%F')
9
+ assert_equal "2011-11-11 11:11:11 UTC", Time.now.to_s
10
+ assert_equal "2011-11-11T11:11:11+00:00", DateTime.now.to_s
11
+ assert_equal "2011-11-11", Date.today.to_s
12
+ end
13
+ end
14
+
15
+ def test_to_time_conversion
16
+ freezing_point = '2011-11-11T11:11:11Z'
17
+ time = Time.parse(freezing_point)
18
+ Tins::TimeFreezer.freeze(time) do
19
+ assert_equal "2011-11-11 11:11:11 UTC", Time.now.utc.to_s
20
+ assert_equal "2011-11-11T11:11:11+00:00", DateTime.now.to_s
21
+ assert_equal "2011-11-11", Date.today.to_s
22
+ end
23
+ end
24
+
25
+ def test_to_date_conversion
26
+ freezing_point = '2011-11-11Z'
27
+ date = Date.parse(freezing_point)
28
+ Tins::TimeFreezer.freeze(date) do
29
+ assert_equal "2011-11", Time.now.utc.to_s[0, 7]
30
+ assert_equal "2011-11", DateTime.now.to_s[0, 7]
31
+ assert_equal "2011-11", Date.today.to_s[0, 7]
32
+ end
33
+ end
34
+
35
+ def test_to_datetime_conversion
36
+ freezing_point = '2011-11-11T11:11:11Z'
37
+ datetime = DateTime.parse(freezing_point)
38
+ Tins::TimeFreezer.freeze(datetime) do
39
+ assert_equal "2011-11-11 11:11:11 UTC", Time.now.utc.to_s
40
+ assert_equal "2011-11-11T11:11:11+00:00", DateTime.now.to_s
41
+ assert_equal "2011-11-11", Date.today.to_s
12
42
  end
13
43
  end
14
44
  end
data/tins.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: tins 1.3.2 ruby lib
2
+ # stub: tins 1.3.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "tins"
6
- s.version = "1.3.2"
6
+ s.version = "1.3.3"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Florian Frank"]
11
- s.date = "2014-08-19"
11
+ s.date = "2014-09-18"
12
12
  s.description = "All the stuff that isn't good/big enough for a real library."
13
13
  s.email = "flori@ping.de"
14
14
  s.extra_rdoc_files = ["README.md", "lib/dslkit.rb", "lib/dslkit/polite.rb", "lib/dslkit/rude.rb", "lib/spruz.rb", "lib/tins.rb", "lib/tins/alias.rb", "lib/tins/annotate.rb", "lib/tins/ask_and_send.rb", "lib/tins/attempt.rb", "lib/tins/bijection.rb", "lib/tins/case_predicate.rb", "lib/tins/concern.rb", "lib/tins/count_by.rb", "lib/tins/date_dummy.rb", "lib/tins/date_time_dummy.rb", "lib/tins/deep_const_get.rb", "lib/tins/deep_dup.rb", "lib/tins/dslkit.rb", "lib/tins/extract_last_argument_options.rb", "lib/tins/file_binary.rb", "lib/tins/find.rb", "lib/tins/generator.rb", "lib/tins/go.rb", "lib/tins/hash_symbolize_keys_recursive.rb", "lib/tins/hash_union.rb", "lib/tins/if_predicate.rb", "lib/tins/limited.rb", "lib/tins/lines_file.rb", "lib/tins/memoize.rb", "lib/tins/method_description.rb", "lib/tins/minimize.rb", "lib/tins/module_group.rb", "lib/tins/named_set.rb", "lib/tins/null.rb", "lib/tins/once.rb", "lib/tins/p.rb", "lib/tins/partial_application.rb", "lib/tins/proc_compose.rb", "lib/tins/proc_prelude.rb", "lib/tins/range_plus.rb", "lib/tins/require_maybe.rb", "lib/tins/responding.rb", "lib/tins/rotate.rb", "lib/tins/secure_write.rb", "lib/tins/sexy_singleton.rb", "lib/tins/shuffle.rb", "lib/tins/string_byte_order_mark.rb", "lib/tins/string_camelize.rb", "lib/tins/string_underscore.rb", "lib/tins/string_version.rb", "lib/tins/subhash.rb", "lib/tins/terminal.rb", "lib/tins/thread_local.rb", "lib/tins/time_dummy.rb", "lib/tins/to.rb", "lib/tins/to_proc.rb", "lib/tins/token.rb", "lib/tins/uniq_by.rb", "lib/tins/version.rb", "lib/tins/write.rb", "lib/tins/xt.rb", "lib/tins/xt/annotate.rb", "lib/tins/xt/ask_and_send.rb", "lib/tins/xt/attempt.rb", "lib/tins/xt/blank.rb", "lib/tins/xt/case_predicate.rb", "lib/tins/xt/concern.rb", "lib/tins/xt/count_by.rb", "lib/tins/xt/date_dummy.rb", "lib/tins/xt/date_time_dummy.rb", "lib/tins/xt/deep_const_get.rb", "lib/tins/xt/deep_dup.rb", "lib/tins/xt/dslkit.rb", "lib/tins/xt/extract_last_argument_options.rb", "lib/tins/xt/file_binary.rb", "lib/tins/xt/full.rb", "lib/tins/xt/hash_symbolize_keys_recursive.rb", "lib/tins/xt/hash_union.rb", "lib/tins/xt/if_predicate.rb", "lib/tins/xt/irb.rb", "lib/tins/xt/method_description.rb", "lib/tins/xt/named.rb", "lib/tins/xt/null.rb", "lib/tins/xt/p.rb", "lib/tins/xt/partial_application.rb", "lib/tins/xt/proc_compose.rb", "lib/tins/xt/proc_prelude.rb", "lib/tins/xt/range_plus.rb", "lib/tins/xt/require_maybe.rb", "lib/tins/xt/responding.rb", "lib/tins/xt/rotate.rb", "lib/tins/xt/secure_write.rb", "lib/tins/xt/sexy_singleton.rb", "lib/tins/xt/shuffle.rb", "lib/tins/xt/string.rb", "lib/tins/xt/string_byte_order_mark.rb", "lib/tins/xt/string_camelize.rb", "lib/tins/xt/string_underscore.rb", "lib/tins/xt/string_version.rb", "lib/tins/xt/subhash.rb", "lib/tins/xt/symbol_to_proc.rb", "lib/tins/xt/time_dummy.rb", "lib/tins/xt/time_freezer.rb", "lib/tins/xt/to.rb", "lib/tins/xt/uniq_by.rb", "lib/tins/xt/write.rb"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar