simple_assertions 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/lib/simple_assertions/assert_raises.rb +29 -0
- data/lib/simple_assertions/version.rb +1 -1
- data/lib/simple_assertions.rb +1 -0
- data/simple_assertions.gemspec +1 -1
- metadata +23 -41
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm @simple_assertions --create
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SimpleAssertions
|
2
|
+
# Adds attribute matcher to +assert_raises+.
|
3
|
+
#
|
4
|
+
# == Example
|
5
|
+
#
|
6
|
+
# # old behaviour
|
7
|
+
# assert_raises(StandardError) { ... }
|
8
|
+
#
|
9
|
+
# # exact match on attribute message
|
10
|
+
# assert_raises(RuntimeError, :message => "yay!") do
|
11
|
+
# raise "yay!"
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # pattern match on attributes
|
15
|
+
# assert_raises(MyError, :message => /foo/, :code => 23) do
|
16
|
+
# raise MyError, "foo bar", 23
|
17
|
+
# end
|
18
|
+
module AssertRaises
|
19
|
+
def assert_raises(*args, &block)
|
20
|
+
attributes = args.last.is_a?(Hash) ? args.pop : {}
|
21
|
+
exception = super(*args, &block).tap do |exception|
|
22
|
+
attributes.each do |attribute, expected|
|
23
|
+
actual = expected.send(attribute)
|
24
|
+
assert_operator expected, :===, actual
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/simple_assertions.rb
CHANGED
data/simple_assertions.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = SimpleAssertions::VERSION
|
8
8
|
s.authors = ["Peter Suschlik"]
|
9
9
|
s.email = ["ps@neopoly.de"]
|
10
|
-
s.homepage = "https://github.com/neopoly/
|
10
|
+
s.homepage = "https://github.com/neopoly/simple_assertions"
|
11
11
|
s.summary = %q{Useful assertions for test/unit}
|
12
12
|
s.description = %q{}
|
13
13
|
|
metadata
CHANGED
@@ -1,74 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_assertions
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Peter Suschlik
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-10-26 00:00:00 Z
|
12
|
+
date: 2012-06-29 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
22
|
-
email:
|
14
|
+
description: ''
|
15
|
+
email:
|
23
16
|
- ps@neopoly.de
|
24
17
|
executables: []
|
25
|
-
|
26
18
|
extensions: []
|
27
|
-
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- .gitignore
|
22
|
+
- .rvmrc
|
32
23
|
- Gemfile
|
33
24
|
- README.rdoc
|
34
25
|
- Rakefile
|
35
26
|
- lib/simple_assertions.rb
|
36
27
|
- lib/simple_assertions/assert_errors_on.rb
|
28
|
+
- lib/simple_assertions/assert_raises.rb
|
37
29
|
- lib/simple_assertions/testunit.rb
|
38
30
|
- lib/simple_assertions/version.rb
|
39
31
|
- simple_assertions.gemspec
|
40
|
-
homepage: https://github.com/neopoly/
|
32
|
+
homepage: https://github.com/neopoly/simple_assertions
|
41
33
|
licenses: []
|
42
|
-
|
43
34
|
post_install_message:
|
44
35
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
36
|
+
require_paths:
|
47
37
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
55
|
-
- 0
|
56
|
-
version: "0"
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
45
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
version: "0"
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
66
50
|
requirements: []
|
67
|
-
|
68
51
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.
|
52
|
+
rubygems_version: 1.8.24
|
70
53
|
signing_key:
|
71
54
|
specification_version: 3
|
72
55
|
summary: Useful assertions for test/unit
|
73
56
|
test_files: []
|
74
|
-
|