set_assertions 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/set_assertions/version.rb +1 -1
- data/lib/set_assertions.rb +1 -1
- data/test/test_set_assertions.rb +8 -8
- metadata +7 -7
data/lib/set_assertions.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require "set_assertions/version"
|
3
3
|
|
4
4
|
module SetAssertions
|
5
|
-
def
|
5
|
+
def assert_equal_set(expected, actual, message=nil)
|
6
6
|
full_message = build_message(message, "array with <?> in any order was expected, got: \n<?>.\n", expected, actual)
|
7
7
|
assert_block(full_message) {
|
8
8
|
(expected.length == actual.length) &&
|
data/test/test_set_assertions.rb
CHANGED
@@ -5,33 +5,33 @@ require 'set_assertions'
|
|
5
5
|
|
6
6
|
class SetAssertionsTest < Test::Unit::TestCase
|
7
7
|
def test_two_empty_tests_pass
|
8
|
-
|
8
|
+
assert_equal_set([], [])
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_two_identical_unit_sets_pass
|
12
|
-
|
12
|
+
assert_equal_set([:a], [:a])
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_an_empty_set_and_a_unit_set_fail
|
16
|
-
assert_fail_assertion {
|
17
|
-
assert_fail_assertion {
|
16
|
+
assert_fail_assertion { assert_equal_set([:a], []) }
|
17
|
+
assert_fail_assertion { assert_equal_set([], [:a]) }
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_order_does_not_matter
|
21
|
-
|
21
|
+
assert_equal_set([:a, :b], [:b, :a])
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_same_cardinality_but_different_set_fails
|
25
|
-
assert_fail_assertion {
|
25
|
+
assert_fail_assertion { assert_equal_set([:a, :b], [:c, :b]) }
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_large_cardinality_passes
|
29
|
-
|
29
|
+
assert_equal_set([:a, :b, "c", 4, "f", :g, :h], [:a, :b, "c", 4, "f", :g, :h])
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_object_equality_passes
|
33
33
|
a = "foo"
|
34
34
|
b = {:foo => "bar"}
|
35
|
-
|
35
|
+
assert_equal_set([a,b], [b,a])
|
36
36
|
end
|
37
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: set_assertions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-28 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152574800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152574800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152574380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152574380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: test-unit
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152573960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152573960
|
47
47
|
description: Custom test-unit assertions for checking set equality and other set functions
|
48
48
|
email:
|
49
49
|
- squeedee@gmail.com
|