va 0.1.0 → 0.1.1

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: ed2280383b5979b1328c2ad7c89e8b957d2aaea5
4
- data.tar.gz: a1b6a523e79f3bfd85c039b3797bc3c65b262b3e
3
+ metadata.gz: 5887c31b6f007a988c252d4c52cb1f8c4598250c
4
+ data.tar.gz: 793b15b2a9fc46e065342f9b1fd31558769773cd
5
5
  SHA512:
6
- metadata.gz: 5cf04a3feeac74cc8b7c666c07a348704d6720b4d615cef8993f3d6477bdafce054b86f80e83fed8af7a80e8f9c33488819cdda93f391fb73fdc29b5623daf92
7
- data.tar.gz: 2654139e9d6b4c614089c3de4950c3fe0ee928ad830fbace45256bddd719a4b3a14d9d8d82fe97ac332c265f5d857209255c2d800f75fb5350bf5288c2e325db
6
+ metadata.gz: ea237ac47df122348a36a5035ce5c16e401248c5cafbfff4d7b0d9663e7914d4c5105cdf61e36249eece04bc1b12f5c59160176751d9f246a61148b63123132a
7
+ data.tar.gz: 89e94ab72b764d42943eecea80c52399b57e3b299d067611e8f8c945404262d3dff271368a790a63d714efb742ef14a3c683148d23999ae109721627326ec136
data/.travis.yml CHANGED
@@ -1,8 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
- - 1.9.3
5
- - 2.1.0
6
3
  - 2.1.1
7
- - 2.1.2
4
+ - 2.1.4
5
+ - 2.1.5
8
6
  - ruby-head
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ task :test do
4
+ exec "matest spec/*_spec.rb"
5
+ end
6
+
7
+ task :default => :test
data/lib/va/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Va
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/spec/va_spec.rb CHANGED
@@ -6,50 +6,52 @@ scope do
6
6
  attribute :pass
7
7
  end
8
8
 
9
- test "init" do
10
- va = Login.new({"email" => "fede@example.com", pass: "123456"})
11
- assert_equal va.email, "fede@example.com"
12
- assert_equal va.pass, "123456"
9
+ scope "init" do
10
+ let(:va) { Login.new({"email" => "fede@example.com", pass: "123456"}) }
11
+
12
+ it { va.email == "fede@example.com" }
13
+ it { va.pass == "123456" }
13
14
  end
14
15
 
15
16
  scope "#attributes" do
16
- test "all" do
17
- va = Login.new(email: "fede@example.com", pass: "123456")
18
- assert_equal va.attributes, { email: "fede@example.com", pass: "123456" }
17
+ spec "all" do
18
+ @va = Login.new(email: "fede@example.com", pass: "123456")
19
+ @va.attributes == { email: "fede@example.com", pass: "123456" }
19
20
  end
20
21
 
21
- test "some" do
22
- va = Login.new(email: "fede@example.com")
23
- assert_equal va.attributes, { email: "fede@example.com" }
22
+ spec "some" do
23
+ @va = Login.new(email: "fede@example.com")
24
+ @va.attributes == { email: "fede@example.com" }
24
25
  end
25
26
 
26
- test "spureous" do
27
- va = Login.new(email: "fede@example.com", i_dont_belong_here: "HELLO!")
28
- assert_equal va.attributes, { email: "fede@example.com" }
27
+ spec "spureous" do
28
+ @va = Login.new(email: "fede@example.com", i_dont_belong_here: "HELLO!")
29
+ @va.attributes == { email: "fede@example.com" }
29
30
  end
30
31
  end
31
32
  end
33
+
32
34
  scope "custom validations" do
33
- test "basic passing validation" do
35
+ spec "basic passing validation" do
34
36
  class VeryValid < Va::Model
35
37
  validate do
36
38
  true
37
39
  end
38
40
  end
39
41
 
40
- va = VeryValid.new
41
- assert_equal va.valid?, true
42
+ @va = VeryValid.new
43
+ @va.valid?
42
44
  end
43
45
 
44
- test "basic passing validation" do
46
+ spec "basic passing validation" do
45
47
  class VeryInvalid < Va::Model
46
48
  validate do
47
49
  false
48
50
  end
49
51
  end
50
52
 
51
- va = VeryInvalid.new
52
- assert_equal va.valid?, false
53
+ @va = VeryInvalid.new
54
+ ! @va.valid?
53
55
  end
54
56
 
55
57
  scope "A range validation" do
@@ -62,19 +64,19 @@ scope "custom validations" do
62
64
  end
63
65
  end
64
66
 
65
- test "valid" do
66
- r = MyRange.new(from: 1, to: 5)
67
- assert_equal r.valid?, true
67
+ spec "valid" do
68
+ @r = MyRange.new(from: 1, to: 5)
69
+ @r.valid?
68
70
  end
69
71
 
70
- test do
71
- r = MyRange.new(from: 10, to: 5)
72
- assert_equal r.valid?, false
72
+ spec do
73
+ @r = MyRange.new(from: 10, to: 5)
74
+ ! @r.valid?
73
75
  end
74
76
  end
75
77
 
76
78
  scope "can't validate" do
77
- test "invalid arguments" do
79
+ spec "invalid arguments" do
78
80
  begin
79
81
  class FaceValidator < Va::Model
80
82
  attribute :face
@@ -83,11 +85,9 @@ scope "custom validations" do
83
85
  true
84
86
  end
85
87
  end
86
- assert nil
87
88
  rescue Object => e
88
- assert_equal e.class, Va::UnknownAttribute
89
+ e.class == Va::UnknownAttribute
89
90
  end
90
91
  end
91
92
  end
92
93
  end
93
-
@@ -7,24 +7,25 @@ scope "basic validations" do
7
7
  attribute :age
8
8
  validate_present(:name, :age)
9
9
  end
10
- test "passing" do
11
- va = ANonBlankAttribute.new(name: "Fede", age: :of_ultron)
12
- assert_equal va.valid?, true
10
+
11
+ spec "passing" do
12
+ @va = ANonBlankAttribute.new(name: "Fede", age: :of_ultron)
13
+ @va.valid?
13
14
  end
14
15
 
15
- test "one empty string" do
16
- va = ANonBlankAttribute.new(name: "", age: :of_ultron)
17
- assert_equal va.valid?, false
16
+ spec "one empty string" do
17
+ @va = ANonBlankAttribute.new(name: "", age: :of_ultron)
18
+ ! @va.valid?
18
19
  end
19
20
 
20
- test "one nil" do
21
- va = ANonBlankAttribute.new(name: "Fede", age: nil)
22
- assert_equal va.valid?, false
21
+ spec "one nil" do
22
+ @va = ANonBlankAttribute.new(name: "Fede", age: nil)
23
+ ! @va.valid?
23
24
  end
24
25
 
25
- test "both empty" do
26
- va = ANonBlankAttribute.new(name: nil, age: "")
27
- assert_equal va.valid?, false
26
+ spec "both empty" do
27
+ @va = ANonBlankAttribute.new(name: nil, age: "")
28
+ ! @va.valid?
28
29
  end
29
30
  end
30
31
  end
data/va.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
 
24
- spec.add_development_dependency "cutest", "~> 1.2.2"
24
+ spec.add_development_dependency "matest", "~> 1.1.3"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: va
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
  - Federico Iachetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-25 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: cutest
42
+ name: matest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.2
47
+ version: 1.1.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.2
54
+ version: 1.1.3
55
55
  description: Minimalistic framework agnostic Validator.
56
56
  email:
57
57
  - iachetti.federico@gmail.com