kintama 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/kintama/assertions.rb +6 -0
- data/test/assertions_test.rb +8 -0
- metadata +4 -4
data/lib/kintama/assertions.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "set"
|
2
|
+
|
1
3
|
module Kintama
|
2
4
|
module Assertions
|
3
5
|
def assert(expression, message="failed")
|
@@ -32,6 +34,10 @@ module Kintama
|
|
32
34
|
assert thing.is_a?(klass), message
|
33
35
|
end
|
34
36
|
|
37
|
+
def assert_same_elements(expected, object, message = "#{object.inspect} does not contain the same elements as #{expected.inspect}")
|
38
|
+
assert Set.new(expected) == Set.new(object), message
|
39
|
+
end
|
40
|
+
|
35
41
|
def assert_nothing_raised(message="should not raise anything", &block)
|
36
42
|
yield
|
37
43
|
rescue Exception => e
|
data/test/assertions_test.rb
CHANGED
@@ -65,6 +65,14 @@ class AssertionsTest < Test::Unit::TestCase
|
|
65
65
|
assert_failed(%|expected "blah" to match /mm/|) { @test.assert_match /mm/, "blah" }
|
66
66
|
end
|
67
67
|
|
68
|
+
def test_should_provide_assert_same_elements_to_compare_arrays
|
69
|
+
assert_passed { @test.assert_same_elements [1,2,3], [1,2,3] }
|
70
|
+
assert_passed { @test.assert_same_elements [1,2,3], [3,1,2] }
|
71
|
+
assert_failed("#{[1,3,4].inspect} does not contain the same elements as #{[1,2,3].inspect}") do
|
72
|
+
@test.assert_same_elements [1,2,3], [1,3,4]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
68
76
|
private
|
69
77
|
|
70
78
|
def assert_passed
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kintama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Adam
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|