mongoid-rspec 2.1.0 → 2.2.0

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: 644aca9f2b61c8979ce8eb90856a3d7db324e506
4
- data.tar.gz: 8f428ac11869473c94207866056850ceb113246a
3
+ metadata.gz: 699ec1b87e5b320dcbaf578f80eafe007efd931a
4
+ data.tar.gz: 3d2c164d79f3bf55fe230acc7dbe1d79e8368dfc
5
5
  SHA512:
6
- metadata.gz: bb156c8186d891023ed5b423635aef4c673b150728372648cec95de064c72bc7fea35007ea1895d4002f880d787779dddcd9be0ce6304b68dfcdf0554a8aa8d6
7
- data.tar.gz: 83b4e63454cc912622c081fc67b0ff0185bb4b612676ad9ec2e7c7240d39f066fa94fe023066a968ca3c848ac21df4dcfd84c6b29c595894ecb7e35dc716f2e6
6
+ metadata.gz: 46af8cab737f63a787aab8896a0e89ba59cbf71e842bfe4e36474d596e30a6c56b99ea5650f72ddd086fdbecd25af8f44842ac4d83dbd0cd49dbac2706d15fa9
7
+ data.tar.gz: 7fe2a140a8fe81af936df050101600d0adf56d406b25207cd8f7b65397b7a1f63109b71b6cdd9136c0f3eded554ecaa5a82005224e994b88971eca0edbc6160c
@@ -1,8 +1,21 @@
1
1
  module Mongoid
2
2
  module Matchers
3
3
  module Validations
4
+ class ValidateConfirmationOfMatcher < HaveValidationMatcher
5
+ include WithMessage
6
+
7
+ def initialize(name)
8
+ super(name, :confirmation)
9
+ end
10
+
11
+ def with_message(message)
12
+ @expected_message = message
13
+ self
14
+ end
15
+ end
16
+
4
17
  def validate_confirmation_of(field)
5
- HaveValidationMatcher.new(field, :confirmation)
18
+ ValidateConfirmationOfMatcher.new(field)
6
19
  end
7
20
  end
8
21
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Rspec
3
- VERSION = "2.1.0"
3
+ VERSION = "2.2.0"
4
4
  end
5
5
  end
@@ -25,6 +25,7 @@ class User
25
25
  validates :age, presence: true, numericality: true, inclusion: { in: 23..42 }, on: [:create, :update]
26
26
  validates :password, presence: true, on: [:create, :update]
27
27
  validates :password, exclusion: { in: ->(user) { ['password'] } }
28
+ validates :password, confirmation: { message: "Password confirmation must match given password" }
28
29
  validates :provider_uid, presence: true
29
30
  validates :locale, inclusion: { in: ->(user) { [:en, :ru] } }
30
31
 
@@ -21,6 +21,7 @@ RSpec.describe "Validations" do
21
21
  it { is_expected.to validate_numericality_of(:age).on(:create, :update) }
22
22
  it { is_expected.to validate_inclusion_of(:age).to_allow(23..42).on([:create, :update]) }
23
23
  it { is_expected.to validate_presence_of(:password).on(:create) }
24
+ it { is_expected.to validate_confirmation_of(:password).with_message("Password confirmation must match given password") }
24
25
  it { is_expected.to validate_presence_of(:provider_uid).on(:create) }
25
26
  it { is_expected.to validate_inclusion_of(:locale).to_allow([:en, :ru]) }
26
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Sagge
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-01 00:00:00.000000000 Z
12
+ date: 2015-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake