insist 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -6
- data/README.md +1 -1
- data/insist.gemspec +1 -1
- data/lib/insist.rb +20 -0
- data/spec/insist/reject_spec.rb +18 -0
- metadata +58 -63
data/Gemfile.lock
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
insist (0.0.
|
5
|
-
cabin (> 0)
|
4
|
+
insist (0.0.5)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: http://rubygems.org/
|
9
8
|
specs:
|
10
|
-
cabin (0.4.3)
|
11
|
-
json
|
12
9
|
diff-lcs (1.1.3)
|
13
|
-
json (1.6.5)
|
14
|
-
json (1.6.5-java)
|
15
10
|
rspec (2.8.0)
|
16
11
|
rspec-core (~> 2.8.0)
|
17
12
|
rspec-expectations (~> 2.8.0)
|
data/README.md
CHANGED
data/insist.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |spec|
|
|
2
2
|
files = %x{git ls-files}.split("\n")
|
3
3
|
|
4
4
|
spec.name = "insist"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.6"
|
6
6
|
spec.summary = "A simple block-driven assertion library for both testing and for production code"
|
7
7
|
spec.description = spec.summary
|
8
8
|
spec.license = "none chosen yet"
|
data/lib/insist.rb
CHANGED
@@ -49,6 +49,13 @@ class Insist
|
|
49
49
|
end # def value
|
50
50
|
end # class Insist
|
51
51
|
|
52
|
+
# Like Insist, but rejects (fails) on truthy values instead falsey ones.
|
53
|
+
class Reject < Insist
|
54
|
+
def assert(truthy, message)
|
55
|
+
raise Insist::Failure.new(message) if truthy
|
56
|
+
end # def assert
|
57
|
+
end # class Reject
|
58
|
+
|
52
59
|
module Kernel
|
53
60
|
# A shortcut to 'Insist.new'
|
54
61
|
#
|
@@ -58,4 +65,17 @@ module Kernel
|
|
58
65
|
def insist(&block)
|
59
66
|
return Insist.new(&block)
|
60
67
|
end # def insist
|
68
|
+
|
69
|
+
# A shortcut to 'Reject.new'
|
70
|
+
#
|
71
|
+
# Example:
|
72
|
+
#
|
73
|
+
# # This will fail (raises Insist::Failure)
|
74
|
+
# reject { [1,2,3,4] }.include?(3)
|
75
|
+
#
|
76
|
+
# # This will succeed
|
77
|
+
# reject { [1,2,3,4] }.include?(4)
|
78
|
+
def reject(&block)
|
79
|
+
return Reject.new(&block)
|
80
|
+
end # def reject
|
61
81
|
end # module Kernel
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_setup"
|
2
|
+
require "insist"
|
3
|
+
|
4
|
+
describe Insist::Comparators do
|
5
|
+
subject do
|
6
|
+
reject { [1,2,3] }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#include?" do
|
10
|
+
it "should fail if the include? returns true" do
|
11
|
+
insist { subject.include?(2) }.fails
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should succeed if include? returns false" do
|
15
|
+
subject.include?(4)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,84 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: insist
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.5
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Jordan Sissel
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2012-03-19 00:00:00 Z
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
email:
|
18
|
-
|
14
|
+
description: A simple block-driven assertion library for both testing and for production
|
15
|
+
code
|
16
|
+
email:
|
17
|
+
- jls@semicomplete.com
|
19
18
|
executables: []
|
20
|
-
|
21
19
|
extensions: []
|
22
|
-
|
23
20
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
21
|
+
files:
|
22
|
+
- .batcave/manifest
|
23
|
+
- .gitignore
|
24
|
+
- .travis.yml
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.lock
|
27
|
+
- Makefile
|
28
|
+
- README.md
|
29
|
+
- insist.gemspec
|
30
|
+
- lib/insist.rb
|
31
|
+
- lib/insist/assert.rb
|
32
|
+
- lib/insist/comparators.rb
|
33
|
+
- lib/insist/comparators19.rb
|
34
|
+
- lib/insist/enumerables.rb
|
35
|
+
- lib/insist/failure.rb
|
36
|
+
- lib/insist/namespace.rb
|
37
|
+
- lib/insist/nil.rb
|
38
|
+
- lib/insist/predicates.rb
|
39
|
+
- lib/insist/raises.rb
|
40
|
+
- notify-failure.sh
|
41
|
+
- spec/insist/comparators_spec.rb
|
42
|
+
- spec/insist/enumerables_spec.rb
|
43
|
+
- spec/insist/nil_spec.rb
|
44
|
+
- spec/insist/predicates_spec.rb
|
45
|
+
- spec/insist/reject_spec.rb
|
46
|
+
- spec/insist_spec.rb
|
47
|
+
- spec/spec_setup.rb
|
48
|
+
- test/all.rb
|
49
|
+
- test/docs.rb
|
50
|
+
- test/testing.rb
|
54
51
|
homepage:
|
55
|
-
licenses:
|
56
|
-
|
52
|
+
licenses:
|
53
|
+
- none chosen yet
|
57
54
|
post_install_message:
|
58
55
|
rdoc_options: []
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
60
|
none: false
|
65
|
-
requirements:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
66
|
none: false
|
71
|
-
requirements:
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
75
71
|
requirements: []
|
76
|
-
|
77
72
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.8.
|
73
|
+
rubygems_version: 1.8.24
|
79
74
|
signing_key:
|
80
75
|
specification_version: 3
|
81
|
-
summary: A simple block-driven assertion library for both testing and for production
|
76
|
+
summary: A simple block-driven assertion library for both testing and for production
|
77
|
+
code
|
82
78
|
test_files: []
|
83
|
-
|
84
79
|
has_rdoc:
|