shoulda-matchers 4.1.2 → 4.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 686cc1117dd1671c3c3a6bed33c00f935dfc423eb74e640495b931965ba6ddbb
4
- data.tar.gz: 0716b77fbb4bf86d7bc0b526a6d070081f753bff94af8bdd043415d3b71aa54d
3
+ metadata.gz: 153f24e7ae0c3f3e4cc672663e3b718d15c5c1c809c6bab7ff3b418038b4ba71
4
+ data.tar.gz: 88ceb4268aa3cb820661e0ec4c41b04e1affedf68917e809f0e7fa33aff8d634
5
5
  SHA512:
6
- metadata.gz: 35aeea48a5feeb86342ebaf93b8ae9621bd3255e12344c040e7c832f0a603073b7f7c95e4fd70029bc64c4daf49ca7bcd4193fc7b751d71c68e8ab1467503f18
7
- data.tar.gz: d401a3db95f35d08b7cd1decc6adbea2acc338576ca48f233fe55ea9f6287535cbf7f6d0115a115931d69911e31c510d235bbc1689c98cf2d301dd65fcf6e52d
6
+ metadata.gz: 2acfc2606814dada7608e2fe9f3fec032493ee316ebfeaeb94cb0c9d47fca23b702f5e54f4c74356a78bf952eb6cc8c42c74636a9b01201afe69a6c56504a8b7
7
+ data.tar.gz: c8db9ff17937194f55950b34cb56a6a71f922634dda173aad454e26915096b3201696b09ff75fe323034922a5d40b3d88a538365f9a58e8a6628e72ecf2855cb
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2019, Tammer Saleh and thoughtbot, inc.
1
+ Copyright (c) 2006-2020, Tammer Saleh and thoughtbot, inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.md CHANGED
@@ -19,7 +19,7 @@ complex, and error-prone.
19
19
 
20
20
  ## Quick links
21
21
 
22
- 📖 **[Read the documentation for the latest version (4.1.2)][rubydocs].**
22
+ 📖 **[Read the documentation for the latest version][rubydocs].**
23
23
  📢 **[See what's changed in a recent version][news].**
24
24
 
25
25
  [rubydocs]: http://matchers.shoulda.io/docs
@@ -406,7 +406,7 @@ Shoulda Matchers follows Semantic Versioning 2.0 as defined at
406
406
 
407
407
  ## License
408
408
 
409
- Shoulda Matchers is copyright © 2006-2019
409
+ Shoulda Matchers is copyright © 2006-2020
410
410
  [thoughtbot, inc][thoughtbot-website]. It is free software,
411
411
  and may be redistributed under the terms specified in the
412
412
  [MIT-LICENSE](MIT-LICENSE) file.
@@ -41,7 +41,7 @@ module Shoulda
41
41
  # end
42
42
  #
43
43
  # it do
44
- # should_not allow_values('http://foo.com', 'buz').
44
+ # should_not allow_values('foo', 'buz').
45
45
  # for(:website_url)
46
46
  # end
47
47
  # end
@@ -51,7 +51,7 @@ module Shoulda
51
51
  # should allow_values('http://foo.com', 'http://bar.com/baz').
52
52
  # for(:website_url)
53
53
  #
54
- # should_not allow_values('http://foo.com', 'buz').
54
+ # should_not allow_values('foo', 'buz').
55
55
  # for(:website_url)
56
56
  # end
57
57
  #
@@ -1096,12 +1096,12 @@ module Shoulda
1096
1096
  self
1097
1097
  end
1098
1098
 
1099
- def optional
1099
+ def optional(optional = true)
1100
1100
  remove_submatcher(AssociationMatchers::RequiredMatcher)
1101
1101
  add_submatcher(
1102
1102
  AssociationMatchers::OptionalMatcher,
1103
1103
  name,
1104
- true,
1104
+ optional,
1105
1105
  )
1106
1106
  self
1107
1107
  end
@@ -1394,7 +1394,7 @@ module Shoulda
1394
1394
  end
1395
1395
 
1396
1396
  def foreign_key_reflection
1397
- if [:has_one, :has_many].include?(macro) && reflection.options.include?(:inverse_of)
1397
+ if [:has_one, :has_many].include?(macro) && reflection.options.include?(:inverse_of) && reflection.options[:inverse_of] != false
1398
1398
  associated_class.reflect_on_association(reflection.options[:inverse_of])
1399
1399
  else
1400
1400
  reflection
@@ -269,7 +269,7 @@ module Shoulda
269
269
  end
270
270
 
271
271
  def type_cast_default
272
- Shoulda::Matchers::RailsShim.type_cast_default_for(model, self)
272
+ model.column_defaults[name]
273
273
  end
274
274
 
275
275
  def primary?
@@ -3,10 +3,6 @@ module Shoulda
3
3
  # @private
4
4
  module RailsShim
5
5
  class << self
6
- def action_pack_gte_4_1?
7
- Gem::Requirement.new('>= 4.1').satisfied_by?(action_pack_version)
8
- end
9
-
10
6
  def action_pack_gte_5?
11
7
  Gem::Requirement.new('>= 5').satisfied_by?(action_pack_version)
12
8
  end
@@ -85,15 +81,6 @@ module Shoulda
85
81
  serialized_attributes_for(model)[attribute_name.to_s]
86
82
  end
87
83
 
88
- def type_cast_default_for(model, column)
89
- if model.respond_to?(:column_defaults)
90
- # Rails 4.2
91
- model.column_defaults[column.name]
92
- else
93
- column.default
94
- end
95
- end
96
-
97
84
  def tables_and_views(connection)
98
85
  if active_record_gte_5?
99
86
  connection.data_sources
@@ -103,11 +90,7 @@ module Shoulda
103
90
  end
104
91
 
105
92
  def verb_for_update
106
- if action_pack_gte_4_1?
107
- :patch
108
- else
109
- :put
110
- end
93
+ :patch
111
94
  end
112
95
 
113
96
  def validation_message_key_for_association_required_option
@@ -1,6 +1,6 @@
1
1
  module Shoulda
2
2
  module Matchers
3
3
  # @private
4
- VERSION = '4.1.2'.freeze
4
+ VERSION = '4.2.0'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tammer Saleh
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-07-31 00:00:00.000000000 Z
17
+ date: 2020-01-08 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport