sg_common 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aeef25cfce91608c73e306a03296636decf075ec
4
+ data.tar.gz: fd74b35d1b4cf7d1c4cd2dc009f73dcce6f3f0be
5
+ SHA512:
6
+ metadata.gz: 9a7db7343b09d149e99bbd7ee7eb801cea6090c3da9d5b286292ca5f7b5686d92bcd776baccf232cb141c1c1b9a204e33f2b2178dde7bf10ba7101717996b7d7
7
+ data.tar.gz: e80832378056910eeb9d997b4c9b67bea1932fbd923dc0a2d85cab141e9454dd51ba39e915c497222df41be6faa57fbf9b5392dd937733a98c78b4387338a7f4
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ AllCops:
2
+ Include:
3
+ - Rakefile
4
+ - config.ru
5
+ Exclude:
6
+ - db/**/*
7
+ - config/**/*
8
+ - script/**/*
9
+
10
+ RedundantSelf:
11
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ sg_common
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sg_common.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,30 @@
1
+ # More info at https://github.com/guard/guard#readme
2
+
3
+ # This group allows to skip running RuboCop if RSpec.
4
+ group :red_green_refactor, halt_on_fail: true do
5
+ guard :rspec do
6
+ watch(%r{^spec/.+_spec\.rb$})
7
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
8
+ watch('spec/spec_helper.rb') { "spec" }
9
+
10
+ # Rails example
11
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
12
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
13
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
14
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
15
+ watch('config/routes.rb') { "spec/routing" }
16
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
17
+
18
+ # Capybara features specs
19
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
20
+
21
+ # Turnip features and steps
22
+ watch(%r{^spec/acceptance/(.+)\.feature$})
23
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
24
+ end
25
+
26
+ guard :rubocop, all_on_start: false, cli: %w(--format fuubar --rails) do
27
+ watch(%r{.+\.rb$})
28
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
29
+ end
30
+ end
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ [![Build Status](http://jenkins.talkwit.tv/buildStatus/icon?job=(master) sg_common)](http://jenkins.talkwit.tv/job/(master) sg_common)
2
+ [![Build Status](http://jenkins.talkwit.tv/buildStatus/icon?job=(develop) sg_common)](http://jenkins.talkwit.tv/job/(develop) sg_common)
3
+
4
+ # SgCommon
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'sg_common'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install sg_common
19
+
20
+ ## Usage
21
+
22
+ Specify Rails version with environmental variable when developing this gem:
23
+
24
+ $ export RAILS_VERSION=2
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it ( http://github.com/<my-github-username>/sg_common/fork )
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ require 'u2i/ci_utils/rake_tasks/all'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
data/lib/sg_common.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'sg_common/version'
2
+ require 'sg_common/core_ext/date/sg_date'
3
+ require 'sg_common/core_ext/time/sg_time'
4
+ require 'sg_common/core_ext/active_support/time_with_zone/sg_time_with_zone'
@@ -0,0 +1,12 @@
1
+ require 'sg_common/core_ext/support'
2
+
3
+ module ActiveSupport
4
+ class TimeWithZone
5
+ delegate :sg_day, :to => :utc
6
+ delegate :dt, :to => :utc
7
+ delegate :dth, :to => :utc
8
+ delegate :utc_time_offset, :to => :utc
9
+ delegate :beginning_of_sg_day, :to => :utc
10
+ delegate :end_of_sg_day, :to => :utc
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+ require 'tzinfo'
2
+ require 'sg_common/core_ext/support'
3
+
4
+ # This class contains Date extensions used by SG
5
+ class Date
6
+ SG_TIME_OFFSET = 5 # SG date start at 5am ET
7
+
8
+ def utc_time_offset(time_zone)
9
+ (self.beginning_of_sg_day(time_zone) - self.to_time(:utc).midnight) / 3600
10
+ end
11
+
12
+ def beginning_of_sg_day(time_zone)
13
+ timezone = TZInfo::Timezone.get(time_zone)
14
+
15
+ timezone.local_to_utc(Time.local(year, month, day, SG_TIME_OFFSET, 0, 0, 0))
16
+ end
17
+
18
+ def end_of_sg_day(time_zone)
19
+ (self + 1.day).beginning_of_sg_day(time_zone)
20
+ end
21
+
22
+ def hours_in_sg_day(time_zone)
23
+ ((end_of_sg_day(time_zone) - beginning_of_sg_day(time_zone)) / 1.hour).round
24
+ end
25
+
26
+ def dt
27
+ strftime('%Y%m%d')
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ require 'active_support/version'
2
+
3
+ # because of major changes in ActiveSupport structure
4
+ # the require is version dependent.
5
+ if ActiveSupport::VERSION::STRING < '3.0'
6
+ require 'active_support'
7
+ else
8
+ require 'active_support/time'
9
+ end
@@ -0,0 +1,50 @@
1
+ require 'sg_common/core_ext/support'
2
+
3
+ class Time
4
+ def sg_day(time_zone)
5
+ (self - (Date::SG_TIME_OFFSET.hours - self.in_time_zone(time_zone).utc_offset)).utc.to_date
6
+ end
7
+
8
+ def dt
9
+ strftime('%Y%m%d')
10
+ end
11
+
12
+ def dth
13
+ strftime('%Y%m%d%H')
14
+ end
15
+
16
+ def utc_time_offset(time_zone)
17
+ self.sg_day(time_zone).utc_time_offset(time_zone)
18
+ end
19
+
20
+ # Originally #beginning_of_sg_day was available only for Date objects.
21
+ # Due to common usage of Datetime for storing dates in the database,
22
+ # it was required to cast Time to Date before using #beginning_of_sg_day.
23
+ # For convenience #beginning_of_sg_day was added to Time as well.
24
+ #
25
+ # One **important caveat** is actual time of a day is ignored by this function
26
+ # and this function should be called only for days at midnight.
27
+ #
28
+ # @param time_zone a string, one of ActiveSupport::TimeZone::MAPPING
29
+ # @raise ArgumentError if Time is not at midnight
30
+ # @return beginning of SG day in UTC
31
+ # (e.g. 9/10 for US, 3/4 for italy depending on daylight saving)
32
+ def beginning_of_sg_day(time_zone)
33
+ if self.utc.seconds_since_midnight != 0
34
+ fail ArgumentError, "#beginning_of_sg_day can be used only for dates! (Time #{self} has to be at midnight)"
35
+ end
36
+ self.utc.to_date.beginning_of_sg_day(time_zone)
37
+ end
38
+
39
+ def end_of_sg_day(time_zone)
40
+ self.utc.to_date.end_of_sg_day(time_zone)
41
+ end
42
+
43
+ def self.current_sg_day(time_zone)
44
+ now.utc.sg_day(time_zone)
45
+ end
46
+
47
+ def self.next_sg_day(time_zone)
48
+ current_sg_day(time_zone) + 1.day
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module SgCommon
2
+ VERSION = '0.3.7'
3
+ end
data/sg_common.gemspec ADDED
@@ -0,0 +1,50 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sg_common/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'sg_common'
8
+ spec.version = SgCommon::VERSION
9
+ spec.authors = ['Michal Knapik', 'Tomasz Gurgul']
10
+ spec.email = ['michal.knapik@u2i.com']
11
+ spec.summary = %q{Common code shared between SocialGuide projects.}
12
+ spec.description = %q{.}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ rails_version = ENV['RAILS_VERSION'] || 'default'
22
+
23
+ if rails_version == 'default'
24
+ spec.add_dependency 'activesupport'
25
+ else
26
+ spec.add_dependency 'activesupport', "~> #{rails_version}"
27
+ end
28
+
29
+ spec.add_dependency 'tzinfo'
30
+
31
+ if rails_version != 'default' && rails_version < '3.0'
32
+ if RUBY_VERSION >= '2.0'
33
+ spec.add_dependency 'iconv'
34
+ end
35
+ end
36
+
37
+ spec.add_development_dependency 'guard'
38
+ spec.add_development_dependency 'guard-rspec'
39
+ spec.add_development_dependency 'guard-rubocop'
40
+
41
+ spec.add_development_dependency 'u2i-ci_utils', '~> 1.0.2'
42
+
43
+ spec.add_development_dependency 'bundler', '~> 1.5'
44
+ spec.add_development_dependency 'rake'
45
+ spec.add_development_dependency 'rspec', '< 3.0.0'
46
+ spec.add_development_dependency 'timecop'
47
+
48
+ spec.required_ruby_version = '>= 1.9.3'
49
+ spec.required_rubygems_version = '>= 1.8.25'
50
+ end
data/spec/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ LineLength:
2
+ Enabled: false
@@ -0,0 +1,224 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveSupport::TimeWithZone do
4
+ describe '#sg_day' do
5
+ context 'with US time zone' do
6
+ let(:time_zone) { 'America/New_York' }
7
+
8
+ it 'should return beginning_of_sg_day for standard daylight time (ET)' do
9
+
10
+ expect(Time.parse('2014-05-10 04:00 EDT').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
11
+ expect(Time.parse('2014-05-10 05:00 EDT').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
12
+ end
13
+
14
+ it 'should return beginning_of_sg_day for standard time (EST)' do
15
+ expect(Time.parse('2014-12-10 04:00 EST').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-12-09'))
16
+ expect(Time.parse('2014-12-10 05:00 EST').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-12-10'))
17
+ end
18
+
19
+ it 'should return proper sg_day for days where we switch time' do
20
+ expect(Time.parse('2014-03-08 09:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-07'))
21
+ expect(Time.parse('2014-03-08 10:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-08'))
22
+ expect(Time.parse('2014-03-09 09:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-09'))
23
+
24
+ expect(Time.parse('2014-11-01 08:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-10-31'))
25
+ expect(Time.parse('2014-11-01 09:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
26
+ expect(Time.parse('2014-11-01 10:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
27
+ expect(Time.parse('2014-11-02 09:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
28
+ expect(Time.parse('2014-11-02 10:00 UTC').in_time_zone('UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-02'))
29
+ end
30
+ end
31
+
32
+ context 'with IT time zone' do
33
+ let(:time_zone) { 'Europe/Rome' }
34
+
35
+ it 'should return beginning_of_sg_day for CET' do
36
+ expect(Time.parse('2014-01-10 04:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-01-09'))
37
+ expect(Time.parse('2014-01-10 05:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-01-10'))
38
+ end
39
+
40
+ it 'should return beginning_of_sg_day for CEST' do
41
+ expect(Time.parse('2014-05-10 04:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
42
+ expect(Time.parse('2014-05-10 05:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
43
+ end
44
+
45
+ it 'should return proper sg_day for days where we switch from winter to summer time' do
46
+ expect(Time.parse('2014-03-30 02:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
47
+ expect(Time.parse('2014-03-30 03:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
48
+ expect(Time.parse('2014-03-30 04:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
49
+ expect(Time.parse('2014-03-30 05:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-30'))
50
+ end
51
+
52
+ it 'should return proper sg_day for days where we switch from summer to winter time' do
53
+ expect(Time.parse('2014-10-26 02:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
54
+ expect(Time.parse('2014-10-26 02:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
55
+ expect(Time.parse('2014-10-26 03:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
56
+ expect(Time.parse('2014-10-26 04:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
57
+ expect(Time.parse('2014-10-26 05:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-26'))
58
+ end
59
+ end
60
+ end
61
+ describe '#sg_day' do
62
+ context 'with US time zone' do
63
+ let(:time_zone) { 'America/New_York' }
64
+
65
+ it 'should return beginning_of_sg_day for standard daylight time (ET)' do
66
+ expect(Time.parse('2014-05-10 04:00 EDT').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
67
+ expect(Time.parse('2014-05-10 05:00 EDT').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
68
+ end
69
+
70
+ it 'should return beginning_of_sg_day for standard time (EST)' do
71
+ expect(Time.parse('2014-12-10 04:00 EST').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-12-09'))
72
+ expect(Time.parse('2014-12-10 05:00 EST').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-12-10'))
73
+ end
74
+
75
+ it 'should return proper sg_day for days where we switch time' do
76
+ expect(Time.parse('2014-03-08 09:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-07'))
77
+ expect(Time.parse('2014-03-08 10:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-08'))
78
+ expect(Time.parse('2014-03-09 09:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-09'))
79
+
80
+ expect(Time.parse('2014-11-01 08:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-31'))
81
+ expect(Time.parse('2014-11-01 09:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
82
+ expect(Time.parse('2014-11-01 10:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
83
+ expect(Time.parse('2014-11-02 09:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
84
+ expect(Time.parse('2014-11-02 10:00 UTC').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-11-02'))
85
+ end
86
+ end
87
+
88
+ context 'with IT time zone' do
89
+ let(:time_zone) { 'Europe/Rome' }
90
+
91
+ it 'should return beginning_of_sg_day for CET' do
92
+ expect(Time.parse('2014-01-10 04:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-01-09'))
93
+ expect(Time.parse('2014-01-10 05:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-01-10'))
94
+ end
95
+
96
+ it 'should return beginning_of_sg_day for CEST' do
97
+ expect(Time.parse('2014-05-10 04:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
98
+ expect(Time.parse('2014-05-10 05:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
99
+ end
100
+
101
+ it 'should return proper sg_day for days where we switch from winter to summer time' do
102
+ expect(Time.parse('2014-03-30 02:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
103
+ expect(Time.parse('2014-03-30 03:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
104
+ expect(Time.parse('2014-03-30 04:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
105
+ expect(Time.parse('2014-03-30 05:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-03-30'))
106
+ end
107
+
108
+ it 'should return proper sg_day for days where we switch from summer to winter time' do
109
+ expect(Time.parse('2014-10-26 02:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
110
+ expect(Time.parse('2014-10-26 02:00 +0200').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
111
+ expect(Time.parse('2014-10-26 03:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
112
+ expect(Time.parse('2014-10-26 04:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
113
+ expect(Time.parse('2014-10-26 05:00 +0100').in_time_zone(time_zone).sg_day(time_zone)).to eq(Date.parse('2014-10-26'))
114
+ end
115
+ end
116
+ end
117
+
118
+ shared_examples_for 'utc_offset' do
119
+ it 'should get correct beginning of SG day for a time zone' do
120
+ expect(subject).to eq(expected_offset)
121
+ end
122
+ end
123
+
124
+ describe '#utc_time_offset' do
125
+ subject { time.utc_time_offset(time_zone) }
126
+
127
+ context 'when US time zone' do
128
+ let(:time_zone) { 'America/New_York' }
129
+
130
+ context 'when daylight time' do
131
+ it_should_behave_like 'utc_offset'
132
+ let(:time) { Time.parse('2014-06-10 00:00 UTC') }
133
+ let(:expected_offset) { 9 }
134
+ end
135
+
136
+ context 'when winter time' do
137
+ it_should_behave_like 'utc_offset'
138
+ let(:time) { Time.parse('2014-01-10 00:00 UTC') }
139
+ let(:expected_offset) { 10 }
140
+ end
141
+ end
142
+
143
+ context 'when IT time zone' do
144
+ let(:time_zone) { 'Europe/Rome' }
145
+
146
+ context 'when daylight time' do
147
+ it_should_behave_like 'utc_offset'
148
+ let(:time) { Time.parse('2014-06-10 00:00 UTC').in_time_zone(time_zone) }
149
+ let(:expected_offset) { 3 }
150
+ end
151
+
152
+ context 'when winter time' do
153
+ it_should_behave_like 'utc_offset'
154
+ let(:time) { Time.parse('2014-01-10 00:00 UTC').in_time_zone(time_zone) }
155
+ let(:expected_offset) { 4 }
156
+ end
157
+ end
158
+
159
+ context 'when AU time zone' do
160
+ let(:time_zone) { 'Australia/Sydney' }
161
+
162
+ context 'when daylight time' do
163
+ it_should_behave_like 'utc_offset'
164
+ let(:time) { Time.parse('2014-01-10 00:00 UTC').in_time_zone(time_zone) }
165
+ let(:expected_offset) { -6 }
166
+ end
167
+
168
+ context 'when winter time' do
169
+ it_should_behave_like 'utc_offset'
170
+ let(:time) { Time.parse('2014-06-10 00:00 UTC').in_time_zone(time_zone) }
171
+ let(:expected_offset) { -5 }
172
+ end
173
+ end
174
+ end
175
+
176
+ describe '#beginning_of_sg_day' do
177
+ let(:time_zone) { 'America/New_York' }
178
+
179
+ it 'should return sg offset for UTC' do
180
+ expect(Time.parse('2013-07-08 00:00 UTC').in_time_zone(time_zone).beginning_of_sg_day('UTC')).to eq(Time.parse('2013-07-08 5:00 UTC'))
181
+ end
182
+
183
+ it 'should return beginning_of_sg_day for standard time (ET)' do
184
+ expect(Time.parse('2014-03-08 00:00 UTC').in_time_zone(time_zone).beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-08 10:00 UTC'))
185
+ end
186
+
187
+ it 'should return beginning_of_sg_day for daylight saving time' do
188
+ expect(Time.parse('2014-03-09 00:00 UTC').in_time_zone(time_zone).beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
189
+ end
190
+
191
+ it 'should return beginning_of_sg_day for daylight saving time' do
192
+ expect(Time.parse('2014-11-01 00:00 UTC').in_time_zone(time_zone).beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-01 09:00 UTC'))
193
+ end
194
+
195
+ it 'should return beginning_of_sg_day for standard time (ET)' do
196
+ expect(Time.parse('2014-11-02 00:00 UTC').in_time_zone(time_zone).beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
197
+ end
198
+ end
199
+
200
+ describe '#end_of_sg_day' do
201
+ let(:time_zone) { 'America/New_York' }
202
+
203
+ it 'should return sg offset for UTC' do
204
+ expect(Time.parse('2013-07-08 00:00 UTC').in_time_zone(time_zone).end_of_sg_day('UTC')).to eq(Time.parse('2013-07-09 5:00 UTC'))
205
+ end
206
+
207
+ it 'should return end_of_sg_day for standard time (ET)' do
208
+ expect(Time.parse('2014-03-08 00:00 UTC').in_time_zone(time_zone).end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
209
+ end
210
+
211
+ it 'should return end_of_sg_day for daylight saving time' do
212
+ expect(Time.parse('2014-03-09 00:00 UTC').in_time_zone(time_zone).end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-10 09:00 UTC'))
213
+ end
214
+
215
+ it 'should return end_of_sg_day for daylight saving time' do
216
+ expect(Time.parse('2014-11-01 00:00 UTC').in_time_zone(time_zone).end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
217
+ end
218
+
219
+ it 'should return end_of_sg_day for standard time (ET)' do
220
+ expect(Time.parse('2014-11-02 00:00 UTC').in_time_zone(time_zone).end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-03 10:00 UTC'))
221
+ end
222
+ end
223
+
224
+ end
@@ -0,0 +1,107 @@
1
+ require 'spec_helper'
2
+
3
+ describe Date do
4
+ let(:time_zone) { 'America/New_York' }
5
+
6
+ shared_examples_for 'utc_offset' do
7
+ it 'should get correct beginning of SG day for a timezone' do
8
+ should == expected_offset
9
+ end
10
+ end
11
+
12
+ describe '#utc_time_offset' do
13
+ subject { time.utc_time_offset(time_zone) }
14
+
15
+ context 'when US timezone' do
16
+ let(:time_zone) { 'America/New_York' }
17
+
18
+ context 'when daylight time' do
19
+ it_should_behave_like 'utc_offset'
20
+ let(:time) { Date.parse('2014-06-10 00:00 UTC') }
21
+ let(:expected_offset) { 9 }
22
+ end
23
+
24
+ context 'when winter time' do
25
+ it_should_behave_like 'utc_offset'
26
+ let(:time) { Date.parse('2014-01-10 00:00 UTC') }
27
+ let(:expected_offset) { 10 }
28
+ end
29
+ end
30
+
31
+ context 'when IT timezone' do
32
+ let(:time_zone) { 'Europe/Rome' }
33
+
34
+ context 'when daylight time' do
35
+ it_should_behave_like 'utc_offset'
36
+ let(:time) { Date.parse('2014-06-10 00:00 UTC') }
37
+ let(:expected_offset) { 3 }
38
+ end
39
+
40
+ context 'when winter time' do
41
+ it_should_behave_like 'utc_offset'
42
+ let(:time) { Date.parse('2014-01-10 00:00 UTC') }
43
+ let(:expected_offset) { 4 }
44
+ end
45
+ end
46
+
47
+ context 'when AU timezone' do
48
+ let(:time_zone) { 'Australia/Sydney' }
49
+
50
+ context 'when daylight time' do
51
+ it_should_behave_like 'utc_offset'
52
+ let(:time) { Date.parse('2014-01-10 00:00 UTC') }
53
+ let(:expected_offset) { -6 }
54
+ end
55
+
56
+ context 'when winter time' do
57
+ it_should_behave_like 'utc_offset'
58
+ let(:time) { Date.parse('2014-06-10 00:00 UTC') }
59
+ let(:expected_offset) { -5 }
60
+ end
61
+ end
62
+ end
63
+
64
+ describe '#beginning_of_sg_day' do
65
+ it 'should return sg offset for UTC' do
66
+ expect(Date.parse('2013-07-08').beginning_of_sg_day('UTC')).to eq(Time.parse('2013-07-08 5:00 UTC'))
67
+ end
68
+
69
+ it 'should return beginning_of_sg_day for standard time (ET)' do
70
+ expect(Date.parse('2014-03-08').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-08 10:00 UTC'))
71
+ end
72
+
73
+ it 'should return beginning_of_sg_day for daylight saving time' do
74
+ expect(Date.parse('2014-03-09').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
75
+ end
76
+
77
+ it 'should return beginning_of_sg_day for daylight saving time' do
78
+ expect(Date.parse('2014-11-01').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-01 09:00 UTC'))
79
+ end
80
+
81
+ it 'should return beginning_of_sg_day for standard time (ET)' do
82
+ expect(Date.parse('2014-11-02').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
83
+ end
84
+ end
85
+
86
+ describe '#end_of_sg_day' do
87
+ it 'should return sg offset for UTC' do
88
+ expect(Date.parse('2013-07-08').end_of_sg_day('UTC')).to eq(Time.parse('2013-07-09 5:00 UTC'))
89
+ end
90
+
91
+ it 'should return end_of_sg_day for standard time (ET)' do
92
+ expect(Date.parse('2014-03-08').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
93
+ end
94
+
95
+ it 'should return end_of_sg_day for daylight saving time' do
96
+ expect(Date.parse('2014-03-09').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-10 09:00 UTC'))
97
+ end
98
+
99
+ it 'should return end_of_sg_day for daylight saving time' do
100
+ expect(Date.parse('2014-11-01').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
101
+ end
102
+
103
+ it 'should return end_of_sg_day for standard time (ET)' do
104
+ expect(Date.parse('2014-11-02').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-03 10:00 UTC'))
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe DateTime do
4
+ let(:time_zone) { 'America/New_York' }
5
+
6
+ describe '#beginning_of_sg_day' do
7
+ it 'should return sg offset for UTC' do
8
+ expect(DateTime.parse('2013-07-08').beginning_of_sg_day('UTC')).to eq(Time.parse('2013-07-08 5:00 UTC'))
9
+ end
10
+
11
+ it 'should return beginning_of_sg_day for standard time (ET)' do
12
+ expect(DateTime.parse('2014-03-08').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-08 10:00 UTC'))
13
+ end
14
+
15
+ it 'should return beginning_of_sg_day for daylight saving time' do
16
+ expect(DateTime.parse('2014-03-09').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
17
+ end
18
+
19
+ it 'should return beginning_of_sg_day for daylight saving time' do
20
+ expect(DateTime.parse('2014-11-01').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-01 09:00 UTC'))
21
+ end
22
+
23
+ it 'should return beginning_of_sg_day for standard time (ET)' do
24
+ expect(DateTime.parse('2014-11-02').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
25
+ end
26
+ end
27
+
28
+ describe '#end_of_sg_day' do
29
+ it 'should return sg offset for UTC' do
30
+ expect(DateTime.parse('2013-07-08').end_of_sg_day('UTC')).to eq(Time.parse('2013-07-09 5:00 UTC'))
31
+ end
32
+
33
+ it 'should return end_of_sg_day for standard time (ET)' do
34
+ expect(DateTime.parse('2014-03-08').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
35
+ end
36
+
37
+ it 'should return end_of_sg_day for daylight saving time' do
38
+ expect(DateTime.parse('2014-03-09').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-10 09:00 UTC'))
39
+ end
40
+
41
+ it 'should return end_of_sg_day for daylight saving time' do
42
+ expect(DateTime.parse('2014-11-01').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
43
+ end
44
+
45
+ it 'should return end_of_sg_day for standard time (ET)' do
46
+ expect(DateTime.parse('2014-11-02').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-03 10:00 UTC'))
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,231 @@
1
+ require 'spec_helper'
2
+ require 'timecop'
3
+
4
+ describe Time do
5
+ describe '#sg_day' do
6
+ context 'with US timezone' do
7
+ let(:time_zone) { 'America/New_York' }
8
+
9
+ it 'should return beginning_of_sg_day for standard daylight time (ET)' do
10
+ expect(Time.parse('2014-05-10 04:00 EDT').sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
11
+ expect(Time.parse('2014-05-10 05:00 EDT').sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
12
+ end
13
+
14
+ it 'should return beginning_of_sg_day for standard time (EST)' do
15
+ expect(Time.parse('2014-12-10 04:00 EST').sg_day(time_zone)).to eq(Date.parse('2014-12-09'))
16
+ expect(Time.parse('2014-12-10 05:00 EST').sg_day(time_zone)).to eq(Date.parse('2014-12-10'))
17
+ end
18
+
19
+ it 'should return proper sg_day for days where we switch time' do
20
+ expect(Time.parse('2014-03-08 09:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-07'))
21
+ expect(Time.parse('2014-03-08 10:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-08'))
22
+ expect(Time.parse('2014-03-09 09:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-03-09'))
23
+
24
+ expect(Time.parse('2014-11-01 08:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-10-31'))
25
+ expect(Time.parse('2014-11-01 09:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
26
+ expect(Time.parse('2014-11-01 10:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
27
+ expect(Time.parse('2014-11-02 09:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-01'))
28
+ expect(Time.parse('2014-11-02 10:00 UTC').sg_day(time_zone)).to eq(Date.parse('2014-11-02'))
29
+ end
30
+ end
31
+
32
+ context 'with IT timezone' do
33
+ let(:time_zone) { 'Europe/Rome' }
34
+
35
+ it 'should return beginning_of_sg_day for CET' do
36
+ expect(Time.parse('2014-01-10 04:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-01-09'))
37
+ expect(Time.parse('2014-01-10 05:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-01-10'))
38
+ end
39
+
40
+ it 'should return beginning_of_sg_day for CEST' do
41
+ expect(Time.parse('2014-05-10 04:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-05-09'))
42
+ expect(Time.parse('2014-05-10 05:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-05-10'))
43
+ end
44
+
45
+ it 'should return proper sg_day for days where we switch from winter to summer time' do
46
+ expect(Time.parse('2014-03-30 02:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
47
+ expect(Time.parse('2014-03-30 03:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
48
+ expect(Time.parse('2014-03-30 04:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-03-29'))
49
+ expect(Time.parse('2014-03-30 05:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-03-30'))
50
+ end
51
+
52
+ it 'should return proper sg_day for days where we switch from summer to winter time' do
53
+ expect(Time.parse('2014-10-26 02:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
54
+ expect(Time.parse('2014-10-26 02:00 +0200').sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
55
+ expect(Time.parse('2014-10-26 03:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
56
+ expect(Time.parse('2014-10-26 04:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-10-25'))
57
+ expect(Time.parse('2014-10-26 05:00 +0100').sg_day(time_zone)).to eq(Date.parse('2014-10-26'))
58
+ end
59
+ end
60
+ end
61
+
62
+ shared_examples_for 'utc_offset' do
63
+ it 'should get correct beginning of SG day for a timezone' do
64
+ should == expected_offset
65
+ end
66
+ end
67
+
68
+ describe '#utc_time_offset' do
69
+ subject { time.utc_time_offset(time_zone) }
70
+
71
+ context 'when US timezone' do
72
+ let(:time_zone) { 'America/New_York' }
73
+
74
+ context 'when daylight time' do
75
+ it_should_behave_like 'utc_offset'
76
+ let(:time) { Time.parse('2014-06-10 00:00 UTC') }
77
+ let(:expected_offset) { 9 }
78
+ end
79
+
80
+ context 'when winter time' do
81
+ it_should_behave_like 'utc_offset'
82
+ let(:time) { Time.parse('2014-01-10 00:00 UTC') }
83
+ let(:expected_offset) { 10 }
84
+ end
85
+ end
86
+
87
+ context 'when IT timezone' do
88
+ let(:time_zone) { 'Europe/Rome' }
89
+
90
+ context 'when daylight time' do
91
+ it_should_behave_like 'utc_offset'
92
+ let(:time) { Time.parse('2014-06-10 00:00 UTC') }
93
+ let(:expected_offset) { 3 }
94
+ end
95
+
96
+ context 'when winter time' do
97
+ it_should_behave_like 'utc_offset'
98
+ let(:time) { Time.parse('2014-01-10 00:00 UTC') }
99
+ let(:expected_offset) { 4 }
100
+ end
101
+ end
102
+
103
+ context 'when AU timezone' do
104
+ let(:time_zone) { 'Australia/Sydney' }
105
+
106
+ context 'when daylight time' do
107
+ it_should_behave_like 'utc_offset'
108
+ let(:time) { Time.parse('2014-01-10 00:00 UTC') }
109
+ let(:expected_offset) { -6 }
110
+ end
111
+
112
+ context 'when winter time' do
113
+ it_should_behave_like 'utc_offset'
114
+ let(:time) { Time.parse('2014-06-10 00:00 UTC') }
115
+ let(:expected_offset) { -5 }
116
+ end
117
+ end
118
+ end
119
+
120
+ describe '#beginning_of_sg_day' do
121
+ let(:time_zone) { 'America/New_York' }
122
+
123
+ it 'should raise error for non-midnight times' do
124
+ expect { Time.parse('2013-07-08 00:10 UTC').beginning_of_sg_day('UTC') }.to raise_error(ArgumentError)
125
+ expect { Time.parse('2013-07-08 00:00 +0200').beginning_of_sg_day('UTC') }.to raise_error(ArgumentError)
126
+ end
127
+
128
+ it 'should return sg offset for UTC' do
129
+ expect(Time.parse('2013-07-08 00:00 UTC').beginning_of_sg_day('UTC')).to eq(Time.parse('2013-07-08 5:00 UTC'))
130
+ end
131
+
132
+ it 'should return beginning_of_sg_day for standard time (ET)' do
133
+ expect(Time.parse('2014-03-08 00:00 UTC').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-08 10:00 UTC'))
134
+ end
135
+
136
+ it 'should return beginning_of_sg_day for daylight saving time' do
137
+ expect(Time.parse('2014-03-09 00:00 UTC').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
138
+ end
139
+
140
+ it 'should return beginning_of_sg_day for daylight saving time' do
141
+ expect(Time.parse('2014-11-01 00:00 UTC').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-01 09:00 UTC'))
142
+ end
143
+
144
+ it 'should return beginning_of_sg_day for standard time (ET)' do
145
+ expect(Time.parse('2014-11-02 00:00 UTC').beginning_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
146
+ end
147
+
148
+ it 'should throw error if time is not midnight' do
149
+ expect { Time.parse('2014-01-01 00:01 UTC').beginning_of_sg_day(time_zone) }.to raise_error(ArgumentError)
150
+ expect { Time.parse('2014-01-01 00:00 +0200').beginning_of_sg_day(time_zone) }.to raise_error(ArgumentError)
151
+ end
152
+ end
153
+
154
+ describe '#end_of_sg_day' do
155
+ let(:time_zone) { 'America/New_York' }
156
+
157
+ it 'should return sg offset for UTC' do
158
+ expect(Time.parse('2013-07-08 00:00 UTC').end_of_sg_day('UTC')).to eq(Time.parse('2013-07-09 5:00 UTC'))
159
+ end
160
+
161
+ it 'should return end_of_sg_day for standard time (ET)' do
162
+ expect(Time.parse('2014-03-08 00:00 UTC').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-09 09:00 UTC'))
163
+ end
164
+
165
+ it 'should return end_of_sg_day for daylight saving time' do
166
+ expect(Time.parse('2014-03-09 00:00 UTC').end_of_sg_day(time_zone)).to eq(Time.parse('2014-03-10 09:00 UTC'))
167
+ end
168
+
169
+ it 'should return end_of_sg_day for daylight saving time' do
170
+ expect(Time.parse('2014-11-01 00:00 UTC').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-02 10:00 UTC'))
171
+ end
172
+
173
+ it 'should return end_of_sg_day for standard time (ET)' do
174
+ expect(Time.parse('2014-11-02 00:00 UTC').end_of_sg_day(time_zone)).to eq(Time.parse('2014-11-03 10:00 UTC'))
175
+ end
176
+ end
177
+
178
+ describe '.current_sg_day' do
179
+ before { Timecop.freeze(Time.parse('2015-10-01 08:00 UTC')) }
180
+ after { Timecop.return }
181
+
182
+ subject { Time.current_sg_day(time_zone) }
183
+
184
+ context 'when in USA' do
185
+ let(:time_zone) { 'America/New_York' }
186
+ it { is_expected.to eq(Date.parse('2015-09-30 00:00 UTC')) }
187
+ end
188
+
189
+ context 'when in Mexico' do
190
+ let(:time_zone) { 'America/Mexico_City' }
191
+ it { is_expected.to eq(Date.parse('2015-09-30 00:00 UTC')) }
192
+ end
193
+
194
+ context 'when in Australia' do
195
+ let(:time_zone) { 'Australia/Sydney' }
196
+ it { is_expected.to eq(Date.parse('2015-10-01 00:00 UTC')) }
197
+ end
198
+
199
+ context 'when in Italy' do
200
+ let(:time_zone) { 'Europe/Rome' }
201
+ it { is_expected.to eq(Date.parse('2015-10-01 00:00 UTC')) }
202
+ end
203
+ end
204
+
205
+ describe '.next_sg_day' do
206
+ before { Timecop.freeze(Time.parse('2015-10-01 08:00 UTC')) }
207
+ after { Timecop.return }
208
+
209
+ subject { Time.next_sg_day(time_zone) }
210
+
211
+ context 'when in USA' do
212
+ let(:time_zone) { 'America/New_York' }
213
+ it { is_expected.to eq(Date.parse('2015-10-01 00:00 UTC')) }
214
+ end
215
+
216
+ context 'when in Mexico' do
217
+ let(:time_zone) { 'America/Mexico_City' }
218
+ it { is_expected.to eq(Date.parse('2015-10-01 00:00 UTC')) }
219
+ end
220
+
221
+ context 'when in Australia' do
222
+ let(:time_zone) { 'Australia/Sydney' }
223
+ it { is_expected.to eq(Date.parse('2015-10-02 00:00 UTC')) }
224
+ end
225
+
226
+ context 'when in Italy' do
227
+ let(:time_zone) { 'Europe/Rome' }
228
+ it { is_expected.to eq(Date.parse('2015-10-02 00:00 UTC')) }
229
+ end
230
+ end
231
+ end
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+
3
+ require 'u2i/ci_utils/coverage'
4
+
5
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
6
+ ENV['RAILS_ENV'] ||= 'test'
7
+ require 'rspec/autorun'
8
+ require 'sg_common'
9
+ require 'time'
10
+
11
+ # This code will be run each time you run your specs.
12
+ RSpec.configure do |config|
13
+ # == Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+ config.mock_with :rspec
21
+ end
metadata ADDED
@@ -0,0 +1,212 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sg_common
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.7
5
+ platform: ruby
6
+ authors:
7
+ - Michal Knapik
8
+ - Tomasz Gurgul
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-01-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: tzinfo
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: guard
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: guard-rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: guard-rubocop
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: u2i-ci_utils
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 1.0.2
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 1.0.2
98
+ - !ruby/object:Gem::Dependency
99
+ name: bundler
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '1.5'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.5'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rake
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "<"
131
+ - !ruby/object:Gem::Version
132
+ version: 3.0.0
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "<"
138
+ - !ruby/object:Gem::Version
139
+ version: 3.0.0
140
+ - !ruby/object:Gem::Dependency
141
+ name: timecop
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ description: "."
155
+ email:
156
+ - michal.knapik@u2i.com
157
+ executables: []
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".gitignore"
162
+ - ".rspec"
163
+ - ".rubocop.yml"
164
+ - ".ruby-gemset"
165
+ - Gemfile
166
+ - Guardfile
167
+ - README.md
168
+ - Rakefile
169
+ - lib/sg_common.rb
170
+ - lib/sg_common/core_ext/active_support/time_with_zone/sg_time_with_zone.rb
171
+ - lib/sg_common/core_ext/date/sg_date.rb
172
+ - lib/sg_common/core_ext/support.rb
173
+ - lib/sg_common/core_ext/time/sg_time.rb
174
+ - lib/sg_common/version.rb
175
+ - sg_common.gemspec
176
+ - spec/.rubocop.yml
177
+ - spec/sg_common/core_ext/active_support/time_with_zone/sg_time_with_zone_spec.rb
178
+ - spec/sg_common/core_ext/date/sg_date_spec.rb
179
+ - spec/sg_common/core_ext/date/sg_datetime_spec.rb
180
+ - spec/sg_common/core_ext/time/sg_time_spec.rb
181
+ - spec/spec_helper.rb
182
+ homepage: ''
183
+ licenses:
184
+ - MIT
185
+ metadata: {}
186
+ post_install_message:
187
+ rdoc_options: []
188
+ require_paths:
189
+ - lib
190
+ required_ruby_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 1.9.3
195
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: 1.8.25
200
+ requirements: []
201
+ rubyforge_project:
202
+ rubygems_version: 2.4.8
203
+ signing_key:
204
+ specification_version: 4
205
+ summary: Common code shared between SocialGuide projects.
206
+ test_files:
207
+ - spec/.rubocop.yml
208
+ - spec/sg_common/core_ext/active_support/time_with_zone/sg_time_with_zone_spec.rb
209
+ - spec/sg_common/core_ext/date/sg_date_spec.rb
210
+ - spec/sg_common/core_ext/date/sg_datetime_spec.rb
211
+ - spec/sg_common/core_ext/time/sg_time_spec.rb
212
+ - spec/spec_helper.rb