Module: Deep::Matchers
- Included in:
- RSpec::Matchers
- Defined in:
- parser/spec/lib/deep/hash_keys.rb,
parser/spec/lib/deep/hash_values.rb,
parser/spec/lib/deep/array_values.rb,
parser/spec/lib/deep/hash_matchers.rb,
parser/spec/lib/deep/hash_enclosed_in_array.rb
Defined Under Namespace
Classes: ArrayValues, HashEnclosingArray, HashKeys, HashMatchers, HashValues, KeyNameMatchers, KeyNamesOfEnclosedHash, SameArrayValues
Constant Summary
- NUMBERS =
All numeric classes we want to consider
[Fixnum, Bignum, Numeric, Float]
Instance Method Summary (collapse)
- - (Object) all_arrays_have_hash_with_key_word_name_or_singular_of_hash_key
-
- (Object) have_all_keys_be_word_name_or_singular_of(expected)
Test that array has only elements of expeted class(es).
-
- (Object) have_array_values_in_class(expected)
Test that array has only elements of expeted class(es).
-
- (Object) have_array_values_of_the_same_class
Test that array elements are all in the same class.
-
- (Object) have_keys_in_class(expected)
Test that hash has only keys of expected class(es).
-
- (Object) have_values_in_class(expected)
Test that hash has only values of expected class(es).
Instance Method Details
- (Object) all_arrays_have_hash_with_key_word_name_or_singular_of_hash_key
18 19 20 |
# File 'parser/spec/lib/deep/hash_enclosed_in_array.rb', line 18 def all_arrays_have_hash_with_key_word_name_or_singular_of_hash_key HashEnclosingArray.new end |
- (Object) have_all_keys_be_word_name_or_singular_of(expected)
Test that array has only elements of expeted class(es).
Usage
it { @TODO.should TODO }
14 15 16 |
# File 'parser/spec/lib/deep/hash_enclosed_in_array.rb', line 14 def have_all_keys_be_word_name_or_singular_of (expected) KeyNamesOfEnclosedHash.new(expected) end |
- (Object) have_array_values_in_class(expected)
Test that array has only elements of expeted class(es).
Array is a value in deep (multilevel) hash. Check done hierarchically for all arrays' values.
Usage
it { @hash.should have_array_values_in_class [String,Numeric,Hash] }
it { @hash.should have_array_values_in_class Numeric }
15 16 17 |
# File 'parser/spec/lib/deep/array_values.rb', line 15 def have_array_values_in_class(expected) ArrayValues.new(expected) end |
- (Object) have_array_values_of_the_same_class
Test that array elements are all in the same class.
Array is a value in deep (multilevel) hash. Check done hierarchically for all arrays' values.
Usage
it { @hash.should have_array_values_of_the_same_class }
29 30 31 32 |
# File 'parser/spec/lib/deep/array_values.rb', line 29 def have_array_values_of_the_same_class SameArrayValues.new Object # dummy class, not used but needs to # be here because of constructor end |
- (Object) have_keys_in_class(expected)
Test that hash has only keys of expected class(es).
Check done hierarchically for all Hashes.
Usage
it { @hash.should have_keys_in_class [String,Numeric,Hash,Array] }
it { @hash.should have_keys_in_class Numeric }
14 15 16 |
# File 'parser/spec/lib/deep/hash_keys.rb', line 14 def have_keys_in_class(expected) HashKeys.new(expected) end |
- (Object) have_values_in_class(expected)
Test that hash has only values of expected class(es).
Check done hierarchically for all Hashes.
Usage
it { @hash.should have_values_in_class [String,Numeric,Hash,Array] }
it { @hash.should have_values_in_class Numeric }
15 16 17 |
# File 'parser/spec/lib/deep/hash_values.rb', line 15 def have_values_in_class(expected) HashValues.new(expected) end |