zonebie 0.5.1 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25214efeb680319146aaa1457cd05e7430ed3421
4
- data.tar.gz: cb86153d6b2c8e15d1dcf238681feb847b2cd78d
3
+ metadata.gz: 9ac61eaa2de78b672edd604210408215be46a490
4
+ data.tar.gz: ff3af6b4e27c25a521b466a2d3aa6c454ce1aa87
5
5
  SHA512:
6
- metadata.gz: 7c8118532fbd513e53c3089f49b3fa00839d1d044a453ff1fbde4f3a262c3bb6dcc5654a22059111de1758b7e29e5582096cccf6d7a81e58dd0ebc80486462d8
7
- data.tar.gz: 1b460efd89e9cf2f81de59600ed3c2d91aaef986b56438c302afd9999fbc1ca3811c2d00f836048f883e8ae75b2c4468ee0c78a038ebf7a8d39c96427dcd9f70
6
+ metadata.gz: d0e8dce6f7e8c5f7a3b1f804010d64c8d41d460ba05140c54211fe6e796b533da28a7bcc6c8da92b7fb010db8a6ad9b5c251b379f399678e8f1c4248d91c96b7
7
+ data.tar.gz: 9e444956b30c04f538713c8c14f732b6fab1fb63ddfd6eff68dee24a21fe987d5b04e9cac7437aae334e00558e6c7cbf8aa4638874542cf46b18fbefb3041a53
data/.travis.yml CHANGED
@@ -1,13 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
6
3
  - 2.0.0
7
- - jruby-18mode
4
+ - 2.1.8
5
+ - 2.2.4
6
+ - 2.3.0
8
7
  - jruby-19mode
9
- - rbx-18mode
10
- - rbx-19mode
11
- branches:
12
- only:
13
- - master
8
+ - rbx-2
data/Changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.6.0 (13 March 2016)
2
+
3
+ * Refactorings (Yuki Matsukura)
4
+ * Drops support for end-of-lifed Ruby versions 1.8.7 and 1.9.x
5
+
1
6
  ## 0.5.1 (17 August 2013)
2
7
 
3
8
  * Includes license information in gemspec. (Andy Lindeman)
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in zonebie.gemspec
4
4
  gemspec
5
+
6
+ platforms :rbx do
7
+ gem 'rubysl', '~> 2.0'
8
+ gem 'rubinius-developer_tools'
9
+ end
data/README.md CHANGED
@@ -11,16 +11,16 @@ debug (more information below).
11
11
 
12
12
  ## Requirements
13
13
 
14
- * MRI (1.8.7, 1.9.2, 1.9.3, 2.0.0)
15
- * JRuby (1.6, 1.7)
16
- * Rubinius (1.2, 2.0)
14
+ * MRI (2.0.x, 2.1.x, 2.2.x, 2.3.x)
15
+ * JRuby (1.7)
16
+ * Rubinius (2.0)
17
17
 
18
18
  ***
19
19
 
20
20
  And **either** of these gems which adds timezone support to Ruby:
21
21
 
22
- * `activesupport` >= 2.3 (Rails 2.3, 3.0, 3.1, 3.2, 4.0)
23
- * `tzinfo` >= 0.3
22
+ * `activesupport` >= 3.0 (Rails 3.0, 3.1, 3.2, 4.0, 4.1, 4.2)
23
+ * `tzinfo` >= 1.2
24
24
 
25
25
  ## Installation
26
26
 
@@ -30,13 +30,13 @@ If using Bundler (recommended), add to Gemfile:
30
30
  gem 'zonebie'
31
31
  ````
32
32
 
33
- ## Usage with Rails & ActiveSupport
33
+ ## Usage with Rails & Active Support
34
34
 
35
- ActiveSupport allows setting a global timezone that will be used for many date
35
+ Active Support allows setting a global timezone that will be used for many date
36
36
  and time calculations throughout the application.
37
37
 
38
38
  Zonebie can set this to a random timezone at the beginning of test runs.
39
- Specifically for ActiveSupport, it sets `Time.zone`.
39
+ Specifically for Active Support, it sets `Time.zone`.
40
40
 
41
41
  ### Test::Unit & Minitest
42
42
 
@@ -51,7 +51,7 @@ Zonebie.set_random_timezone
51
51
  Add to `spec/spec_helper.rb`:
52
52
 
53
53
  ```ruby
54
- Zonebie.set_random_timezone
54
+ require "zonebie/rspec"
55
55
  ```
