serviz 0.1.0 → 0.1.1

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: 0a8c90b4c72f5d9621e74260aab5e749220c401e93d59bcf59962bd3b6b082d7
4
- data.tar.gz: 515ec53954ed6ba41a55917c842cdf9555da12f570d89f41fee23eddce75ba9f
3
+ metadata.gz: f5c7ab5aa65d4e38eb1dc46293514d3b0c2646e42e0e57e564d6da528ba5641c
4
+ data.tar.gz: '03591abc857c6138c2d3eb595547373dd75cf9aa7a2855693566f384325a7da3'
5
5
  SHA512:
6
- metadata.gz: b950f5bd79db1a557580545182e3147c3aa9d721eea9493aa1cbd67c4154cb112bc49d8a995a21abeb919f3c08640ebd9e8792669303518c713c51afdc31a45a
7
- data.tar.gz: d021ff64c59497d0459f314209fc0b0f4d60c77f6ee9f5a877c0e97e2b4baba54252995d761a007bb0dbd6740f783e778ee166b7cf3d0843f66c7f0b96c9d3b5
6
+ metadata.gz: '081c3fadf6244312e478e99e6d85b386140f317e544f230f8f648bdfe1a34d48502cb581d50c524ae481dd1d56e9360ac52674e04dd7680e37bd3365d08274e7'
7
+ data.tar.gz: 251d149787e0460e3039e539c881aac1ae8a7f4a4d92afccccb9e105c2c6d016faff54bae0acabd632b4646ae9ef3d2ee0184af6eff50a25d5cc53aa20d54ef5
@@ -1,3 +1,3 @@
1
1
  module Serviz
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,18 @@
1
+ class RegisterUser < Serviz::Base
2
+ def initialize(user = nil)
3
+ @user = user
4
+ end
5
+
6
+ def call
7
+ if @user
8
+ self.result = @user
9
+ else
10
+ self.errors << 'No user!'
11
+ end
12
+
13
+ self
14
+ end
15
+ end
16
+
17
+ class NoCall < Serviz::Base
18
+ end
@@ -1,5 +1,24 @@
1
1
  RSpec.describe Serviz::Base do
2
- it "does something useful" do
3
- expect(true).to eq(true)
2
+ it "operation success" do
3
+ user = 'random_user'
4
+ operation = RegisterUser.call(user)
5
+
6
+ expect(operation.success?).to eq true
7
+ expect(operation.failure?).to eq false
8
+ expect(operation.errors).to be_empty
9
+ expect(operation.result).to eq user
10
+ end
11
+
12
+ it "operation error" do
13
+ operation = RegisterUser.call(nil)
14
+
15
+ expect(operation.success?).to eq false
16
+ expect(operation.failure?).to eq true
17
+ expect(operation.errors).not_to be_empty
18
+ expect(operation.result).to eq nil
19
+ end
20
+
21
+ it "raises exception if #call is not defined" do
22
+ expect { NoCall.call }.to raise_error NotImplementedError
4
23
  end
5
24
  end
@@ -1,6 +1,8 @@
1
1
  require "bundler/setup"
2
2
  require "serviz"
3
3
 
4
+ require_relative "scenarios"
5
+
4
6
  RSpec.configure do |config|
5
7
  config.order = :rand
6
8
  config.disable_monkey_patching!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - markets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-04 00:00:00.000000000 Z
11
+ date: 2019-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: Minimalistic Service Class for Ruby
55
+ description: Command object Interface for Ruby
56
56
  email:
57
57
  - srmarc.ai@gmail.com
58
58
  executables: []
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - lib/serviz.rb
63
63
  - lib/serviz/version.rb
64
+ - spec/scenarios.rb
64
65
  - spec/serviz_spec.rb
65
66
  - spec/spec_helper.rb
66
67
  homepage: https://github.com/markets/serviz
@@ -82,11 +83,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  - !ruby/object:Gem::Version
83
84
  version: '0'
84
85
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.7.6
86
+ rubygems_version: 3.0.3
87
87
  signing_key:
88
88
  specification_version: 4
89
- summary: Minimalistic Service Class for Ruby
89
+ summary: Command object Interface for Ruby
90
90
  test_files:
91
- - spec/spec_helper.rb
91
+ - spec/scenarios.rb
92
92
  - spec/serviz_spec.rb
93
+ - spec/spec_helper.rb