levaleureux / dr_spec

rspec like for dragonruby
The Unlicense
0 stars 2 forks source link

Add more matchers #12

Closed levaleureux closed 1 year ago

levaleureux commented 1 year ago

specific DR/game dev matchers array matchers xml matchers json matchers etc.

levaleureux commented 1 year ago

@terrainoob what is for you a "specific DR/game dev matchers" Could you provide me some examples ?

levaleureux commented 1 year ago

Here a list of basic matchers

Sure! Here is a list of some commonly used standard matchers in RSpec:

  1. Equality:

    • eq: Verifies that two values are equal.
    • eql: Verifies that two values are equal, taking type into account.
  2. Numeric Comparison:

    • be >, be >=: Verifies that a value is greater (or greater or equal) than another.
    • be <, be <=: Verifies that a value is less (or less or equal) than another.
  3. Boolean:

    • be_truthy: Verifies that a value evaluates to true in a boolean context.
    • be_falsey: Verifies that a value evaluates to false in a boolean context.
  4. Type:

    • be_a(type) or be_an(type): Verifies that the object is an instance of the specified type.
    • be_instance_of(type): Verifies that the object is an exact instance of the specified type.
  5. Collection Content:

    • include(element): Verifies that an element is included in a collection.
    • match_array(array): Verifies that the collection is equivalent to the specified array.
  6. String:

    • start_with(string): Verifies that a string starts with the specified text.
    • end_with(string): Verifies that a string ends with the specified text.
    • include(string): Verifies that a string contains the specified text.
  7. Nil:

    • be_nil: Verifies that a value is nil.
  8. Exceptions:

    • raise_error: Verifies that an exception is raised.
    • raise_error(ErrorClass): Verifies that an exception of the specified class is raised.
  9. Respond_to:

    • respond_to(:method_name): Verifies that an object responds to the specified method.
  10. Satisfy:

    • satisfy { |value| ... }: Verifies that the value satisfies a custom condition specified in the block.

This is just a partial list of the matchers available in RSpec. You can find the complete list and more details in the official RSpec documentation: https://rspec.info/documentation/3.10/rspec-expectations/

levaleureux commented 1 year ago

last Nil:

be_nil: Verifies that a value is nil. Exceptions:

raise_error: Verifies that an exception is raised. raise_error(ErrorClass): Verifies that an exception of the specified class is raised. Respond_to:

respond_to(:method_name): Verifies that an object responds to the specified method. Satisfy:

satisfy { |value| ... }: Verifies that the value satisfies a custom condition specified in the block. This is just a partial list of the matchers available in RSpec. You can find the complete list and more details in the official RSpec documentation: https://rspec.info/documentation/3.10/rspec-expectations/

are for another issue