Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial commit

  • Loading branch information...
commit 255879e510cd2730ef878a64ae2c57f3d7528d10 0 parents
authored December 03, 2009
1  .gitignore
... ...
@@ -0,0 +1 @@
  1
+pkg
20  MIT-LICENSE
... ...
@@ -0,0 +1,20 @@
  1
+Copyright (c) 2009 Adeptware, Inc.
  2
+
  3
+Permission is hereby granted, free of charge, to any person obtaining
  4
+a copy of this software and associated documentation files (the
  5
+"Software"), to deal in the Software without restriction, including
  6
+without limitation the rights to use, copy, modify, merge, publish,
  7
+distribute, sublicense, and/or sell copies of the Software, and to
  8
+permit persons to whom the Software is furnished to do so, subject to
  9
+the following conditions:
  10
+
  11
+The above copyright notice and this permission notice shall be
  12
+included in all copies or substantial portions of the Software.
  13
+
  14
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32  README
... ...
@@ -0,0 +1,32 @@
  1
+time-zone-warp
  2
+=========
  3
+
  4
+If time zone support is critical to your app, it's often necessary to test
  5
+various methods as if they were being run in a specific time zone.
  6
+
  7
+
  8
+Installation
  9
+============
  10
+
  11
+Gem:
  12
+
  13
+$ sudo gem install time-zone-warp
  14
+
  15
+Gem config in a Rails app. Add to environment.rb:
  16
+
  17
+config.gem 'time-zone-warp'
  18
+
  19
+
  20
+Example
  21
+=======
  22
+
  23
+  class UserTest < Test::Unit::TestCase
  24
+    test "code works in other time zones" do
  25
+      pretend_zone_is "Mountain Time (US & Canada)" do
  26
+        # assertions go here
  27
+      end
  28
+    end
  29
+  end
  30
+
  31
+
  32
+Copyright (c) 2009 Adeptware, Inc.  Released under the MIT license.
18  Rakefile
... ...
@@ -0,0 +1,18 @@
  1
+require 'rubygems'
  2
+require 'rake'
  3
+
  4
+begin
  5
+  require 'jeweler'
  6
+  Jeweler::Tasks.new do |gemspec|
  7
+    gemspec.name = "time-zone-warp"
  8
+    gemspec.summary = "Warp time zones in your tests."
  9
+    gemspec.description = "Warp time zones in your tests."
  10
+    gemspec.email = "contact@adeptware.com"
  11
+    gemspec.homepage = "http://github.com/adeptware/time-zone-warp"
  12
+    gemspec.authors = ["Adeptware"]
  13
+  end
  14
+rescue LoadError
  15
+  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
  16
+end
  17
+
  18
+Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
1  VERSION
... ...
@@ -0,0 +1 @@
  1
+1.0.0
13  lib/time_zone_warp.rb
... ...
@@ -0,0 +1,13 @@
  1
+module TimeZoneWarp
  2
+  def pretend_zone_is(zone)
  3
+    original_zone = Time.zone
  4
+    begin
  5
+      Time.zone = zone
  6
+      yield
  7
+    ensure
  8
+      Time.zone = original_zone
  9
+    end
  10
+  end
  11
+end
  12
+ 
  13
+Test::Unit::TestCase.send(:include, TimeZoneWarp)
34  time-zone-warp.gemspec
... ...
@@ -0,0 +1,34 @@
  1
+# Generated by jeweler
  2
+# DO NOT EDIT THIS FILE DIRECTLY
  3
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
  4
+# -*- encoding: utf-8 -*-
  5
+
  6
+Gem::Specification.new do |s|
  7
+  s.name = %q{time-zone-warp}
  8
+  s.version = "1.0.0"
  9
+
  10
+  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
  11
+  s.authors = ["Adeptware"]
  12
+  s.date = %q{2009-12-03}
  13
+  s.description = %q{Warp time zones in your tests.}
  14
+  s.email = %q{contact@adeptware.com}
  15
+  s.extra_rdoc_files = [
  16
+    "README"
  17
+  ]
  18
+  s.homepage = %q{http://github.com/adeptware/time-zone-warp}
  19
+  s.rdoc_options = ["--charset=UTF-8"]
  20
+  s.require_paths = ["lib"]
  21
+  s.rubygems_version = %q{1.3.5}
  22
+  s.summary = %q{Warp time zones in your tests.}
  23
+
  24
+  if s.respond_to? :specification_version then
  25
+    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
  26
+    s.specification_version = 3
  27
+
  28
+    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
  29
+    else
  30
+    end
  31
+  else
  32
+  end
  33
+end
  34
+

0 notes on commit 255879e

Please sign in to comment.
Something went wrong with that request. Please try again.