machinist_redux 3.0.0 → 3.0.2
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 +4 -4
- data/.rubocop_todo.yml +0 -8
- data/Gemfile +2 -8
- data/gemfiles/rails_4.2.gemfile +1 -8
- data/gemfiles/rails_4.2.gemfile.lock +4 -5
- data/gemfiles/rails_5.0.gemfile +1 -8
- data/gemfiles/rails_5.0.gemfile.lock +4 -5
- data/gemfiles/rails_5.1.gemfile +1 -4
- data/gemfiles/rails_5.1.gemfile.lock +4 -4
- data/lib/machinist/active_record/blueprint.rb +15 -10
- data/lib/machinist/active_record/lathe.rb +17 -15
- data/lib/machinist/exceptions.rb +3 -2
- data/lib/machinist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 738b5887ff27ed4cf136d70a7de741e421769988
|
|
4
|
+
data.tar.gz: 677037c04308f48228731d738d5b58a240f39e59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95a4efdb5eb853f93e0c6a8a92f73c4642758a40be1eb3c4750986d0da72a4832c1b2a31636de1da31fb28858c8e99ffc7fec16b1b376bbd4f3dbf601dc43511
|
|
7
|
+
data.tar.gz: 616c90f941f74f33dbd10a7ff8db35bd26b003163188a41cdcc4b8a14320b11b444d59c705ca7222ecf6b5d06f991f00bc4532ec57f30498ab7b01fb2e9f664e
|
data/.rubocop_todo.yml
CHANGED
|
@@ -47,14 +47,6 @@ RSpec/IteratedExpectation:
|
|
|
47
47
|
RSpec/MultipleExpectations:
|
|
48
48
|
Max: 6
|
|
49
49
|
|
|
50
|
-
# Offense count: 2
|
|
51
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
52
|
-
# SupportedStyles: nested, compact
|
|
53
|
-
Style/ClassAndModuleChildren:
|
|
54
|
-
Exclude:
|
|
55
|
-
- 'lib/machinist/active_record/blueprint.rb'
|
|
56
|
-
- 'lib/machinist/active_record/lathe.rb'
|
|
57
|
-
|
|
58
50
|
# Offense count: 1
|
|
59
51
|
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
60
52
|
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
data/Gemfile
CHANGED
|
@@ -2,6 +2,8 @@ source 'http://rubygems.org'
|
|
|
2
2
|
gemspec
|
|
3
3
|
ruby RUBY_VERSION
|
|
4
4
|
|
|
5
|
+
gem 'sqlite3'
|
|
6
|
+
|
|
5
7
|
group :development do
|
|
6
8
|
gem 'appraisal', require: false
|
|
7
9
|
gem 'gem-release', require: false
|
|
@@ -22,11 +24,3 @@ group :test do
|
|
|
22
24
|
gem 'rspec_junit_formatter', require: false
|
|
23
25
|
gem 'simplecov', '~> 0.14', require: false
|
|
24
26
|
end
|
|
25
|
-
|
|
26
|
-
platforms :ruby do
|
|
27
|
-
gem 'sqlite3'
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
platforms :jruby do
|
|
31
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
|
32
|
-
end
|
data/gemfiles/rails_4.2.gemfile
CHANGED
|
@@ -5,6 +5,7 @@ source "http://rubygems.org"
|
|
|
5
5
|
ruby RUBY_VERSION
|
|
6
6
|
|
|
7
7
|
gem "activerecord", "~> 4.2.8", group: :test, require: false
|
|
8
|
+
gem 'sqlite3'
|
|
8
9
|
|
|
9
10
|
group :development do
|
|
10
11
|
gem 'appraisal', require: false
|
|
@@ -27,12 +28,4 @@ group :test do
|
|
|
27
28
|
gem "simplecov", "~> 0.14", require: false
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
platforms :ruby do
|
|
31
|
-
gem "sqlite3"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
platforms :jruby do
|
|
35
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
31
|
gemspec path: "../"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
machinist_redux (3.0.
|
|
4
|
+
machinist_redux (3.0.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
@@ -166,11 +166,11 @@ GEM
|
|
|
166
166
|
ruby_dep (1.5.0)
|
|
167
167
|
ruby_parser (3.9.0)
|
|
168
168
|
sexp_processor (~> 4.1)
|
|
169
|
-
rubycritic (3.2.
|
|
169
|
+
rubycritic (3.2.2)
|
|
170
170
|
flay (~> 2.8)
|
|
171
171
|
flog (~> 4.4)
|
|
172
172
|
launchy (= 2.4.3)
|
|
173
|
-
parser (
|
|
173
|
+
parser (~> 2.4.0)
|
|
174
174
|
rainbow (~> 2.1)
|
|
175
175
|
reek (~> 4.4)
|
|
176
176
|
ruby_parser (~> 3.8)
|
|
@@ -184,7 +184,7 @@ GEM
|
|
|
184
184
|
docile (~> 1.1.0)
|
|
185
185
|
json (>= 1.8, < 3)
|
|
186
186
|
simplecov-html (~> 0.10.0)
|
|
187
|
-
simplecov-html (0.10.
|
|
187
|
+
simplecov-html (0.10.1)
|
|
188
188
|
slop (3.6.0)
|
|
189
189
|
sqlite3 (1.3.13)
|
|
190
190
|
term-ansicolor (1.6.0)
|
|
@@ -206,7 +206,6 @@ PLATFORMS
|
|
|
206
206
|
|
|
207
207
|
DEPENDENCIES
|
|
208
208
|
activerecord (~> 4.2.8)
|
|
209
|
-
activerecord-jdbcsqlite3-adapter
|
|
210
209
|
appraisal
|
|
211
210
|
codeclimate-test-reporter
|
|
212
211
|
coveralls
|
data/gemfiles/rails_5.0.gemfile
CHANGED
|
@@ -5,6 +5,7 @@ source "http://rubygems.org"
|
|
|
5
5
|
ruby RUBY_VERSION
|
|
6
6
|
|
|
7
7
|
gem "activerecord", "~> 5.0.3", group: :test, require: false
|
|
8
|
+
gem 'sqlite3'
|
|
8
9
|
|
|
9
10
|
group :development do
|
|
10
11
|
gem 'appraisal', require: false
|
|
@@ -27,12 +28,4 @@ group :test do
|
|
|
27
28
|
gem "simplecov", "~> 0.14", require: false
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
platforms :ruby do
|
|
31
|
-
gem "sqlite3"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
platforms :jruby do
|
|
35
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
31
|
gemspec path: "../"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
machinist_redux (3.0.
|
|
4
|
+
machinist_redux (3.0.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
@@ -166,11 +166,11 @@ GEM
|
|
|
166
166
|
ruby_dep (1.5.0)
|
|
167
167
|
ruby_parser (3.9.0)
|
|
168
168
|
sexp_processor (~> 4.1)
|
|
169
|
-
rubycritic (3.2.
|
|
169
|
+
rubycritic (3.2.2)
|
|
170
170
|
flay (~> 2.8)
|
|
171
171
|
flog (~> 4.4)
|
|
172
172
|
launchy (= 2.4.3)
|
|
173
|
-
parser (
|
|
173
|
+
parser (~> 2.4.0)
|
|
174
174
|
rainbow (~> 2.1)
|
|
175
175
|
reek (~> 4.4)
|
|
176
176
|
ruby_parser (~> 3.8)
|
|
@@ -184,7 +184,7 @@ GEM
|
|
|
184
184
|
docile (~> 1.1.0)
|
|
185
185
|
json (>= 1.8, < 3)
|
|
186
186
|
simplecov-html (~> 0.10.0)
|
|
187
|
-
simplecov-html (0.10.
|
|
187
|
+
simplecov-html (0.10.1)
|
|
188
188
|
slop (3.6.0)
|
|
189
189
|
sqlite3 (1.3.13)
|
|
190
190
|
term-ansicolor (1.6.0)
|
|
@@ -206,7 +206,6 @@ PLATFORMS
|
|
|
206
206
|
|
|
207
207
|
DEPENDENCIES
|
|
208
208
|
activerecord (~> 5.0.3)
|
|
209
|
-
activerecord-jdbcsqlite3-adapter
|
|
210
209
|
appraisal
|
|
211
210
|
codeclimate-test-reporter
|
|
212
211
|
coveralls
|
data/gemfiles/rails_5.1.gemfile
CHANGED
|
@@ -5,6 +5,7 @@ source "http://rubygems.org"
|
|
|
5
5
|
ruby RUBY_VERSION
|
|
6
6
|
|
|
7
7
|
gem "activerecord", "~> 5.1.1", group: :test, require: false
|
|
8
|
+
gem 'sqlite3'
|
|
8
9
|
|
|
9
10
|
group :development do
|
|
10
11
|
gem 'appraisal', require: false
|
|
@@ -27,8 +28,4 @@ group :test do
|
|
|
27
28
|
gem "simplecov", "~> 0.14", require: false
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
platforms :ruby do
|
|
31
|
-
gem "sqlite3"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
31
|
gemspec path: "../"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
machinist_redux (3.0.
|
|
4
|
+
machinist_redux (3.0.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
@@ -166,11 +166,11 @@ GEM
|
|
|
166
166
|
ruby_dep (1.5.0)
|
|
167
167
|
ruby_parser (3.9.0)
|
|
168
168
|
sexp_processor (~> 4.1)
|
|
169
|
-
rubycritic (3.2.
|
|
169
|
+
rubycritic (3.2.2)
|
|
170
170
|
flay (~> 2.8)
|
|
171
171
|
flog (~> 4.4)
|
|
172
172
|
launchy (= 2.4.3)
|
|
173
|
-
parser (
|
|
173
|
+
parser (~> 2.4.0)
|
|
174
174
|
rainbow (~> 2.1)
|
|
175
175
|
reek (~> 4.4)
|
|
176
176
|
ruby_parser (~> 3.8)
|
|
@@ -184,7 +184,7 @@ GEM
|
|
|
184
184
|
docile (~> 1.1.0)
|
|
185
185
|
json (>= 1.8, < 3)
|
|
186
186
|
simplecov-html (~> 0.10.0)
|
|
187
|
-
simplecov-html (0.10.
|
|
187
|
+
simplecov-html (0.10.1)
|
|
188
188
|
slop (3.6.0)
|
|
189
189
|
sqlite3 (1.3.13)
|
|
190
190
|
term-ansicolor (1.6.0)
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
module Machinist
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
module Machinist
|
|
2
|
+
module ActiveRecord
|
|
3
|
+
class Blueprint < Machinist::Blueprint
|
|
4
|
+
# Make and save an object.
|
|
5
|
+
def make!(attributes = {})
|
|
6
|
+
object = make(attributes)
|
|
7
|
+
object.save!
|
|
8
|
+
object.reload
|
|
9
|
+
rescue ::ActiveRecord::RecordInvalid => exception
|
|
10
|
+
message = "#{exception.class.name}: \"#{exception.message}\" saving #{exception.record.class.name}"
|
|
11
|
+
raise Machinist::BlueprintCantSaveError.new(self, message)
|
|
12
|
+
end
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
def lathe_class #:nodoc:
|
|
15
|
+
Machinist::ActiveRecord::Lathe
|
|
16
|
+
end
|
|
12
17
|
end
|
|
13
18
|
end
|
|
14
19
|
end
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
module Machinist
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
module Machinist
|
|
2
|
+
module ActiveRecord
|
|
3
|
+
class Lathe < Machinist::Lathe
|
|
4
|
+
def make_one_value(attribute, args) #:nodoc:
|
|
5
|
+
if block_given?
|
|
6
|
+
raise_argument_error(attribute) unless args.empty?
|
|
7
|
+
yield
|
|
8
|
+
else
|
|
9
|
+
make_association(attribute, args)
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
|
-
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
def make_association(attribute, args) #:nodoc:
|
|
14
|
+
association = @klass.reflect_on_association(attribute)
|
|
15
|
+
if association
|
|
16
|
+
association.klass.make(*args)
|
|
17
|
+
else
|
|
18
|
+
raise_argument_error(attribute)
|
|
19
|
+
end
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
end
|
data/lib/machinist/exceptions.rb
CHANGED
|
@@ -4,12 +4,13 @@ module Machinist
|
|
|
4
4
|
class BlueprintCantSaveError < RuntimeError
|
|
5
5
|
attr_reader :blueprint
|
|
6
6
|
|
|
7
|
-
def initialize(blueprint)
|
|
7
|
+
def initialize(blueprint, message = nil)
|
|
8
8
|
@blueprint = blueprint
|
|
9
|
+
@message = message
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def message
|
|
12
|
-
"make! is not supported by blueprints for class #{@blueprint.klass.name}"
|
|
13
|
+
@message ||= "make! is not supported by blueprints for class #{@blueprint.klass.name}"
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
data/lib/machinist/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: machinist_redux
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pete Yandell
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-05-
|
|
13
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
description: Machinist makes it easy to create objects for use in tests. It generates
|
|
16
16
|
data for the attributes you don't care about, and constructs any necessary associated
|