assert-moar 0.0.6 → 0.0.7

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: 0e84a3b9014385250895e77106131c496e61c636
4
- data.tar.gz: 84c529c012b077a7575193e5f06b1458dc2ade81
3
+ metadata.gz: 79dfc2889a6758823ab5f567e81a75fb0c5a91ed
4
+ data.tar.gz: 8908c3a207234970736e5a95431d8fe3c98f1ef1
5
5
  SHA512:
6
- metadata.gz: 6a8eaa0eb6c40bc4c02cc0593808a193f893cb46368a0276a0c2ebfdc1e2c760985bd7101cddd83b1588a3db7ea08d1f3421738fcee63e2014926b52d4d4f40c
7
- data.tar.gz: ffa217da9d619ab9bbdb4e8afa786c038370f49690be4867cd9165c0e562110f01a11ddc78bf5b9c54b845c8e059d7fe0cecff50fe6d084c1a6b66cf42fffe75
6
+ metadata.gz: 9026d5f8b99b17e934a0dac3055b1524731c95d94e66b4c1e79f49939da49988c4222cb523be4939c14aa53d3968e61a7b335d0e08088aeeeab93903d65a9137
7
+ data.tar.gz: 49244e50dd6cafdc56359b9bb6e554717ad69cdedd101e8eebcaa029b1b3eb884bd746d1d84e89db8f4f642165b84f86cf3a9c0a82288b2022eb26c275ed92d5
data/.travis.yml CHANGED
@@ -1,6 +1,3 @@
1
1
  rvm:
2
- - 1.9.3
3
2
  - 2.0.0
4
3
  - 2.1.0
5
- - jruby
6
- - rbx
data/README.md CHANGED
@@ -25,8 +25,14 @@ Available methods:
25
25
  ```
26
26
  #assert_valid
27
27
  #refute_valid
28
+ #assert_validates_absence_of
29
+ #refute_validates_absence_of
30
+ #assert_validates_acceptance_of
31
+ #refute_validates_acceptance_of
28
32
  #assert_validates_presence_of
29
33
  #refute_validates_presence_of
34
+ #assert_validates_uniqueness_of
35
+ #refute_validates_uniqueness_of
30
36
  ```
31
37
 
32
38
  ## Contributing
@@ -19,6 +19,26 @@ module AssertMoar::Assertions
19
19
  "#{object} validates presence of #{property}"
20
20
  end
21
21
 
22
+ def assert_validates_absence_of(object, property)
23
+ assert has_validator?(object, property, ::ActiveModel::Validations::AbsenceValidator),
24
+ "#{object} does not validate the absence of #{property}"
25
+ end
26
+
27
+ def refute_validates_absence_of(object, property)
28
+ refute has_validator?(object, property, ::ActiveModel::Validations::AbsenceValidator),
29
+ "#{object} validates absence of #{property}"
30
+ end
31
+
32
+ def assert_validates_acceptance_of(object, property)
33
+ assert has_validator?(object, property, ::ActiveModel::Validations::AcceptanceValidator),
34
+ "#{object} does not validate the acceptance of #{property}"
35
+ end
36
+
37
+ def refute_validates_acceptance_of(object, property)
38
+ refute has_validator?(object, property, ::ActiveModel::Validations::AcceptanceValidator),
39
+ "#{object} validates the acceptance of #{property}"
40
+ end
41
+
22
42
  def assert_valid(object)
23
43
  assert object.valid?, "Expected object to be valid"
24
44
  end
@@ -1,3 +1,3 @@
1
1
  module AssertMoar
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -41,6 +41,28 @@ class AssertMoar::AssertionTest < Minitest::Test
41
41
  @tc.refute_validates_uniqueness_of(double, :property)
42
42
  end
43
43
 
44
+ def test_assert_validates_absence_of
45
+ validator = ::ActiveModel::Validations::AbsenceValidator
46
+ double = ActiveRecordDouble.new(error_map: {property: validator })
47
+ @tc.assert_validates_absence_of(double, :property)
48
+ end
49
+
50
+ def test_refute_validates_absense_of
51
+ double = ActiveRecordDouble.new()
52
+ @tc.refute_validates_absence_of(double, :property)
53
+ end
54
+
55
+ def test_assert_validates_acceptance_of
56
+ validator = ::ActiveModel::Validations::AcceptanceValidator
57
+ double = ActiveRecordDouble.new(error_map: {property: validator})
58
+ @tc.assert_validates_acceptance_of(double, :property)
59
+ end
60
+
61
+ def test_refute_validates_acceptance_of
62
+ double = ActiveRecordDouble.new()
63
+ @tc.refute_validates_acceptance_of(double, :property)
64
+ end
65
+
44
66
  def teardown
45
67
  assert_equal(@assertion_count, @tc.assertions,
46
68
  "expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
@@ -1,5 +1,7 @@
1
1
  module ActiveModel
2
2
  module Validations
3
+ class AbsenceValidator; end
4
+ class AcceptanceValidator; end
3
5
  class PresenceValidator; end
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert-moar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bohn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler