rspec-iso8601 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/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/rspec/iso8601/regexp.rb +1 -1
- data/lib/rspec/iso8601/version.rb +1 -1
- data/lib/rspec/iso8601.rb +8 -2
- metadata +2 -3
- data/rspec-iso8601.gemspec +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62f37a88ad8ed67322e9b90b23bee5fae27e566df594c449d385f76dc077b39
|
4
|
+
data.tar.gz: 754cdb573755786d8f56f17ced7f83cc255e90673e3eabf497cb3c5024304291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f43c7f1d2ae6555d67af60c17169236197982562abf98bbd8ee1c8a157dca8ffd04646a4f71c649a057b5597b468882d73a27bd3a79859bcc6ab8f95f950d3c
|
7
|
+
data.tar.gz: 55e0352307a690df51960be5c81e83ea4d423ec66087a514a4a37543ac62690adac1accd4f1f4f9dbab73a3762991f4d791ff632ebc54d73f93879a349f9ca12
|
data/CHANGELOG.md
CHANGED
@@ -5,3 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.2.0] - 2022-07-12
|
10
|
+
- [#1](https://github.com/splitwise/rspec-iso8601/pull/1): New chained UTC matcher `.in_utc` ([@jas14])
|
11
|
+
|
12
|
+
## [0.1.0] - 2022-07-06
|
13
|
+
### Added
|
14
|
+
- Base `be_an_iso8601_string` and alias `an_iso8601_string` matchers
|
15
|
+
- Optional subsecond precision keyword argument
|
16
|
+
- Chained subsecond precision matcher
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# rspec-iso8601
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rspec-iso8601.svg)](https://badge.fury.io/rb/rspec-iso8601)
|
4
|
+
|
3
5
|
This gem provides RSpec string matchers for [ISO8601 date/time strings](https://www.w3.org/TR/NOTE-datetime). It was inspired by [rspec-uuid](https://github.com/dpep/rspec-uuid).
|
4
6
|
|
5
7
|
## Installation
|
data/lib/rspec/iso8601/regexp.rb
CHANGED
data/lib/rspec/iso8601.rb
CHANGED
@@ -12,16 +12,22 @@ RSpec::Matchers.define :be_an_iso8601_string do |precision: nil|
|
|
12
12
|
matches = actual.match(RSpec::ISO8601::REGEXP)
|
13
13
|
|
14
14
|
precision ||= @precision
|
15
|
-
matches &&
|
15
|
+
matches &&
|
16
|
+
(precision.nil? || (matches[:usec]&.length || 0) == precision) &&
|
17
|
+
(@utc != true || matches[:offset] == "Z")
|
16
18
|
end
|
17
19
|
|
18
20
|
description do
|
19
|
-
"be an ISO8601 string#{" with precision #{precision}" unless precision.nil?}"
|
21
|
+
"be an ISO8601#{" UTC" if @utc} string#{" with precision #{precision}" unless precision.nil?}"
|
20
22
|
end
|
21
23
|
|
22
24
|
chain :with_precision do |digits|
|
23
25
|
@precision = digits
|
24
26
|
end
|
27
|
+
|
28
|
+
chain :in_utc do
|
29
|
+
@utc = true
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
33
|
RSpec::Matchers.alias_matcher :an_iso8601_string, :be_an_iso8601_string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-iso8601
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jess Hottenstein
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-07-
|
12
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -75,7 +75,6 @@ files:
|
|
75
75
|
- lib/rspec/iso8601.rb
|
76
76
|
- lib/rspec/iso8601/regexp.rb
|
77
77
|
- lib/rspec/iso8601/version.rb
|
78
|
-
- rspec-iso8601.gemspec
|
79
78
|
homepage: https://github.com/splitwise/rspec-iso8601
|
80
79
|
licenses:
|
81
80
|
- MIT
|
data/rspec-iso8601.gemspec
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/rspec/iso8601/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rspec-iso8601"
|
7
|
-
spec.version = RSpec::ISO8601::VERSION
|
8
|
-
spec.authors = ["Jess Hottenstein", "Joe Stein"]
|
9
|
-
spec.email = ["jess@splitwise.com", "joe@splitwise.com"]
|
10
|
-
|
11
|
-
spec.summary = "RSpec matching for ISO8601 strings"
|
12
|
-
spec.homepage = "https://github.com/splitwise/rspec-iso8601"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 2.6.0"
|
15
|
-
|
16
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
17
|
-
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
-
spec.metadata["changelog_uri"] = "https://github.com/splitwise/rspec-iso8601/blob/main/CHANGELOG.md"
|
21
|
-
spec.metadata["rubygems_mfa_required"] = "true"
|
22
|
-
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
-
end
|
29
|
-
end
|
30
|
-
spec.bindir = "exe"
|
31
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ["lib"]
|
33
|
-
|
34
|
-
spec.add_dependency "rspec", "~> 3.0"
|
35
|
-
|
36
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
37
|
-
spec.add_development_dependency "rubocop", "~> 1.21"
|
38
|
-
|
39
|
-
# For more information and examples about making a new gem, checkout our
|
40
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
41
|
-
end
|