simple_command 0.2.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +23 -0
- data/README.md +2 -2
- data/lib/simple_command/errors.rb +1 -1
- data/lib/simple_command/utils.rb +14 -0
- data/lib/simple_command/version.rb +1 -1
- data/lib/simple_command.rb +1 -0
- data/simple_command.gemspec +1 -1
- data/spec/simple_command/errors_spec.rb +18 -6
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfe8377a98ac9d816954e6060c6fb39b0e0c6a8817a1f14ccc3695ff1f38711
|
4
|
+
data.tar.gz: f7ffdea8cec0b7988a8b4b71977986d1a0b2aa9ac5c2219ac9fd490c114c8b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11cde61466a2c6fea1c40cee0f358e3e299ea9bc3e98653fd9a8bafc414f5475a24bd3fa26537d1c7c86be8774f26d703e2aef44c6a325b441b7b9e9eb143be6
|
7
|
+
data.tar.gz: 03c2d3b58075237aa7e56d2a72dd4b7faafa5f7b7b13dd76fcc919b034e9eecd581c3099f9ce1aa4ba4efe91074699b2622f8e9be19bc1838edad7f282030c5b
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", ruby-head, jruby-9.3, jruby-head]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
bundler-cache: true # 'bundle install' and cache gems
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/github/nebulab/simple_command/badges/gpa.svg)](https://codeclimate.com/github/nebulab/simple_command)
|
2
|
-
|
2
|
+
![CI](https://github.com/nebulab/simple_command/actions/workflows/ci.yml/badge.svg)
|
3
3
|
|
4
4
|
# SimpleCommand
|
5
5
|
|
@@ -7,7 +7,7 @@ A simple, standardized way to build and use _Service Objects_ (aka _Commands_) i
|
|
7
7
|
|
8
8
|
## Requirements
|
9
9
|
|
10
|
-
* Ruby 2.
|
10
|
+
* Ruby 2.6+
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
data/lib/simple_command.rb
CHANGED
data/simple_command.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'simple_command/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.required_ruby_version = '>= 2.
|
7
|
+
s.required_ruby_version = '>= 2.6'
|
8
8
|
s.name = 'simple_command'
|
9
9
|
s.version = SimpleCommand::VERSION
|
10
10
|
s.authors = ['Andrea Pavoni']
|
@@ -19,21 +19,33 @@ describe SimpleCommand::Errors do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#add_multiple_errors' do
|
22
|
-
|
23
|
-
{
|
22
|
+
it 'populates itself with the added errors' do
|
23
|
+
errors_list = {
|
24
24
|
some_error: ['some error description'],
|
25
25
|
another_error: ['another error description']
|
26
26
|
}
|
27
|
-
end
|
28
27
|
|
29
|
-
before do
|
30
28
|
errors.add_multiple_errors errors_list
|
31
|
-
end
|
32
29
|
|
33
|
-
it 'populates itself with the added errors' do
|
34
30
|
expect(errors[:some_error]).to eq(errors_list[:some_error])
|
35
31
|
expect(errors[:another_error]).to eq(errors_list[:another_error])
|
36
32
|
end
|
33
|
+
|
34
|
+
it 'copies errors from another SimpleCommand::Errors object' do
|
35
|
+
command_errors = SimpleCommand::Errors.new
|
36
|
+
command_errors.add :some_error, "was found"
|
37
|
+
command_errors.add :some_error, "happened again"
|
38
|
+
|
39
|
+
errors.add_multiple_errors command_errors
|
40
|
+
|
41
|
+
expect(errors[:some_error]).to eq(["was found", "happened again"])
|
42
|
+
end
|
43
|
+
|
44
|
+
it "ignores nil values" do
|
45
|
+
errors.add_multiple_errors({:foo => nil})
|
46
|
+
|
47
|
+
expect(errors[:foo]).to eq nil
|
48
|
+
end
|
37
49
|
end
|
38
50
|
|
39
51
|
describe '#each' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Pavoni
|
@@ -59,6 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/workflows/ci.yml"
|
62
63
|
- ".gitignore"
|
63
64
|
- ".rspec"
|
64
65
|
- ".rubocop.yml"
|
@@ -69,6 +70,7 @@ files:
|
|
69
70
|
- Rakefile
|
70
71
|
- lib/simple_command.rb
|
71
72
|
- lib/simple_command/errors.rb
|
73
|
+
- lib/simple_command/utils.rb
|
72
74
|
- lib/simple_command/version.rb
|
73
75
|
- simple_command.gemspec
|
74
76
|
- spec/factories/missed_call_command.rb
|
@@ -88,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
90
|
requirements:
|
89
91
|
- - ">="
|
90
92
|
- !ruby/object:Gem::Version
|
91
|
-
version: '2.
|
93
|
+
version: '2.6'
|
92
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
95
|
requirements:
|
94
96
|
- - ">="
|