cada 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +9 -0
- data/bin/rspec +29 -0
- data/cada.gemspec +3 -3
- data/lib/cada/version.rb +1 -1
- data/spec/cada_spec.rb +11 -11
- data/spec/spec_helper.rb +97 -4
- metadata +28 -41
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 04c42c5c73a56702ddcf08969ff1c3aa7ca30b52b805cdf50c08da6ebd86709d
|
|
4
|
+
data.tar.gz: 3c144eb8db225cff62136449e1b1965154119a9ca0fefa3483b831e73ff5348f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b344ffd9d23694acd57b61b358350b6ae192fc077470e97725609a0f404576de965a957214da0b388067e4885773949cf60eeca3601246ce424a90c9378c0735
|
|
7
|
+
data.tar.gz: e7690a38acf877b91dca318b23f524535174d2a01f6a12fc3896413f2e566b95d5f96c4b18953de1948e9f58d316b283719b03cf3a4cd2637c1c0e8ca87302b4
|
data/.gitignore
CHANGED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.0.0] - 2020-07-16
|
|
8
|
+
### Added
|
|
9
|
+
- Updated dependencies
|
data/bin/rspec
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/cada.gemspec
CHANGED
|
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
spec.add_dependency 'activesupport', '
|
|
21
|
+
spec.add_dependency 'activesupport', '>= 3.0'
|
|
22
22
|
|
|
23
|
-
spec.add_development_dependency "bundler", "~>
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
24
24
|
spec.add_development_dependency "rake"
|
|
25
|
-
spec.add_development_dependency "rspec", '
|
|
25
|
+
spec.add_development_dependency "rspec", '~> 3.9'
|
|
26
26
|
end
|
data/lib/cada/version.rb
CHANGED
data/spec/cada_spec.rb
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Cada do
|
|
3
|
+
RSpec.describe Cada do
|
|
4
4
|
|
|
5
5
|
describe '#day' do
|
|
6
|
-
it '
|
|
6
|
+
it 'steps per day between the start and end dates and execute the block' do
|
|
7
7
|
steps = []
|
|
8
8
|
described_class.day '2011-02-02'.to_date, '2011-02-03'.to_date do |date|
|
|
9
9
|
steps << date
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
steps.size.
|
|
13
|
-
steps[0].
|
|
14
|
-
steps[1].
|
|
12
|
+
expect(steps.size).to eq 2
|
|
13
|
+
expect(steps[0]).to eq '2011-02-02'.to_date
|
|
14
|
+
expect(steps[1]).to eq '2011-02-03'.to_date
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
describe '#month' do
|
|
19
|
-
it '
|
|
19
|
+
it 'steps per month between the start and end dates and execute the block' do
|
|
20
20
|
steps = []
|
|
21
21
|
described_class.month '2011-02-02'.to_date, '2011-04-04'.to_date do |date|
|
|
22
22
|
steps << date
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
steps.size.
|
|
26
|
-
steps[0].
|
|
27
|
-
steps[1].
|
|
28
|
-
steps[2].
|
|
25
|
+
expect(steps.size).to eq 3
|
|
26
|
+
expect(steps[0]).to eq '2011-02-02'.to_date
|
|
27
|
+
expect(steps[1]).to eq '2011-03-02'.to_date
|
|
28
|
+
expect(steps[2]).to eq '2011-04-02'.to_date
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
it '
|
|
32
|
+
it 'raises an error if a date range used does not exist' do
|
|
33
33
|
expect {
|
|
34
34
|
described_class.meh 1.day.ago, 1.day.ago
|
|
35
35
|
}.to raise_error(
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,99 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
Bundler.require(:test)
|
|
3
|
-
|
|
4
|
-
require 'rubygems'
|
|
5
1
|
require 'active_support/all'
|
|
6
2
|
require 'cada'
|
|
3
|
+
|
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
6
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
7
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
8
|
+
# files.
|
|
9
|
+
#
|
|
10
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
11
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
12
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
13
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
14
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
15
|
+
# the additional setup, and require it from the spec files that actually need
|
|
16
|
+
# it.
|
|
17
|
+
#
|
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
19
|
+
RSpec.configure do |config|
|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
22
|
+
# assertions if you prefer.
|
|
23
|
+
config.expect_with :rspec do |expectations|
|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
26
|
+
# defined using `chain`, e.g.:
|
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
29
|
+
# ...rather than:
|
|
30
|
+
# # => "be bigger than 2"
|
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
36
|
+
config.mock_with :rspec do |mocks|
|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
38
|
+
# a real object. This is generally recommended, and will default to
|
|
39
|
+
# `true` in RSpec 4.
|
|
40
|
+
mocks.verify_partial_doubles = true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
44
|
+
# have no way to turn it off -- the option exists only for backwards
|
|
45
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
46
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
|
47
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
48
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
49
|
+
|
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
55
|
+
config.filter_run_when_matching :focus
|
|
56
|
+
|
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
59
|
+
# you configure your source control system to ignore this file.
|
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
61
|
+
|
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
|
63
|
+
# recommended. For more details, see:
|
|
64
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
|
65
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
66
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
67
|
+
config.disable_monkey_patching!
|
|
68
|
+
|
|
69
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
|
70
|
+
# be too noisy due to issues in dependencies.
|
|
71
|
+
config.warnings = true
|
|
72
|
+
|
|
73
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
74
|
+
# file, and it's useful to allow more verbose output when running an
|
|
75
|
+
# individual spec file.
|
|
76
|
+
if config.files_to_run.one?
|
|
77
|
+
# Use the documentation formatter for detailed output,
|
|
78
|
+
# unless a formatter has already been configured
|
|
79
|
+
# (e.g. via a command-line flag).
|
|
80
|
+
config.default_formatter = "doc"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Print the 10 slowest examples and example groups at the
|
|
84
|
+
# end of the spec run, to help surface which specs are running
|
|
85
|
+
# particularly slow.
|
|
86
|
+
config.profile_examples = 10
|
|
87
|
+
|
|
88
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
89
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
90
|
+
# the seed, which is printed after each run.
|
|
91
|
+
# --seed 1234
|
|
92
|
+
config.order = :random
|
|
93
|
+
|
|
94
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
95
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
96
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
97
|
+
# as the one that triggered the failure.
|
|
98
|
+
Kernel.srand config.seed
|
|
99
|
+
end
|
metadata
CHANGED
|
@@ -1,92 +1,87 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cada
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Ramon Tayag
|
|
9
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: activesupport
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - ">="
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '3.0'
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- -
|
|
24
|
+
- - ">="
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '3.0'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: bundler
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '
|
|
33
|
+
version: '2.0'
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
40
|
+
version: '2.0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: rake
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - ">="
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
47
|
version: '0'
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - ">="
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '0'
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: rspec
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - "~>"
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
|
-
version:
|
|
61
|
+
version: '3.9'
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - "~>"
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
68
|
+
version: '3.9'
|
|
78
69
|
description: Loop through dates (every day, every week, every month, etc)
|
|
79
70
|
email:
|
|
80
71
|
- ramon.tayag@gmail.com
|
|
81
|
-
executables:
|
|
72
|
+
executables:
|
|
73
|
+
- rspec
|
|
82
74
|
extensions: []
|
|
83
75
|
extra_rdoc_files: []
|
|
84
76
|
files:
|
|
85
|
-
- .gitignore
|
|
77
|
+
- ".gitignore"
|
|
78
|
+
- ".rspec"
|
|
79
|
+
- CHANGELOG.md
|
|
86
80
|
- Gemfile
|
|
87
81
|
- LICENSE.txt
|
|
88
82
|
- README.md
|
|
89
83
|
- Rakefile
|
|
84
|
+
- bin/rspec
|
|
90
85
|
- cada.gemspec
|
|
91
86
|
- lib/cada.rb
|
|
92
87
|
- lib/cada/stepper.rb
|
|
@@ -96,33 +91,25 @@ files:
|
|
|
96
91
|
homepage: ''
|
|
97
92
|
licenses:
|
|
98
93
|
- MIT
|
|
99
|
-
|
|
94
|
+
metadata: {}
|
|
95
|
+
post_install_message:
|
|
100
96
|
rdoc_options: []
|
|
101
97
|
require_paths:
|
|
102
98
|
- lib
|
|
103
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
|
-
none: false
|
|
105
100
|
requirements:
|
|
106
|
-
- -
|
|
101
|
+
- - ">="
|
|
107
102
|
- !ruby/object:Gem::Version
|
|
108
103
|
version: '0'
|
|
109
|
-
segments:
|
|
110
|
-
- 0
|
|
111
|
-
hash: -4177211542693863245
|
|
112
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
|
-
none: false
|
|
114
105
|
requirements:
|
|
115
|
-
- -
|
|
106
|
+
- - ">="
|
|
116
107
|
- !ruby/object:Gem::Version
|
|
117
108
|
version: '0'
|
|
118
|
-
segments:
|
|
119
|
-
- 0
|
|
120
|
-
hash: -4177211542693863245
|
|
121
109
|
requirements: []
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
specification_version: 3
|
|
110
|
+
rubygems_version: 3.0.8
|
|
111
|
+
signing_key:
|
|
112
|
+
specification_version: 4
|
|
126
113
|
summary: Step through a date by a timeframe
|
|
127
114
|
test_files:
|
|
128
115
|
- spec/cada_spec.rb
|