validates_unchangeable 0.1.0 → 0.1.1

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: 12c950dd86c8a0f40865568800414af94ed6a4b09d0d38f422f4586640512156
4
- data.tar.gz: fc6eaf7ac254fef11f412176c1b8582473bdec79d7f203dc8d990f591875e93b
3
+ metadata.gz: 7200b06000c9c49447830bb77d921b350b4f786b1e70549a82519fe434283b39
4
+ data.tar.gz: 40551a957c3e544125600f50777284eda016b13e2e5fa821c102226ddbb338da
5
5
  SHA512:
6
- metadata.gz: 760409153dd7f2b49d46d0d26dfb4fe9ccd6697c3fb0c00705d9851ffba4a8c4c27f2dca5ece5fbb0bb771e1fb401dc8bf1eef736728b404fc13a4fa0748bb7d
7
- data.tar.gz: 18eef940a95472ea9fa802385d91060b1b11dae3ab06b44e2bd6eeccaf89990286ec6aa38d9076c39453095eb4bfdacda787ab4d2f5a2cdc9fa53038edd45186
6
+ metadata.gz: 50e74d7bb8a86ee794c52bb53fc59a8a844232eb1cce4357b460cb6c4192fbeed9d154ece37e1c0cf2635367951f89387147d274f2b747240dec955b59700e57
7
+ data.tar.gz: 76d2606f95c66a7b108faaef7ed2a6e02954741367325f364f0112451ab2edf6a2208dd46d4d4809a84796efd3aefc45ab7f8bbea9061fe57c2fd4d1fb9af075
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validates_unchangeable (0.1.0)
4
+ validates_unchangeable (0.1.1)
5
5
  activemodel (>= 5.0, < 7.0)
6
6
  i18n
7
7
 
@@ -3,9 +3,9 @@
3
3
  RSpec::Matchers.define :validate_unchangeable_of do |attribute|
4
4
  match do
5
5
  actual = subject.is_a?(Class) ? subject.new : subject
6
- actual.public_send(:"#{attribute}=", 'qwerty')
7
- actual.save(validate: false)
8
- actual.public_send(:"#{attribute}=", 'ytrewq')
6
+ actual.public_send(:"#{attribute}=", 'qwerty') if actual.public_send(attribute).nil?
7
+ actual.save(validate: false) if actual.new_record? || actual.changes.present?
8
+ actual.public_send(:"#{attribute}=", nil)
9
9
  expect(actual).to be_invalid
10
10
  @expected_message ||= I18n.t('errors.messages.unchangeable')
11
11
  expect(actual.errors.messages[attribute.to_sym]).to include(@expected_message)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ValidatesUnchangeable
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_unchangeable
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
  - Vital Ryabchinskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-10 00:00:00.000000000 Z
11
+ date: 2020-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord