sampig / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Reflection Assert / Lenient Assertions #287

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the new feature you have in mind.

Provide a good syntax that works like Unitils 
ReflectionAssert.assertReflectionEquals

e.g. 

expect:
x refeq y
x === y
y ~~ y

Which particular problem would this feature solve for you?

Would make Spock even more convenient :) Objects often have equality 
implementations, but tests often want to check for "full" equality (all 
properties are equal)

Please provide any additional information below. You can also assign
labels.

When adding this feature it would be cool if lenient assertions could be added 
too. Here is an example: 

["a", "b"] equalsIgnoringOrder ["b", "a"]
[x, y] reflectionEqualsIgnoringOrder [y, x]

AND this would be a very helpful lenient assertion too: 

a ~ [ id: 1, name: "x" ]
where the assertion succeeds if a has the properties id, name with the given 
values. 

Original issue reported on code.google.com by peter.ri...@smarter-ecommerce.com on 10 Dec 2012 at 2:02