56
56
 
57
57
  ### Cucumber
@@ -64,10 +64,10 @@ Zonebie.set_random_timezone
64
64
 
65
65
  ## Usage with TZInfo
66
66
 
67
- Zonebie can use the `tzinfo` gem, allowing it to work outside of ActiveSupport
67
+ Zonebie can use the `tzinfo` gem, allowing it to work outside of Active Support
68
68
  (Rails).
69
69
 
70
- However, `Zonebie.set_random_timezone` does not work outside of ActiveSupport
70
+ However, `Zonebie.set_random_timezone` does not work outside of Active Support
71
71
  because there is not a concept of a global timezone setting. If you simply need
72
72
  a random timezone for some other part of your tests, Zonebie can help.
73
73
 
@@ -75,7 +75,7 @@ a random timezone for some other part of your tests, Zonebie can help.
75
75
  zone = TZInfo::Timezone.get(Zonebie.random_timezone)
76
76
  puts zone.now
77
77
 
78
- # Also works in Rails/ActiveSupport
78
+ # Also works in Rails/Active Support
79
79
  zone = ActiveSupport::TimeZone[Zonebie.random_timezone]
80
80
  puts zone.now
81
81
  ```
data/lib/zonebie.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path("zonebie/version", File.dirname(__FILE__))
1
+ require File.expand_path('zonebie/version', File.dirname(__FILE__))
2
2
 
3
3
  module Zonebie
4
4
  class << self
@@ -6,26 +6,28 @@ module Zonebie
6
6
 
7
7
  def backend
8
8
  unless @backend
9
- @backend = if @backends[:activesupport].usable?
10
- @backends[:activesupport]
11
- else
12
- @backends.values.detect(&:usable?)
13
- end
9
+ @backend = \
10
+ if @backends[:activesupport].usable?
11
+ @backends[:activesupport]
12
+ else
13
+ @backends.values.detect(&:usable?)
14
+ end
14
15
  end
15
16
 
16
17
  @backend
17
18
  end
18
19
 
19
20
  def backend=(backend)
20
- case backend
21
- when Symbol
22
- @backend = @backends[backend]
23
- else
24
- @backend = backend
25
- end
21
+ @backend = \
22
+ case backend
23
+ when Symbol
24
+ @backends[backend]
25
+ else
26
+ backend
27
+ end
26
28
 
27
29
  if !backend.nil? && @backend.nil?
28
- raise ArgumentError, "Unsupported backend: #{backend}"
30
+ fail ArgumentError, "Unsupported backend: #{backend}"
29
31
  end
30
32
 
31
33
  @backend
@@ -37,17 +39,12 @@ module Zonebie
37
39
  end
38
40
 
39
41
  def set_random_timezone
40
- zone = ENV['ZONEBIE_TZ'] || random_timezone
42
+ zone = ENV['ZONEBIE_TZ'] || backend.zones.sample
41
43
 
42
44
  $stdout.puts("[Zonebie] Setting timezone: ZONEBIE_TZ=\"#{zone}\"") unless quiet
43
45
  backend.zone = zone
44
46
  end
45
-
46
- def random_timezone
47
- zones = backend.zones
48
- zones[rand(zones.length)]
49
- end
50
47
  end
51
48
  end
52
49
 
53
- require File.expand_path("zonebie/backends", File.dirname(__FILE__))
50
+ require File.expand_path('zonebie/backends', File.dirname(__FILE__))
@@ -1,2 +1,2 @@
1
- require File.expand_path("backends/active_support", File.dirname(__FILE__))
2
- require File.expand_path("backends/tzinfo", File.dirname(__FILE__))
1
+ require File.expand_path('backends/active_support', File.dirname(__FILE__))
2
+ require File.expand_path('backends/tzinfo', File.dirname(__FILE__))
data/lib/zonebie/rspec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path("../zonebie", File.dirname(__FILE__))
1
+ require File.expand_path('../zonebie', File.dirname(__FILE__))
2
2
 
3
3
  RSpec.configure do |c|
4
4
  c.before(:suite) do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Zonebie
2
- VERSION = "0.5.1"
3
+ VERSION = '0.6.0'.freeze
3
4
  end
@@ -1,5 +1,4 @@
1
1
  require "spec_helper"
2
- require "active_support/time"
3
2
 
4
3
  describe Zonebie do
5
4
  before do
@@ -3,19 +3,18 @@ require "spec_helper"
3
3
  describe Zonebie::Backends::ActiveSupport do
4
4
  describe "#name" do
5
5
  it "is :activesupport" do
6
- described_class.name.should == :activesupport
6
+ expect(described_class.name).to eq :activesupport
7
7
  end
8
8
  end
9
9
 
10
10
  describe "#zones" do
11
11
  it "returns a list of zones provided by ActiveSupport" do
12
- ::ActiveSupport::TimeZone.stubs(:all).
13
- returns([
14
- stub(:name => "Eastern Time (US & Canada)"),
15
- stub(:name => "Central Time (US & Canada)")
16
- ])
12
+ ::ActiveSupport::TimeZone.stubs(:all).returns([
13
+ stub(:name => "Eastern Time (US & Canada)"),
14
+ stub(:name => "Central Time (US & Canada)")
15
+ ])
17
16
 
18
- described_class.zones.should =~ ["Eastern Time (US & Canada)", "Central Time (US & Canada)"]
17
+ expect(described_class.zones).to eq ["Eastern Time (US & Canada)", "Central Time (US & Canada)"]
19
18
  end
20
19
  end
21
20
 
@@ -29,14 +28,14 @@ describe Zonebie::Backends::ActiveSupport do
29
28
 
30
29
  describe "usable?" do
31
30
  it "returns true if ActiveSupport is available" do
32
- described_class.should be_usable
31
+ expect(described_class).to be_usable
33
32
  end
34
33
 
35
34
  it "returns false if ActiveSupport is unavailable" do
36
35
  old_active_support = ActiveSupport
37
36
  Object.send(:remove_const, :ActiveSupport)
38
37
  begin
39
- described_class.should_not be_usable
38
+ expect(described_class).not_to be_usable
40
39
  ensure
41
40
  ActiveSupport = old_active_support
42
41
  end
@@ -3,19 +3,18 @@ require "spec_helper"
3
3
  describe Zonebie::Backends::TZInfo do
4
4
  describe "#name" do
5
5
  it "is :tzinfo" do
6
- described_class.name.should == :tzinfo
6
+ expect(described_class.name).to eq :tzinfo
7
7
  end
8
8
  end
9
9
 
10
10
  describe "#zones" do
11
11
  it "returns a list of zones provided by TZInfo" do
12
- ::TZInfo::Timezone.stubs(:all).
13
- returns([
14
- stub(:identifier => "America/Chicago"),
15
- stub(:identifier => "America/New York")
16
- ])
12
+ ::TZInfo::Timezone.stubs(:all).returns([
13
+ stub(:identifier => "America/Chicago"),
14
+ stub(:identifier => "America/New York")
15
+ ])
17
16
 
18
- described_class.zones.should =~ ["America/Chicago", "America/New York"]
17
+ expect(described_class.zones).to eq ["America/Chicago", "America/New York"]
19
18
  end
20
19
  end
21
20
 
@@ -28,14 +27,14 @@ describe Zonebie::Backends::TZInfo do
28
27
 
29
28
  describe "usable?" do
30
29
  it "returns true if TZInfo is available" do
31
- described_class.should be_usable
30
+ expect(described_class).to be_usable
32
31
  end
33
32
 
34
33
  it "returns false if TZInfo is unavailable" do
35
34
  old_tz_info = TZInfo
36
35
  Object.send(:remove_const, :TZInfo)
37
36
  begin
38
- described_class.should_not be_usable
37
+ expect(described_class).not_to be_usable
39
38
  ensure
40
39
  TZInfo = old_tz_info
41
40
  end
@@ -3,18 +3,18 @@ require "spec_helper"
3
3
  describe Zonebie do
4
4
  describe "#backend" do
5
5
  it "defaults to the activesupport backend in the presence of activesupport" do
6
- Zonebie.backend.name.should == :activesupport
6
+ expect(Zonebie.backend.name).to eq :activesupport
7
7
  end
8
8
 
9
9
  it "allows setting the backend to tzinfo" do
10
10
  Zonebie.backend = :tzinfo
11
- Zonebie.backend.name.should == :tzinfo
11
+ expect(Zonebie.backend.name).to eq :tzinfo
12
12
  end
13
13
 
14
14
  it "defaults to tzinfo in the absense of activesupport" do
15
15
  Zonebie::Backends::ActiveSupport.stubs(:usable?).returns(false)
16
16
 
17
- Zonebie.backend.name.should == :tzinfo
17
+ expect(Zonebie.backend.name).to eq :tzinfo
18
18
  end
19
19
 
20
20
  it "does not allow setting the backend to an unsupported value" do
@@ -90,8 +90,5 @@ describe Zonebie do
90
90
  Zonebie.backend = :my_awesome_backend
91
91
  end
92
92
 
93
- it "returns a random timezone" do
94
- Zonebie.random_timezone.should == "Eastern Time (US & Canada)"
95
- end
96
93
  end
97
94
  end
data/zonebie.gemspec CHANGED
@@ -1,7 +1,11 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/zonebie/version', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zonebie/version'
3
5
 
4
6
  Gem::Specification.new do |gem|
7
+ gem.name = "zonebie"
8
+ gem.version = Zonebie::VERSION
5
9
  gem.authors = ['Andy Lindeman', 'Steven Harman', 'Patrick Van Stee']
6
10
  gem.email = ['andy@andylindeman.com', 'steveharman@gmail.com', 'patrickvanstee@gmail.com']
7
11
  gem.description = %q{Runs your tests in a random timezone}
@@ -9,18 +13,18 @@ Gem::Specification.new do |gem|
9
13
  gem.homepage = "https://github.com/alindeman/zonebie"
10
14
  gem.license = 'MIT'
11
15
 
12
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- gem.files = `git ls-files`.split("\n")
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.name = "zonebie"
16
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|gem|features)/}) }
17
+ gem.bindir = "exe"
18
+ gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
19
  gem.require_paths = ["lib"]
17
- gem.version = Zonebie::VERSION
20
+
21
+ gem.required_ruby_version = '>= 2.0.0'
18
22
 
19
23
  gem.add_development_dependency "rake"
20
- gem.add_development_dependency "rspec", "~>2.14"
21
- gem.add_development_dependency "mocha", "~>0.14.0"
24
+ gem.add_development_dependency "rspec", "~> 3.4"
25
+ gem.add_development_dependency "mocha", "~> 0.14.0"
22
26
 
23
- gem.add_development_dependency "activesupport", ">=2.3"
24
- gem.add_development_dependency "tzinfo", "~>1.0", ">= 1.0.1"
25
- gem.add_development_dependency "tzinfo-data", ">= 1.2013.4"
27
+ gem.add_development_dependency "activesupport", "~> 3.0"
28
+ gem.add_development_dependency "tzinfo", "~> 1.2", ">= 1.2.2"
29
+ gem.add_development_dependency "tzinfo-data", ">= 1.2016.1"
26
30
  end
metadata CHANGED
@@ -1,107 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zonebie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Lindeman
8
8
  - Steven Harman
9
9
  - Patrick Van Stee
10
10
  autorequire:
11
- bindir: bin
11
+ bindir: exe
12
12
  cert_chain: []
13
- date: 2013-08-17 00:00:00.000000000 Z
13
+ date: 2016-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rspec
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '2.14'
35
+ version: '3.4'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '2.14'
42
+ version: '3.4'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: mocha
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 0.14.0
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 0.14.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: activesupport
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '2.3'
63
+ version: '3.0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '2.3'
70
+ version: '3.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: tzinfo
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '1.0'
78
- - - '>='
77
+ version: '1.2'
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 1.0.1
80
+ version: 1.2.2
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ~>
85
+ - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '1.0'
88
- - - '>='
87
+ version: '1.2'
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 1.0.1
90
+ version: 1.2.2
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: tzinfo-data
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 1.2013.4
97
+ version: 1.2016.1
98
98
  type: :development
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 1.2013.4
104
+ version: 1.2016.1
105
105
  description: Runs your tests in a random timezone
106
106
  email:
107
107
  - andy@andylindeman.com
@@ -111,9 +111,9 @@ executables: []
111
111
  extensions: []
112
112
  extra_rdoc_files: []
113
113
  files:
114
- - .gitignore
115
- - .rspec
116
- - .travis.yml
114
+ - ".gitignore"
115
+ - ".rspec"
116
+ - ".travis.yml"
117
117
  - Changelog.md
118
118
  - Gemfile
119
119
  - LICENSE
@@ -141,17 +141,17 @@ require_paths:
141
141
  - lib
142
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: '0'
146
+ version: 2.0.0
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.0.3
154
+ rubygems_version: 2.5.1
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Zonebie prevents bugs in code that deals with timezones by randomly assigning