defekt 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/lib/defekt/assertions.rb +12 -12
- data/lib/defekt/autorun.rb +3 -0
- data/lib/defekt/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3db55a80b9ac8e6bc24783e9032d938ab9ce647
|
4
|
+
data.tar.gz: 25e23d803bd42143a167bd091d1a4c3c88329472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 623fe19b659bb0c4eb5de2a5a8396d3a39e2084afa37e55ecbe1777b7925ca2cc1cebbafd99c2a2c8d6bc5b45cf1adbb293d1bcaf7e95eb847963adc039eefac
|
7
|
+
data.tar.gz: d1a771201173ca1ebbd50cfd1ff50e5d6220b80004bec62b98099fcb153bb11691c04d9eb72c1c79691e81ef929dc1f97f22047d118b99917c06e891730f860f
|
data/README.md
CHANGED
@@ -23,10 +23,10 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
Inherit your test classes from `Defekt::Base` and define your tests prefixed with `test_`. You can define `before` and `after` methods, which are invoked around each test.
|
26
|
+
Inherit your test classes from `Defekt::Base` and define your tests prefixed with `test_`. You can define `before` and `after` methods, which are invoked around each test. By requiring `defekt/autorun` your tests are automatically run.
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
require 'defekt'
|
29
|
+
require 'defekt/autorun'
|
30
30
|
|
31
31
|
class Person
|
32
32
|
attr_reader :name
|
@@ -49,8 +49,6 @@ class PersonTest < Defekt::Base
|
|
49
49
|
equal_to! 'kodnin', @person.name
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
53
|
-
Defekt.run
|
54
52
|
```
|
55
53
|
|
56
54
|
## Assertions
|
@@ -63,10 +61,10 @@ true! | not_true! | value
|
|
63
61
|
nil! | not_nil! | value
|
64
62
|
equal_to! | not_equal_to! | expected, actual
|
65
63
|
identical_to! | not_identical_to! | expected, actual
|
66
|
-
included_in! | not_included_in! | collection, member
|
67
64
|
instance_of! | not_instance_of! | class, instance
|
68
65
|
kind_of! | not_kind_of! | class, instance
|
69
66
|
respond_to! | not_respond_to! | object, method
|
67
|
+
included_in! | not_included_in! | collection, member
|
70
68
|
|
71
69
|
You can add your own assertions by opening up the `Defekt::Assertions` module.
|
72
70
|
|
@@ -87,7 +85,7 @@ end
|
|
87
85
|
Basic mocking and stubbing functionality is supported.
|
88
86
|
|
89
87
|
```ruby
|
90
|
-
require 'defekt'
|
88
|
+
require 'defekt/autorun'
|
91
89
|
|
92
90
|
class Hacker
|
93
91
|
def identity(person)
|
@@ -116,8 +114,6 @@ class HackerTest < Defekt::Base
|
|
116
114
|
not_respond_to! @hacker, :password
|
117
115
|
end
|
118
116
|
end
|
119
|
-
|
120
|
-
Defekt.run
|
121
117
|
```
|
122
118
|
|
123
119
|
## Development
|
data/lib/defekt/assertions.rb
CHANGED
@@ -48,18 +48,6 @@ module Defekt
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def included_in!(collection, member)
|
52
|
-
unless collection.include?(member)
|
53
|
-
raise Errors::IncludedInError, message(member, 'is not included in', collection)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def not_included_in!(collection, member)
|
58
|
-
if collection.include?(member)
|
59
|
-
raise Errors::NotIncludedInError, message(member, 'is included in', collection)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
51
|
def instance_of!(klass, instance)
|
64
52
|
unless instance.instance_of?(klass)
|
65
53
|
raise Errors::InstanceOfError, message(instance, 'is not an instance of', klass)
|
@@ -96,6 +84,18 @@ module Defekt
|
|
96
84
|
end
|
97
85
|
end
|
98
86
|
|
87
|
+
def included_in!(collection, member)
|
88
|
+
unless collection.include?(member)
|
89
|
+
raise Errors::IncludedInError, message(member, 'is not included in', collection)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def not_included_in!(collection, member)
|
94
|
+
if collection.include?(member)
|
95
|
+
raise Errors::NotIncludedInError, message(member, 'is included in', collection)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
99
|
def verify!(mock)
|
100
100
|
unless mock.verify
|
101
101
|
raise Errors::MockExpectationError, 'mock expectation not met'
|
data/lib/defekt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defekt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Boot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- defekt.gemspec
|
86
86
|
- lib/defekt.rb
|
87
87
|
- lib/defekt/assertions.rb
|
88
|
+
- lib/defekt/autorun.rb
|
88
89
|
- lib/defekt/base.rb
|
89
90
|
- lib/defekt/collection.rb
|
90
91
|
- lib/defekt/errors.rb
|