Module: RSpec::Clone::ExpectationHelper::It Private

Includes:
Shared
Defined in:
lib/r_spec/clone/expectation_helper/it.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Dsl.it‘s expectation helper module.

API:

  • private

Instance Method Summary collapse

Methods included from Shared

#be, #be_an_instance_of, #be_false, #be_nil, #be_true, #be_within, #change, #eq, #match, #raise_exception, #satisfy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Clone::ExpectationHelper::Shared

Instance Method Details

#expect(value = self.class.superclass, &block) ⇒ Block, Value

Create an expectation for a spec.

Examples:

expect("foo") # => #<RSpec::Clone::ExpectationTarget::Value:0x00007f @actual="foo">
expect { RSpec::Clone::Boom! } # => #<RSpec::Clone::ExpectationTarget::Block:0x... @callable=#<Proc:0x...>>

Parameters:

  • (defaults to: self.class.superclass)

    An actual value.

  • A code to evaluate.

Returns:

  • The wrapped target of an expectation.

API:

  • public



25
26
27
# File 'lib/r_spec/clone/expectation_helper/it.rb', line 25

def expect(value = self.class.superclass, &block)
  ExpectationTarget.call(self.class.superclass, value, block)
end

#is_expectedBlock

Wraps the target of an expectation with the subject as actual value.

Examples:

is_expected # => #<RSpec::Clone::ExpectationTarget::Block:0x00007fb6b8 @callable=#<Proc:0x00007fb6b8>>

Returns:

  • The wrapped target of an expectation.

API:

  • public



37
38
39
# File 'lib/r_spec/clone/expectation_helper/it.rb', line 37

def is_expected
  expect { subject }
end