tests/object.fy in fancy-0.8.0 vs tests/object.fy in fancy-0.9.0
- old
+ new
@@ -23,11 +23,11 @@
self a_singleton_method is: "a singleton method!"
self undefine_singleton_method: 'a_singleton_method
{ self a_singleton_method } raises: NoMethodError
}
- it: "returns its class" when: {
+ it: "returns its class" with: 'class when: {
nil class is: NilClass
true class is: TrueClass
"foo" class is: String
'bar class is: Symbol
{ 'a_block } class is: Block
@@ -42,28 +42,35 @@
obj = UnknownMessage new
obj this_is_not_defined: "It's true!" . is: "Got: this_is_not_defined: It's true!"
}
- it: "returns a correct string representation" when: {
+ it: "returns a correct string representation" with: 'to_s when: {
3 to_s is: "3"
'foo to_s is: "foo"
nil to_s is: ""
}
- it: "returns a correct array representation" when: {
+ it: "returns a correct array representation" with: 'to_a when: {
nil to_a is: []
'foo to_a is: ['foo]
<['foo => "bar", 'bar => "baz"]> to_a is =? [['bar, "baz"], ['foo, "bar"]]
}
- it: "returns a correct fixnum representation" when: {
+ it: "returns a hash based on own slot values" with: 'to_hash when: {
+ nil to_hash is: <[]>
+ false to_hash is: <[]>
+ true to_hash is: <[]>
+ (0..10) each: @{ to_hash is: <[]> }
+ }
+
+ it: "returns a correct fixnum representation" with: 'to_i when: {
nil to_i is: 0
3 to_i is: 3
3.28437 to_i is: 3
}
- it: "is an Object of the correct Class (or Superclass)" when: {
+ it: "is an Object of the correct Class (or Superclass)" with: 'is_a?: when: {
Object new is_a?: Object . is: true
"foo" is_a?: String . is: true
"foo" is_a?: Object . is: true
1123 is_a?: Fixnum . is: true
1123 is_a?: Object . is: true