stamped 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/lib/stamped/rspec.rb +10 -0
- data/lib/stamped/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c10d7c06816d9b3d7ae3a32e699348120376ab6b
|
4
|
+
data.tar.gz: 6385a82e161a0a1125fa6be939cee9b54b07cf6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a877ad69c62446f697c6398ded2dddcb1b79fc04dfcf929da98a290b9dee19781b089944d9caeb93f64b32bce0acd90ce5f6ffe235942f62470156a144aed45f
|
7
|
+
data.tar.gz: 401efbf29f0bb483c95ec3e3c1193b41d06318df5a588ce8396d73f6ff97622a853c85815c016f0246684a6b11986fffb61069408f155249e8f9c383f6eb27fc
|
data/README.md
CHANGED
@@ -28,6 +28,39 @@ Time.now.stamp #=> "2015-03-25T00:53:36Z"
|
|
28
28
|
Time.stamp_time #=> 2015-03-25 00:53:44 UTC
|
29
29
|
```
|
30
30
|
|
31
|
+
## Testing
|
32
|
+
|
33
|
+
When testing with time, you often just want to make sure you have a valid timestamp, rather than a specific time. To aid this case, you can use the `be_timestamp` matcher.
|
34
|
+
|
35
|
+
``` ruby
|
36
|
+
# spec_helper.rb
|
37
|
+
require 'stamped/rspec'
|
38
|
+
|
39
|
+
# delivery.rb
|
40
|
+
class Delivery
|
41
|
+
def initialize(time)
|
42
|
+
@time = time
|
43
|
+
end
|
44
|
+
|
45
|
+
def timestamp
|
46
|
+
@time.stamp
|
47
|
+
end
|
48
|
+
|
49
|
+
# ...
|
50
|
+
end
|
51
|
+
|
52
|
+
# delivery_spec.rb
|
53
|
+
require 'spec_helper'
|
54
|
+
|
55
|
+
describe Delivery do
|
56
|
+
it 'has a valid timestamp' do
|
57
|
+
delivery = Delivery.new(3.days.from_now)
|
58
|
+
|
59
|
+
expect(delivery.timestamp).to be_timestamp
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
31
64
|
## Development
|
32
65
|
|
33
66
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/stamped/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stamped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Madsen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- bin/console
|
99
99
|
- bin/setup
|
100
100
|
- lib/stamped.rb
|
101
|
+
- lib/stamped/rspec.rb
|
101
102
|
- lib/stamped/version.rb
|
102
103
|
- stamped.gemspec
|
103
104
|
homepage: https://github.com/lintci/stamped
|