RSpec

Library providing tools for writing and running RSpec tests.

Class: RSpec::SleepingKingStudios::Matchers::Core::ConstructMatcher

Parent Namespace
RSpec::SleepingKingStudios::Matchers::Core
Inherited Classes
RSpec::SleepingKingStudios::Matchers::BaseMatcher > Object
Included Modules
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters
Defined In
lib/rspec/sleeping_king_studios/matchers/core/construct_matcher.rb

Table Of Contents

Overview

Matcher for checking whether an object can be constructed via #new and #initialize, and the parameters accepted by #initialize.

Since

Back To Top

Constants

DEFAULT_EXPECTED_ITEMS

= Object.new

Inherited From
RSpec::SleepingKingStudios::Matchers::Description

Since

Back To Top

Instance Attributes

#actual => Object (readonly)

Inherited From
RSpec::SleepingKingStudios::Matchers::BaseMatcher

Since

Back To Top

Instance Methods

#argument =>

Also known as: arguments

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Convenience method for more fluent specs. Does nothing and returns self.

Returns

#description => Object

Since

#does_not_match? actual => Boolean

Inherited From
RSpec::SleepingKingStudios::Matchers::BaseMatcher

Inverse of #matches? method.

Parameters

Returns

See Also

Since

#failure_message => Object

Message for when the object does not match, but was expected to. Make sure to always call #matches? first to set up the matcher state.

Since

#failure_message_when_negated => Object

Message for when the object matches, but was expected not to. Make sure to always call #matches? first to set up the matcher state.

Since

#matches? actual => Boolean

Checks if the object responds to :new. If so, allocates an instance and checks the parameters expected by #initialize against the expected parameters, if any.

Parameters

Returns

Since

#with count => RespondToMatcher
#with *keywords =>
#with count, *keywords =>

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Adds a parameter count expectation and/or one or more keyword expectations.

Overloads

#with count => RespondToMatcher

Adds a parameter count expectation.

Parameters
  • count (Integer, Range, nil) — (optional) The number of expected parameters.
Returns
  • (RespondToMatcher) — self
#with *keywords =>

Adds one or more keyword expectations.

Parameters
  • keywords (Array<String, Symbol>) — List of keyword arguments accepted by the method.
Returns
  • () — self
#with count, *keywords =>

Adds a parameter count expectation and one or more keyword expectations.

Parameters
  • count (Integer, Range, nil) — (optional) The number of expected parameters.
  • keywords (Array<String, Symbol>) — List of keyword arguments accepted by the method.
Returns
  • () — self

#with_a_block =>

Also known as: and_a_block

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Adds a block expectation. The actual object will only match a block expectation if it expects a parameter of the form &block.

Returns

#with_arbitrary_keywords => Object

Also known as: and_arbitrary_keywords, with_any_keywords

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Adds an arbitrary keyword expectation, e.g. that the method supports any keywords with splatted hash arguments of the form **kwargs.

#with_keywords =>

Also known as: and_keywords

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Adds one or more keyword expectations.

Parameters

Returns

#with_unlimited_arguments =>

Also known as: and_unlimited_arguments

Inherited From
RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters

Adds an unlimited parameter count expectation, e.g. that the method supports splatted array arguments of the form *args.

Returns

Back To Top


Back to Documentation | Versions | 2.8 | Reference | RSpec | RSpec::SleepingKingStudios | RSpec::SleepingKingStudios::Matchers | RSpec::SleepingKingStudios::Matchers::Core