rails-patterns 0.3.0 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +33 -0
- data/Gemfile +8 -4
- data/Gemfile.lock +104 -56
- data/README.md +183 -6
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/patterns/calculation.rb +59 -0
- data/lib/patterns/form.rb +117 -0
- data/lib/patterns/query.rb +20 -15
- data/lib/patterns/service.rb +10 -6
- data/lib/rails-patterns.rb +2 -0
- data/rails-patterns.gemspec +25 -7
- data/spec/helpers/custom_calculation.rb +16 -0
- data/spec/helpers/custom_calculation_script.rb +4 -0
- data/spec/helpers/rails_redis_cache_mock.rb +5 -0
- data/spec/patterns/calculation_spec.rb +200 -0
- data/spec/patterns/form_spec.rb +478 -0
- data/spec/patterns/service_spec.rb +16 -1
- data/spec/spec_helper.rb +6 -1
- metadata +56 -6
@@ -10,7 +10,7 @@ RSpec.describe Patterns::Service do
|
|
10
10
|
expect(DoSomething.call).to be_kind_of(DoSomething)
|
11
11
|
end
|
12
12
|
|
13
|
-
it "instantiates service object passing arguments to constructor" do
|
13
|
+
it "instantiates service object passing keyword arguments to constructor" do
|
14
14
|
DoSomething = Class.new(Patterns::Service) do
|
15
15
|
def initialize(argument_1:, argument_2:); end
|
16
16
|
def call; end
|
@@ -25,6 +25,21 @@ RSpec.describe Patterns::Service do
|
|
25
25
|
}.not_to raise_error
|
26
26
|
end
|
27
27
|
|
28
|
+
it "instantiates service object passing positional arguments to constructor" do
|
29
|
+
DoSomething = Class.new(Patterns::Service) do
|
30
|
+
def initialize(argument_1, argument_2); end
|
31
|
+
def call; end
|
32
|
+
end
|
33
|
+
|
34
|
+
expect {
|
35
|
+
DoSomething.call
|
36
|
+
}.to raise_error ArgumentError
|
37
|
+
|
38
|
+
expect {
|
39
|
+
DoSomething.call(10, 20)
|
40
|
+
}.not_to raise_error
|
41
|
+
end
|
42
|
+
|
28
43
|
it "calls #call method on service object instance" do
|
29
44
|
Spy = Class.new do
|
30
45
|
def self.some_method; end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,10 +17,15 @@
|
|
17
17
|
#
|
18
18
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
19
|
|
20
|
-
require "
|
20
|
+
require "active_support/all"
|
21
|
+
require "active_support/testing/time_helpers"
|
21
22
|
require "pry"
|
23
|
+
require "redis"
|
24
|
+
require "rails-patterns"
|
22
25
|
|
23
26
|
RSpec.configure do |config|
|
27
|
+
config.include ActiveSupport::Testing::TimeHelpers
|
28
|
+
|
24
29
|
# rspec-expectations config goes here. You can use an alternate
|
25
30
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
26
31
|
# assertions if you prefer.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-patterns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stevo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionpack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.2.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.2.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: virtus
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby2_keywords
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: rspec
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +86,14 @@ dependencies:
|
|
44
86
|
requirements:
|
45
87
|
- - "~>"
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
89
|
+
version: '2.0'
|
48
90
|
type: :development
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
94
|
- - "~>"
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
96
|
+
version: '2.0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: juwelier
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +117,7 @@ extra_rdoc_files:
|
|
75
117
|
- README.md
|
76
118
|
files:
|
77
119
|
- ".document"
|
120
|
+
- ".github/workflows/ruby.yml"
|
78
121
|
- ".rspec"
|
79
122
|
- Gemfile
|
80
123
|
- Gemfile.lock
|
@@ -83,12 +126,19 @@ files:
|
|
83
126
|
- Rakefile
|
84
127
|
- VERSION
|
85
128
|
- lib/patterns.rb
|
129
|
+
- lib/patterns/calculation.rb
|
86
130
|
- lib/patterns/collection.rb
|
131
|
+
- lib/patterns/form.rb
|
87
132
|
- lib/patterns/query.rb
|
88
133
|
- lib/patterns/service.rb
|
89
134
|
- lib/rails-patterns.rb
|
90
135
|
- rails-patterns.gemspec
|
136
|
+
- spec/helpers/custom_calculation.rb
|
137
|
+
- spec/helpers/custom_calculation_script.rb
|
138
|
+
- spec/helpers/rails_redis_cache_mock.rb
|
139
|
+
- spec/patterns/calculation_spec.rb
|
91
140
|
- spec/patterns/collection_spec.rb
|
141
|
+
- spec/patterns/form_spec.rb
|
92
142
|
- spec/patterns/query_spec.rb
|
93
143
|
- spec/patterns/service_spec.rb
|
94
144
|
- spec/spec_helper.rb
|
@@ -104,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
154
|
requirements:
|
105
155
|
- - ">="
|
106
156
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
157
|
+
version: 2.5.0
|
108
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
159
|
requirements:
|
110
160
|
- - ">="
|
@@ -112,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
162
|
version: '0'
|
113
163
|
requirements: []
|
114
164
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.6.
|
165
|
+
rubygems_version: 2.7.6.2
|
116
166
|
signing_key:
|
117
167
|
specification_version: 4
|
118
168
|
summary: A collection of lightweight, standardized, rails-oriented patterns.
|