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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec7e5aeb797cdc4cb942197e1a10caeb590892411cb57d749e5003f02fd4049
4
- data.tar.gz: 012d4a0cb9d89041136b45023acbe7d017cee0ce78bd75a4f7ec5b86f2e70651
3
+ metadata.gz: e62f37a88ad8ed67322e9b90b23bee5fae27e566df594c449d385f76dc077b39
4
+ data.tar.gz: 754cdb573755786d8f56f17ced7f83cc255e90673e3eabf497cb3c5024304291
5
5
  SHA512:
6
- metadata.gz: 440b7ea37555468c9873da13c9312a744ff8eb09a13a89831fed402d2855510922b6f8920d01b977af543b4f6a2d4555954e391fb795d7f428cdd6579db588db
7
- data.tar.gz: be1d6f8dab36e8c59529f7f80459d84b37141d8b5265b57023314c609b146819f483339e34ba0c724a7358de510f6f4d9cbacf1e459d2caecb8b8615a418499d
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-iso8601 (0.1.0)
4
+ rspec-iso8601 (0.2.0)
5
5
  rspec (~> 3.0)
6
6
 
7
7
  GEM
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module ISO8601
5
- REGEXP = /^\d{4}-\d{2}-\d{2}T(?:\d{2}:){2}\d{2}(?:\.(?<usec>\d+))?(?:Z|[\-+]\d{2}:\d{2})$/.freeze
5
+ REGEXP = /^\d{4}-\d{2}-\d{2}T(?:\d{2}:){2}\d{2}(?:\.(?<usec>\d+))?(?<offset>Z|[\-+]\d{2}:\d{2})$/.freeze
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module ISO8601
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
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 && (precision.nil? || (matches[:usec]&.length || 0) == precision)
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.1.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-06 00:00:00.000000000 Z
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
@@ -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