machinist_redux 3.0.0 → 3.0.2

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
  SHA1:
3
- metadata.gz: a6975277474c2f278dd63f6ebaf01e930e4e830b
4
- data.tar.gz: 0f4f61f505cb8aa1dedc0abc7d55984d07fee225
3
+ metadata.gz: 738b5887ff27ed4cf136d70a7de741e421769988
4
+ data.tar.gz: 677037c04308f48228731d738d5b58a240f39e59
5
5
  SHA512:
6
- metadata.gz: 6c1d8c9400d7ac81391d511c57dd655ac5d8f9c511e4a075c58178935c8360cd51af43a3610283cc742c93f27a0ab3a334685f0f9f0b00a43d464141d880dc66
7
- data.tar.gz: 7efa8ffa828f5721186c24f1036d78b1523fa9a91a77d36ae763fad5995278c5516bbc3dedf0fe81561ddd27f03f8502bce7e4f0d27821c4f22691514351534b
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
@@ -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.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.1)
169
+ rubycritic (3.2.2)
170
170
  flay (~> 2.8)
171
171
  flog (~> 4.4)
172
172
  launchy (= 2.4.3)
173
- parser (= 2.4.0)
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.0)
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
@@ -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.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.1)
169
+ rubycritic (3.2.2)
170
170
  flay (~> 2.8)
171
171
  flog (~> 4.4)
172
172
  launchy (= 2.4.3)
173
- parser (= 2.4.0)
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.0)
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
@@ -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.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.1)
169
+ rubycritic (3.2.2)
170
170
  flay (~> 2.8)
171
171
  flog (~> 4.4)
172
172
  launchy (= 2.4.3)
173
- parser (= 2.4.0)
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.0)
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::ActiveRecord
2
- class Blueprint < Machinist::Blueprint
3
- # Make and save an object.
4
- def make!(attributes = {})
5
- object = make(attributes)
6
- object.save!
7
- object.reload
8
- end
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
- def lathe_class #:nodoc:
11
- Machinist::ActiveRecord::Lathe
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::ActiveRecord
2
- class Lathe < Machinist::Lathe
3
- def make_one_value(attribute, args) #:nodoc:
4
- if block_given?
5
- raise_argument_error(attribute) unless args.empty?
6
- yield
7
- else
8
- make_association(attribute, args)
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
- def make_association(attribute, args) #:nodoc:
13
- association = @klass.reflect_on_association(attribute)
14
- if association
15
- association.klass.make(*args)
16
- else
17
- raise_argument_error(attribute)
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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Machinist
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
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.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-17 00:00:00.000000000 Z
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