verify 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +29 -0
- data/README +53 -0
- data/RELEASE +18 -0
- data/lib/mockify.rb +142 -0
- data/lib/verify.rb +205 -0
- data/setup.rb +1585 -0
- data/test/verify-examples.rb +46 -0
- data/test/verify-mockify-01.rb +65 -0
- data/test/verify-verify-01.rb +33 -0
- metadata +64 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/local/bin/ruby -w
|
2
|
+
# encoding: utf-8
|
3
|
+
# file: /home/robert/git/ruby/verify/test/verify-examples.rb
|
4
|
+
|
5
|
+
$:.unshift( File::join( File::dirname( __FILE__ ), %w{ .. lib } ) )
|
6
|
+
|
7
|
+
require 'mockify'
|
8
|
+
require 'verify'
|
9
|
+
|
10
|
+
Verify "Some Important Facts" do
|
11
|
+
verify "42 is true" do
|
12
|
+
42
|
13
|
+
end
|
14
|
+
refute "42 is pretty big" do
|
15
|
+
42 > 100_000
|
16
|
+
end
|
17
|
+
verify_exceptions NoMethodError do
|
18
|
+
42.unrelinguished!
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Verify "With parameters" do
|
23
|
+
verify msg: "Everything is well", target: 42, actual: 21 * 2
|
24
|
+
refute msg: "But not too much", target: 42, actual: 41
|
25
|
+
end
|
26
|
+
|
27
|
+
Verify "Capturing stdout" do
|
28
|
+
out = with_output do | o |
|
29
|
+
puts 42
|
30
|
+
verify target: "42\n", actual: o.string
|
31
|
+
puts
|
32
|
+
verify target: "42\n\n", actual: o.string
|
33
|
+
end
|
34
|
+
verify msg: "with_output converted out to an array of lines",
|
35
|
+
actual: out.map( &:chomp ),
|
36
|
+
target: [ "42", "" ]
|
37
|
+
end
|
38
|
+
|
39
|
+
Verify "Providing stdin" do
|
40
|
+
with_input %w{The Quick Brown Fox} do
|
41
|
+
verify %{first line is "The"} do
|
42
|
+
"The" == gets.chomp
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
# vim: sts=2 sw=2 ft=ruby expandtab nu :
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
$:.unshift( File::join( %w{ .. lib } ) )
|
5
|
+
require 'mockify'
|
6
|
+
require 'verify'
|
7
|
+
|
8
|
+
Verify "metadata" do
|
9
|
+
verify "author" do
|
10
|
+
'Robert Dober' == Lab419::Mockify::AUTHOR
|
11
|
+
end
|
12
|
+
verify "version" do
|
13
|
+
'0.3' == Lab419::Mockify::VERSION
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Verify "Mockify with_output" do
|
18
|
+
x = with_output do
|
19
|
+
puts 42
|
20
|
+
end
|
21
|
+
verify do x == ["42\n"] end
|
22
|
+
|
23
|
+
require 'stringio'
|
24
|
+
out = StringIO::new
|
25
|
+
x = with_output out do
|
26
|
+
puts 42
|
27
|
+
end
|
28
|
+
verify do x == ["42\n"] end
|
29
|
+
verify do out.string == "42\n" end
|
30
|
+
x = with_output out do
|
31
|
+
print "hello "
|
32
|
+
puts "World"
|
33
|
+
end
|
34
|
+
verify do x.map( &:chomp ) == ["42", "hello World"] end
|
35
|
+
verify do out.string == "42\nhello World\n" end
|
36
|
+
|
37
|
+
end
|
38
|
+
Verify "Mockify with_input " do
|
39
|
+
data = %<The quick
|
40
|
+
brown fox
|
41
|
+
jumps over the lazy dog>
|
42
|
+
|
43
|
+
with_input data do
|
44
|
+
verify "gets" do
|
45
|
+
gets == "The quick\n"
|
46
|
+
end
|
47
|
+
verify "readline" do
|
48
|
+
readline == "brown fox\n"
|
49
|
+
end
|
50
|
+
verify_exceptions EOFError do
|
51
|
+
loop do readline end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# The with_input shall be reentrant for the same string
|
56
|
+
with_input data do
|
57
|
+
verify "getline" do
|
58
|
+
readline == "The quick\n"
|
59
|
+
end
|
60
|
+
verify msg: "fancy IO behavior", target: data.split( /\n\r?/ )[1..-1], actual: $stdin.to_a.map( &:chomp )
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
# vim: sts=2 sw=2 ft=ruby expandtab nu :
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# encoding: utf-8
|
3
|
+
# file: ~/git/ruby/verify/test/verify-verify-0.1.rb
|
4
|
+
#
|
5
|
+
$:.unshift( File::join( %w{ .. lib } ) )
|
6
|
+
require 'verify'
|
7
|
+
|
8
|
+
Verify "metadata" do
|
9
|
+
verify "author" do
|
10
|
+
'Robert Dober' == Lab419::Verify::AUTHOR
|
11
|
+
end
|
12
|
+
verify "version" do
|
13
|
+
'0.3' == Lab419::Verify::VERSION
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Verify "itself blockform" do
|
18
|
+
verify do 42 end
|
19
|
+
refute do nil end
|
20
|
+
refute do false end
|
21
|
+
verify_exceptions RuntimeError do
|
22
|
+
raise RuntimeError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Verify "itself paramform" do
|
27
|
+
verify :target => 42, :actual => 42
|
28
|
+
verify :actual => nil
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# vim: sts=2 sw=2 ft=ruby expandtab nu :
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: verify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.3"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert
|
8
|
+
- Dober
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-06-18 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: "Verify is a very simple minitest suite \xC3\xA0 la Testy containing a primitive stdin/stdout mocker ( Mockify )"
|
18
|
+
email: robert.dober@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- LICENSE
|
27
|
+
- README
|
28
|
+
- RELEASE
|
29
|
+
- lib/mockify.rb
|
30
|
+
- lib/verify.rb
|
31
|
+
- setup.rb
|
32
|
+
- test/verify-examples.rb
|
33
|
+
- test/verify-mockify-01.rb
|
34
|
+
- test/verify-verify-01.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/RobertDober/verify
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project: labrador
|
59
|
+
rubygems_version: 1.3.4
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Verify, Mockify a minimalistic test framework.
|
63
|
+
test_files: []
|
64
|
+
|