quantum_leap 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .rbx
6
+ .rvmrc
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p125
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Matthew Conway
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # QuantumLeap
2
+
3
+ Righting wrongs in your test suite with time travel!
4
+
5
+ QuantumLeap lets you change the current time in your tests. I can't promise
6
+ you'll meet any historical figures, however.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'quantum_leap'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install quantum_leap
21
+
22
+ ## Usage
23
+
24
+ require 'quantum_leap'
25
+
26
+ Quantum.leap(Time.now + 60)
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs.push "lib"
8
+ t.test_files = FileList['spec/*_spec.rb']
9
+ t.verbose = true
10
+ end
11
+
12
+ task :default => [:test]
@@ -0,0 +1,3 @@
1
+ module QuantumLeap
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'quantum_leap/version'
2
+
3
+ module QuantumLeap
4
+ extend self
5
+
6
+ def time_travel_offsets
7
+ @time_travel_offsets ||= []
8
+ end
9
+
10
+ def mock_current_time(new_time)
11
+ time_travel_offsets.push(Time.now - new_time)
12
+ end
13
+
14
+ def now
15
+ Time.really_now - time_travel_offsets.inject(0, :+)
16
+ end
17
+ end
18
+
19
+ class << Time
20
+ alias_method :really_now, :now
21
+ def now; QuantumLeap.now; end
22
+ end
23
+
24
+ class Quantum
25
+ def self.leap(time)
26
+ QuantumLeap.mock_current_time(time)
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/quantum_leap/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Matthew Conway"]
6
+ gem.email = ["mattonrails@shortmail.com"]
7
+ gem.description = %q{Righting wrongs in your test suite with time travel!}
8
+ gem.summary = %q{Lets you change the current time in your tests}
9
+ gem.homepage = "http://mattonrails.github.com/quantum_leap/"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "quantum_leap"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = QuantumLeap::VERSION
17
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'spec_helper'
2
+ require 'quantum_leap'
3
+
4
+ describe Quantum do
5
+
6
+ describe '.leap' do
7
+ the_past = Time.new(1968, 03, 25, 15, 00)
8
+
9
+ it 'changes the current time' do
10
+ Quantum.leap(the_past)
11
+ Time.now.must_be_close_to(the_past)
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1 @@
1
+ require 'minitest/autorun'
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quantum_leap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matthew Conway
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Righting wrongs in your test suite with time travel!
15
+ email:
16
+ - mattonrails@shortmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - .rbenv-version
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - lib/quantum_leap.rb
28
+ - lib/quantum_leap/version.rb
29
+ - quantum_leap.gemspec
30
+ - spec/quantum_spec.rb
31
+ - spec/spec_helper.rb
32
+ homepage: http://mattonrails.github.com/quantum_leap/
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.16
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Lets you change the current time in your tests
56
+ test_files:
57
+ - spec/quantum_spec.rb
58
+ - spec/spec_helper.rb